-->

Welcome to our Coding with python Page!!! hier you find various code with PHP, Python, AI, Cyber, etc ... Electricity, Energy, Nuclear Power

Sunday 6 September 2020

How Content Marketers can deal with audience Abandonment


The all-encompassing digital takeover has completely changed the way we communicate and interact as people. Naturally, in our professional realm we tend to tie this back to marketing, but the reality applies to just about every aspect of human relations.  This includes dating and courtship, of course. The terms of engagement (so to speak) have transformed wildly. Whereas romance still can and does sprout through chance meetings, or encounters at the bar, or mutual college friend circles, it’s increasingly common for these fated connections to take place through online matchmaking sites and dating apps. (I would know — I’m marrying an amazing gal this weekend who I originally met on such an app!)We can tie this trend back to marketing as well. Last year, our Annie Leuman shared integrated content marketing insights drawn from the world of online dating. Today, I’m a little more interested in the content marketing implications of a specific element of this new playing field: ghosting.

What is ‘Ghosting’ and How Does It Relate to Marketing? 

Ghosting is defined as “the practice of ending a personal relationship with someone by suddenly and without explanation withdrawing from all communication.” (Yes, it’s actually in the dictionary now.) Technically this is a behavior that can be traced back decades and centuries, but it has really risen to prominence at a time where achieving radio-silence — via text or messaging app, with fewer mutual acquaintances in play — is easier than ever. via GIPHY Here’s the thing about ghosting: it sucks. I’ve been on both sides of it, and I’m sure many people reading this have too. Most often, folks engage in this practice because — when you’re not really feelin’ the vibes — it can feel gentler to simply disappear and move on than to explain your detachment directly. But the truth is that ghosting is actually more cruel than the alternative. As Psychology Today puts it, “The opposite of love isn’t hate, it's indifference.”  “Ghosting gives you no cue for how to react,” adds the PT article. “It creates the ultimate scenario of ambiguity. Should you be worried? What if they are hurt and lying in a hospital bed somewhere? Should you be upset?” As a content marketer, even if you’ve never been ghosted in personal capacity, you probably have experienced the phenomenon in your work. Blog traffic has inexplicably dropped. Your social media accounts have stopped receiving engagement. People aren’t opening your emails anymore. It’s upsetting to see the numbers take a dive, but all the more so when you can’t diagnose the cause. If readers were sending you angry messages about how you’re overloading their inbox with newsletter frequency, or posting totally irrelevant tweets, it might sting a little but at least you know what’s up.For those situations shrouded in paranormal perplexity, let’s pull out our P.K.E. meters and do some ghost-busting.via GIPHY

Don’t Get Spooked: How to React When Your Audience Ghosts You

A sharp decline in traffic or engagement can be as upsetting any unreturned text message. When you can’t identify the reasons behind such a drop-off, it’s like sitting in limbo. Here’s a look at four common scenarios where your audience may have inexplicably gone quiet, and what to do about it.

Blog Visitors or Comments Have Taken a Dive

Your blog was cruising along. Your analytics dashboard showed a steady flow of visitors, and your content was even compelling a healthy amount of feedback from readers. But lately, the traffic has been consistently down and you’re not getting any comments. What Might Be Happening
  • Your topical alignment is missing the mark
  • Your publishing cadence isn’t jibing with your audience
  • There are technical issues affecting your blog
  • Your headlines aren’t grabbing attention
  • You’re aren’t properly promoting your posts
  • You aren’t optimizing enough for search
What To Do
  • Consult your analytics to determine which subject matter is gaining the most traction. Then, take a step back and build out topic cluster, or content pillars, around these areas (in a way that also makes sense for your business and objectives).
  • Audit your posting frequency to find your sweet spot. Do you get more traffic if you post daily? Weekly? Every other week?
  • Huddle with your SEO specialists to identify content opportunities (widening your topical umbrella) or technical issues (like broken links, missing metadata, or canonical URL problems). Link building is another opportunity to explore.
  • Test headlines and CTAs with punchier and more interesting words.
  • Put more effort into promoting new posts (social media, email, employee advocacy, etc.). Don’t fall victim to invisible content syndrome!

Organic Search Traffic Is Trending Down

This is a digital marketing KPI for most companies these days. Whether to your blog, your home page, or other prioritized assets, organic traffic is extremely valuable because it is so cost-efficient — when you have a fruitful strategy in place, you are driving a steady stream of (relatively) targeted inbound visits that you don’t have to pay for directly.  So needless to say, when you see your organic traffic charts declining or stagnating over multiple months, it can set off some alarm bells. What Might Be Happening
  • Your rankings are dropping for high-volume queries on SERPs
  • Previously high-performing pages are seeing diminished traction
  • You’re overly concerned with technical SEO aspects, at the expense of user experience
  • Searcher behaviors or engine algorithms are shifting
  • Something is broken or amiss on your site, preventing Google from crawling it properly
  • Site redesign or migration issues are taking a toll
What To Do
  • Reassess your keyword strategy to determine where you’re losing steam, and whether you should focus on other terms
  • Identify specific pages that are seeing a decline in performance and investigate
  • Explore your site from the perspective of a user, and take a hard honest look at the quality of the experience. (Google increasingly prioritizes sites based on UX signals as opposed to strictly technical ones.)
  • Research broader trends around your audience and Google’s algorithm to see if changes are potentially affecting your traffic.
  • Huddle with your web developers and SEO specialists to identify technical issues (like broken links, missing metadata, or canonical URL problems).

Social Media Engagement Is Drying Up

Social media channels present an opportunity to engage with your audience directly and authentically. When the engagement with your brand stops however, this community of more than 3 billion people can start to feel very lonely indeed. What Might Be Happening
  • You’re on the wrong channels
  • Your content isn’t valuable to your audience
  • Your content isn’t soliciting responses and interaction from your audience
  • You’re not posting frequently enough
  • You’re not sharing enough interesting visual content
  • Social media algorithms are suppressing your reach
  • You’re not reaching out and building relationships
What To Do
  • Re-evaluate your channel mix and make sure you’re focusing on social networks where your audience is present and active.
  • Make sure you’re sharing plenty of content that doesn’t promote your brand or solutions, and is solely intended to inform, interest, or entertain people in your niche.
  • Create more posts that ask questions or feature polls/surveys. Try running a contest with a fun incentive to encourage participation.
  • Post more frequently if it makes sense for your audience. On crowded and ephemeral feeds, you’ll want to generate familiarity and recognition with your followers.
  • Include more visually-centered posts, with images, videos, gifs, etc. 
  • Algorithms can be tough to overcome, especially when your following is still small. Integrate paid tactics to amplify your content with targeted audiences, and grow your following. Also use appropriate hashtags and encourage your employees to share posts from your accounts in their own networks.
  • Social media is a two-way conversation. Make sure you’re responsive, and proactive in talking to others. In addition, build genuine relationships with influencers in your industry. This can not only lead to active conversations on social platforms, but also more content collaboration.

Emails Aren’t Getting Opens or Clicks

If someone unsubscribes from your email list, at least they’re making a definitive statement. It’s like receiving a text that says, “I’m not interested anymore.” They might not give a specific reason, but you can look at the timing and circumstances to form your own deductions.  When people just stop opening or clicking, though? That’s more mysterious. What Might Be Happening
  • Your subject lines aren’t compelling enough
  • Your email content isn’t displaying properly
  • Your messages aren’t personalized
  • Your email list is outdated, unsegmented, or purchased
  • You’re sending emails too frequently
  • Your messages are getting stuck in the spam filter
  • Your sender name isn’t a real person
What To Do
  • Test punchier subject lines with evocative statements and action-oriented words.
  • Keep in mind that various email clients won’t display all of your images, emojis, or multimedia. Don’t be afraid to get snazzy, but design your emails with basic accessibility/readability in mind.
  • Make your emails more personalized. This doesn’t necessarily mean you have to be speaking individually to each recipient, but you want to make them feel like you are. Apply the full extent of knowledge about your audience personas.
  • Email lists can be problematic for a variety of reasons. Frequent cleansing is recommended. Remove inactive email addresses. Make sure people are opting in and never being added with their explicit permission. Use segmenting to create more customized messaging for various slices of your audience.
  • Few people complain about brands emailing them too infrequently. Been when they’re seeing you in their inbox multiple times a week, it can feel clingy. Treat the ability to email your list as a privilege and show restraint.
  • Spam filters are pesky. Avoid using words that are likely to trigger them (i.e., sale, buy, price, discount, offer). In your initial “Thanks for subscribing message,” it doesn’t hurt to encourage new sign-ups to add your email address to the non-spam list so they don’t miss your great content.
  • Use the actual name of a marketer or executive at your company in the “From” field. People want messages from people, not faceless businesses.

Python | Generate QR Code using pyqrcode module

Let’s see how to generate QR code in Python using pyqrcode module.
pyqrcode module is a QR code generator. The module automates most of the building process for creating QR codes. This module attempts to follow the QR code standard as closely as possible. The terminology and the encodings used in pyqrcode come directly from the standard.
Installation
$ pip install pyqrcode

install an additional module pypng to save image in png format:
$ pip install pypng

pyqrcode.create(content, error='H', version=None, mode=None, encoding=None) : When creating a QR code only the content to be encoded is required, all the other properties of the code will be guessed based on the contents given. This function will return a QRCode object:
One can specify all the properties of required QR code through the optional parameters of the pyqrcode.create() function. Below are some properties:
error: This parameter sets the error correction level of the code.
version: This parameter specifies the size and data capacity of the code.
mode: This parameter sets how the contents will be encoded.
Below is the code:
# Import QRCode from pyqrcode 
import pyqrcode 
import png 
from pyqrcode import QRCode 

# String which represents the QR code 

# Generate QR code 
url = pyqrcode.create(s) 

# Create and save the svg file naming "myqr.svg" 
url.svg("myqr.svg", scale = 8) 

# Create and save the png file naming "myqr.png" 
url.png('myqr.png', scale = 6) 
Your Output is like below:

Python Wheels

What are wheels?

Wheels are the new standard of Python distribution, especially python 3.x, and are intended to replace eggs. Support is offered in pip >= 1.4 and setuptools >= 0.8.

Advantages of wheels

  1. Faster installation for pure Python and native C extension packages.
  2. Avoids arbitrary code execution for installation. (Avoids setup.py)
  3. Installation of a C extension does not require a compiler on Linux, Windows or macOS.
  4. Allows better caching for testing and continuous integration.
  5. Creates .pyc files as part of installation to ensure they match the Python interpreter used.
  6. More consistent installs across platforms and machines.

What is this list?

This site shows the top 360 most-downloaded packages on PyPI showing which have been uploaded as wheel archives.
  • Green packages offer wheels,
  • White packages have no wheel archives uploaded (yet!).
Packages that are known to be deprecated are not included. (For example distribute). If your package is incorrectly listed, please create a ticket.
This used to show the all-time most-downloaded packages. The all-time list is no longer available, and the packages in the last-365-days list will change to reflect more closely what the Python community is using.
This is not the official website for wheels, just a nice visual way to measure adoption. To see the authoritative guide on wheels and other aspects of Python packaging, see the Python Packaging User Guide.

My package is white. What can I do?

Pure Python

If you have a pure Python package that is not using 2to3 for Python 3 support, you've got it easy. Make sure Wheel is installed…
pip install wheel
…and when you'd normally run python setup.py sdist, run instead python setup.py sdist bdist_wheel. For a more in-depth explanation, see this guide on sharing your labor of love.
Note: If your project is Python 2 and 3 compatible you can create a universal wheel distribution. Create a file called setup.cfg with the following content and upload your package.
[bdist_wheel]
universal = 1
Warning: If your project has optional C extensions, it is recommended not to publish a universal wheel, because pip will prefer the wheel over a source installation.
Note: To include your project's license file in the wheel distribution, specify the license_files key in the [metadata] section. This helps comply with many open source licenses that require the license text to be included in every distributable artifact of the project. This option requires wheel 0.32 or newer.
[metadata]
license_files = LICENSE

C extensions

PyPI currently allows uploading platform-specific wheels for Windows, macOS and Linux. It is useful to create wheels for these platforms, as it avoids the need for your users to compile the package when installing.
You will need to have access to the platform you are building for.

Saturday 5 September 2020

Displaying a map in a Django Webapp: Develop a GIS webapp with GeoDjango

We will use the geo-database configured in the previous tutorial, fill one of its table with world cities geocoordinates, and show these cities eventually on a map in the Django web app that will be configured in this tutorial.

Create a new Django project

Install Django (v2 is the latest version) using the Python package manager pip:



Another python package that must be installed is the PostgreSQL adapter for python, Psycopg:



For the purpose of this tutorial, we’ll go briefly through the steps necessary to create a new Django project with a single app. A more comprehensive tutorial dedicated to creating a poll application with Django can be found on the official website, and constitutes a good starting point to get started with Django.
Create a new directory and generate a new project inside of it. Let’s call our project “world”:



Afterwards, we need to configure Django to have access to the database we created using the user added in the first part of this tutorial. To do so, in your project folder open the file ‘world/settings.py` and add the following (don’t forget to set the database name and the user/password accordingly):



If the database has been configured correctly, you can now run the server from the command-line:



And you should see a webpage similar to the one below if you go to “localhost:8000” in your browser:


Image for post

Create a new Django app

GeoDjango is a module included with Django that adds support to Geospatial data. One important feature of the GeoDjango module we will need in this tutorial are geospatial fields in Django models. However, GeoDjango needs to be enabled first in our project by adding it to the list of installed apps in “world/settings.py”:



Next, we create a single app in our project. We’ve called this app “cities” since it will represent the list of cities we will copy from the vector file to the database later:



And add this app the list of apps in “world/settings.py”, as we did for GeoDjango:



In this app, we create a model which represents an abstraction of the database table, by adding the code below to “cities/models.py”. This model has two fields representing the name and the coordinates of the cities respectively. The meta class modifies the formatting in the Django admin backend by telling it to sort the cities by name and to set the plural of the word ‘city’ to “cities” (not “citys” as we would get by default):



From this model a database table can generated with the commands below. Note that the second command will also create Django’s admin module tables that will store the users credentials among others:



We can verify the creation of the database table with PgAdmin4.


Image for post

Convert shapefile to PostGIS table

The vector shapefile of interest in this tutorial is a map of the world cities that can be also downloaded from this link. This shapefile can be opened and visualized with QGIS. This is what it should look like if it is superimposed on Google maps (over 7000 cities all over the world):


Image for post

We will need to initially convert this vector shapefile to the PostGIS format of our database table (i.e. basically fill the table with the shapefile content), so we can access it later from the Django’s admin section (localhost:8000/admin) and from the front-end (localhost:8000/cities).
We must install the GDAL commands which if on Windows are included with QGIS. After installing QGIS the commands we will need can be found in the OSGeo4W Shell, which was installed with QGIS as well. On Arch Linux, this can be done differently by installing GDAL from the terminal:



On Windows, to avoid having a GDALException later regarding a missing EPSG csv file, we’re going to be proactive and add a system environment variable called “GDAL_DATA” having as a value: “C:\Program Files\QGIS 2.18\share\gdal”.
The conversion from the .shp format to the PostGIS table is carried out with a single command. Don’t forget to provide the database name, the database user and password, as well as the database table name that can be retrieved using the PostgreSQL GUI client, pgAdmin4. The -append option ensures that we’re adding to the existing table generated from the previous Django model, instead of creating the database table from scratch:



We can verify that the database table has been correctly filled with the cities names and geocoordinates in PgAdmin4:


Image for post

Configure URL routes

Url routes have to be set-up so that the cities app can be accessed from the browser. We thus open “world/urls”, and add the url to the new app in the urlpatterns list:



All it does is to redirect any url that starts with “cities” to the urls file in the cities app. So what we have left to do is to create this file “cities/urls.py”:



Show cities on a map

In the following we’ll display on the browser the cities that we copied inside the database table. Django-leaflet is based on leaflet and is installed the same way as any python module. We’re going to make use of Django-leaflet to display maps on our Django web app:



This app needs to be registered among the list of installed apps in “world/settings.py”:



The url route added in the last part of the previous section forwards any request under the form “cities/<number>” to the CitiesDetailView class. This class is added to “cities/views.py”:



The generic class we’re inheriting from (django.views.generic.DetailView) already implements the detail view for a single city. We therefore just need to provide the template path and the model to render. The template for this detail page will be located in “templates/cities/city-detail.html”. Its content can be found below, where we followed the examples on Django-leaflet docs. The only part that deserves a small explanation is in the javascript block, where we’re putting a marker with leaflet at the coordinates of the city in question:



Now that both the view, the url route and the template have been configured if you browse to http://localhost:8000/cities/city/7223 for example, you should see a map of the city of San Francesco:


Image for post

This tutorial has been relatively long. The next one in the series, which is actually the last one, will cover how to display maps on the Django admin page using Leaflet as always.

GEOS error on Windows

On Windows, when I browse to the url just created (e.g. localhost:8000/cities/city/1), Django started complaining about the GEOS library which couldn’t be found. To fix it, just open the settings.py and add at the end the path to this library (libgeos_c.dll), which is located inside the PostgreSQL folder:
In the last part of this tutorial we’ll see how to visualize the map on the Django Admin section.
Don’t forget to clap if this story has been useful to you.

Rank

seo