Articles

In this article, we will talk about what a PDO is, why is it necessary, and how to work with it.
Let’s start with the fact that for a long time php-programmers have been discussing the fate of the native functions to work with the database: mysql_connect, mysql_query, and others. The fact is that in upcoming versions of PHP data will be erased, these functions will go "Obsolete". Thus PHP developers should force on other tools to work with the database.
Currently, there are two alternatives solutions; mysqli extension and expansion of PDO. In this article, we will discuss PDO.
PDO – PHP Data Objects – is a layer that offers a versatile way to work with multiple databases.
This layer has several advantages:
  • PDO allows you to work with different databases, such as: MYSQL, Oracle, PostgreSQL and many others.
  • PDO allows you to work with a prepared statement
Now let’s talk about all this in more detail.

Connecting to a Database Using PDO

Before you start working with PDO, you must make sure that you have the correct extension – php_pdo_mysql.dll. This can be verified through the function phpinfo(). If everything is okay, you are good to go.
First we need to connect to the database:
PHP

 

xxxxxxxxxx
1

15

 

1

/ / MuSQL

2


3

   $Database = new PDO ("mysql: host = $ host; dbname = $Databasename", $username, $password); 

4


5

/ / PostgreSQL

6


7

   $Database = new PDO ("pgsql: host = $ host; dbname = $Databasename", $username, $password);

8


9

/ / MS SQL

10


11

   $Database = new PDO ("mssql: host = $ host; dbname = $Databasename", $username, $password); 

12


13

/ / SQLite

14


15

   $Database = new PDO ("sqlite: my / database / path / database.db");

As you can see from the example, each database connection string is slightly different from each other
You should always use try/catch when you are trying to connect to the unit, so that on exception we do not disclosed any data to the user.
PHP

 

xxxxxxxxxx
1

 

1

try {

2

   $Database = new PDO ("mysql: host = $ host; dbname = $Databasename", $username, $password); 

3

} 

4

catch (PDOException $ e) { 

5

   echo "Unable to connect to database"; 

6

}

Source de l’article sur DZONE

Google resembles an iceberg: there’s the part above the water we can see and use everyday; there’s also the part beneath the water, that we don’t see and know little about.

While many of us are concerned about the aspects of Google we don’t see — the parts that threaten our privacy, or monopolize the web — there’s no denying that Google offers some amazing products and tools, many of them free, all from the convenience of a single login.

Today we’re going to take a look at 12 tools from Google that really do bring something positive to the table.

1. Polymer

Polymer is an open-source JavaScript library from Google for building web applications using Web Components. The platform comes with a ton of libraries and tools to help designers and developers unlock the web’s potential by taking advantage of features like HTTP/2, Web Components, and Service Workers. 

The main feature of Polymer is Web Components. With Web Components, you can share custom elements to any site, work seamlessly with any browser’s built-in elements, and effectively use frameworks of all kinds. Products like LitElement (a simple base class for creating fast, lightweight web components) and PWA Starter Kit make Polymer easy to use. If you like, you can build your app entirely out of Web Components.

2. Lighthouse

Google Lighthouse is an open-source, automated tool for improving the quality of web pages. The software allows you to audit web pages for performance, SEO, accessibility, and more. You can run Lighthouse using ChromeDevTools, directly from the command line, or as a Node module. 

To use Lighthouse in Google Chrome, just go to the URL you want to audit (you can audit any URL on the web), open ChromeDevTools, and click the Audits tab. After you have run the audit, Lighthouse will give you an in-depth report on the web page. 

With these reports, you will see which parts of your web page you need to optimize. Each report has a reference doc that explains why that audit is important and also shows you the steps you can take to fix it. 

You can also use Lighthouse CL to prevent regression on your sites. Using Lighthouse Viewer, you can view and share reports online. You can also share reports as JSON or GitHub Gists. 

Lighthouse also comes with a feature called Stack Packs that allows Lighthouse to detect what platform a site is built on. It also displays specific stack-based recommendations.

3. Google Analytics

Google Analytics is the gold standard of analytics services. Google analytics can be installed on your site for free with a small amount of JavaScript and allows you to see all kinds of details about your site visitors, like what browser they’re using, and where they’re from.

By using Google Analytics you can make decisions about your site based on science, and therefore be somewhat confident that the decisions you make will result in the outcome you are expecting.

4. Flutter

Flutter is Google’s UI toolkit for building natively compiled applications for mobile, web, and desktop from a single codebase. The toolkit is open source and free to use. The best part of Flutter is that it works with existing code. 

The toolkit has a layered architecture that allows for full customization, which results in fast rendering and flexible designs. It also comes with fully-customizable widgets that allow you to build native interfaces in minutes. With these widgets, you will be able to add platform features such as scrolling, navigation, icons, and fonts to provide a full native performance on both iOS and Android.

Flutter also has a feature called hot reload that allows you to easily build UIs, add new features, and fix bugs faster. You can also compile Flutter code to native ARM machine code using Dart native compilers. 

5. Google API Explorer

Google has a huge library of APIs that are available to developers but finding these APIs can be difficult. Google API Explorer makes it easy for developers to locate any API. On the Google API Explorer web page, you will see a complete list of the entire API library. You can easily scroll through the list or use the search box to filter through the API list. 

The best part of Google API Explorer is that each link to a reference page comes with more details on how to use the API. API Explorer is an excellent way to try out methods in the Monitoring API without having to write any code.

6. Puppeteer

Puppeteer is a project from the Google Chrome team. The platform enables web developers to control a Chrome (or any other Chrome DevTools Protocol based browser) and execute common actions, much like in a real browser. Puppeteer is also a Node library and it provides a high-level API for working with headless Chrome. It is also a useful tool for scraping, testing, and automating web pages. 

Here are some things you can do with Puppeteer: generate screenshots and PDFs of pages, UI testing, test Chrome Extensions, automate form submission, generate pre-rendered content, and crawl Single-Page Applications. 

7. Codelabs

Google Developer Codelabs is a handy tool for beginner developers and even advanced developers who want to improve their knowledge. Codelabs provide a guided, tutorial, hands-on coding experience. Codelabs’ site is broken down into several tutorial sessions on different topics. 

With the tutorials on Codelabs, you can learn how to build applications from scratch. Some of the tutorial categories include Augmented reality, TensorFlow, Analytics, Virtual Analytics, G Suite, Search, Google Compute Engine, and Google APIs on iOS. 

8. Color Tool

Color Tool makes it easy for web designers to create, share, and apply colors to their UI. It also measures the accessibility level for any color combination before exporting to the palette. The tool comes with 6 user interfaces and offers over 250 colors to choose from. 

The tool is also very easy to use. All you need to do is pick a color and apply it to the primary color scheme; switch to the secondary color scheme, and pick another color. You can also switch to Custom to pick your own colors. After you have selected all your colors, use the Accessibility feature to check if all is good before exporting it to your palette. 

9. Workbox

Workbox is a set of JavaScript libraries and Node modules. The JavaScript libraries make it easy to add offline support to web apps. The Node modules make it easy to cache assets and offer other features to help users build Progressive Web Apps. Some of these features include pre-caching, runtime caching, request routing, background sync, debugging, and greater flexibility than sw-precache and sw-toolbox. 

With Workbox, you can add a quick rule that enables you to cache Google fonts, images, JavaScript, and CSS files. Caching these files will make your web page to run faster and also consume less storage. You can also pre-cache your files in your web app using their CLI, Node module, or webpack plugin. 

10. PageSpeed Insights

PageSpeed Insights is a handy tool from Google Developers that analyzes the content of a web page, then generates suggestions on how to make the page faster. It gives reports on the performance of a web page on both desktop and mobile devices. At the top of the report, PageSpeed Insights provides a score that summarizes the page’s performance. 

11. AMP on Google

AMP pages load faster and also look better than standard HTML pages on mobile devices. AMP on Google allows you to enhance your AMP pages across Google. It is a web component framework that allows you to create user-first websites, ads, emails, and stories. One benefit of AMP is that it allows your web pages to load almost instantly across all devices and platforms hence improving the user’s experience. 

12. Window Resizer

When creating websites, it is important that developers test them for responsive design – this is where Window Resizer comes in. Window Resizer is a Chrome extension that resizes the browser window so that you can test your responsive design on different screen resolutions. The common screen sizes offered are desktop, laptop, and mobile, but you can also add custom screen sizes. 

 

Featured image via Unsplash.

Source


Source de l’article sur Webdesignerdepot

In my previous article on polymorphic allocators, we discussed some basic ideas. For example, you’ve seen a pmr::vector that holds pmr::string using a monotonic resource. How about using a custom type in such a container? How to enable it? Let’s see.

The Goal

In the previous article there was similar code:

Source de l’article sur DZONE

Time for another update on installing the Red Hat Process Automation Manager with my easy install project.

Installing the latest process automation tooling for your development projects in just minutes on your very own machine has never been easier.

Source de l’article sur DZONE

Change Data Capture Architecture Using Debezium, Postgres, and Kafka
was a tutorial on how to use Debezium for change data capture from Azure PostgreSQL and send them to Azure Event Hubs for Kafka – it used the wal2json output plugin.

What About the pgoutput Plugin?

This blog will provide a quick walk through of how to pgoutput plugin. I will not be repeating a lot of details and use containerized versions (using Docker Compose) of Kafka connect, Kafka (and Zookeeper) to keep things simple. So, the only thing you need is Azure PostgreSQL, which you can setup using a variety of options including, the Azure Portal, Azure CLI, Azure PowerShell, ARM template.

Source de l’article sur DZONE


The Basics

AWS KMS is a Key Management Service that lets you create Cryptographic keys that you can use to encrypt and decrypt data and also other keys. You can read more about it here.

Important Points About Keys

Please note that the CMK generated can only be used to encrypt a small amount of data like passwords, RSA keys. You can use AWS KMS customer master keys (CMKs) to generate, encrypt, and decrypt data keys. However, AWS KMS does not store, manage, or track your data keys, or perform cryptographic operations with data keys.

Source de l’article sur DZONE

The common theme in this month’s collection of new tools and resources is “things that help you show off your work.” Many of these tools are made to help you better web products or apps or showcase designs with others.

Here’s what new for designers this month.

Naturaltts

Naturaltts is an online text to speech converter, that allows you to download an mp3 recording. The tool has more than 60 voices to choose from in six languages. There’s a free plan for personal use (based on characters converted) and affordable paid plans for higher volumes and commercial users. One application of this tool is voiceover for videos or tutorials.

Handz

Handz is a library of hands with different gestures in three-dimensional shapes. The collection includes 12 gestures with nine skin colors, and three different sleeve types. Put all that together and you have 320 potential combinations that you can use for projects. The library is completely free and works in a variety of formats with different tools.

Isoflow

Isoflow allows you to create isometric diagrams for presentations and illustrations with ease. You can edit and then export diagrams for print or website use, thanks to vector rendering.

Device Shots

Device Shots is a small web app that helps you generate a high-resolution device mockup using a screenshot of your website or mobile application. It supports almost every device type you can think of and resizes for social media platforms.

Barchartrace

Barchartrace is a simple MIT open source bar chart generator. Use it to create some of the animated charts you see on social media. Just insert your information (upload via CSV file), choose animation settings, and go.

Zettlr Markdown Editor

Zettlr is a free and open source markdown editor for Mac OS. Zettlr supports simple notations, references, includes a dark mode, and tagging. It’s made for note takers who need a tool to amp up their projects, and is used primarily in higher education.

CSS Leaning Card Effect

The CSS Leaning Card Effect replicates the bookshelf feel you get when rectangles lean with a shadow against planes. Lynn Fisher does it in the pen with code that you can see and work on with your own images.

Lemon.io

Lemon.io is a tool that matches you with freelance developers to get projects moving more quickly. You are guaranteed a match in 24 hours and there is no risk if the match doesn’t work out. Just tell Lemon.io what you need and the algorithm will match you with a dev from the database. Prices for development through the platform start at $35 per hour.

Papercups

Papercups is a customer messaging tool that lets you chat in real-time. The customizable widget works with your favorite tools, such as Slack and Gmail, and is free to use. Chat apps are one of the most in-demand website features right now.

CSS Click to Animate Gif

Christian Heilmann has created a great guide/experiment in pure CSS that adds a play button on top of animated GIFs so that users can control the motion. He developed the concept because GIFs can get overwhelming and annoying. Learn how he did it and see it in action.

3D Book Image Generator

Here’s another little bit of CSS magic with a 3D Book Image Generator. Just input your image and set some specifications and get a 3D book cover image that you can use in projects. (There’s also an accompanying tutorial if you want to learn how to generate the CSS on your own.)

Luckysheet

Luckysheet is an online spreadsheet – it’s a lot like Microsoft Excel – with powerful data functions and tools. It’s user-friendly and open source. It even has quite a few built-in mathematical formulas and supports various table types.

RevKit

RevKit is a design system UI kit that works with Sketch, Figma, and Adobe XD. It includes plenty of organized components that you can pop right into designs to help get them started faster. It also includes a style guide, elements, and form controls. The download is free.

Card

Card allows you to store social media profiles, websites, and files in a customized profile. Share it in one click. Replace awkward contact exchange and multiple usernames with a simple QR code or link.

Scale Nucleus

Scale Nucleus helps visualize data, curate interesting slices within your dataset, review and manage annotations, and measure and debug model performance. This tool claims to be “the right way” to develop ML models.

Previewed

Previewed is a mockup generator to create beautiful promotional graphics for your app. Browse a variety of templates, pick one, customize, and download your design to show off.

NSFW Filter

NSFW Filter is a browser extension that blocks images that aren’t safe for work. The best part is that it runs locally in-browser and doesn’t access any of your data. Plus, it saves you from on-the-job embarrassment.

ColorFlick for Dribbble

ColorFlick for Dribbble is another browser extension that makes it easy to copy hex codes from the tool to your clipboard with ease. You can also create palettes you can share from your favorite shots using Coolors.

Tabler Icons

Tabler Icons is a collection of more than 550 SVG icons that you can customize. Change the color, size, or stroke width with on-screen controls and then click to copy the icons you want to use. It’s that simple!

Teenyicons

Teenyicons might be some of the cutest icons out there. This collection includes minimal 1px icons in outline or solid fills. And there are plenty of icons to choose from. Adjust the size and grab the ones that you need for projects.

Basicons

Basicons is a set of simple icons for product design and development. Plus, they are updated weekly.

Chozy Mermaid

Chozy Mermaid is a super funky novelty typeface to close out summer. The characters feature beach themes within slab characters. It might be hard to find an application for this one, but it is too fun not to share.

Dotuku

Dotuku is a dingbats font with a back to school theme. The limited character set features filled and outline styles that are perfect for classrooms.

Margin

Margin is a fun retro style typeface with a 1970s vibe. It’s a “chubby serif” with 60 characters and 58 glyphs.

Rollanda

Rollanda is a signature-style script with a thicker weight and rough stroke. The character set is pretty robust.

Source


Source de l’article sur Webdesignerdepot

In my last article, we have deep dive into the architecture of Anypoint VPC, VPN (IPSec Tunneling and VPC Peering). We are going to see how we can establish the connection between Anypoint platform and GCP using the VPN IPSec tunneling.

Prerequisite

  • Anypoint Platform account with VPN
  • Set up Anypoint VPC.
  • GCP Account for creating VPN.

Lets understand how we can create or establish the connection between the Anypoint Cloudhub and GCP.

Source de l’article sur DZONE

Loops in a programming language is a piece of code that get executed repeatedly until the specified condition becomes false. A loop consists of two parts, a block of statements and a condition that control the loop.

Loops mainly consisted of three statements – initialization condition, test condition, update condition.

Source de l’article sur DZONE

A friend shared this youtube video on the Art of Code where FizzBuzz was demonstrated on SonicPi and also at end of the video (I won’t spoil it for you). After watching it, I was highly inspired to also implement it on Mule, because why not? I even searched the web to see if anyone had already done a FizzBuzz loop on Mule. The fact that I then did it last night kinda tells you that the answer was no.

It turns out that I also learned a thing or two implementing FizzBuzz on Mule 4. FizzBuzz is one of the ways loops are introduced when learning a programming language. Even the recent Golang course I took also introduces loops using FizzBuzz. For the uninitiated, FizzBuzz is derived from a children’s game, the problem statement for a FizzBuzz program is pretty straightforward. This is the same one you can find at HackerRank.

Source de l’article sur DZONE