emGee Software Solutions Custom Database Applications

Share this

Web Technologies

How to use web fonts in CSS

Echo JS - Fri, 02/01/2019 - 13:10
Categories: Web Technologies

A primitive tween function

Echo JS - Fri, 02/01/2019 - 13:10
Categories: Web Technologies

MySQL Connector/Node.js 8.0.15 has been released

Planet MySQL - Fri, 02/01/2019 - 10:11

Dear MySQL users,

MySQL Connector/Node.js is a new Node.js driver for use with the X
DevAPI. This release, v8.0.15, is a maintenance release of the
MySQL Connector/Node.js 8.0 series.

The X DevAPI enables application developers to write code that combines
the strengths of the relational and document models using a modern,
NoSQL-like syntax that does not assume previous experience writing
traditional SQL.

MySQL Connector/Node.js can be downloaded through npm (see
https://www.npmjs.com/package/@mysql/xdevapi for details) or from
https://dev.mysql.com/downloads/connector/nodejs/.

To learn more about how to write applications using the X DevAPI, see
http://dev.mysql.com/doc/x-devapi-userguide/en/. For more information
about how the X DevAPI is implemented in MySQL Connector/Node.js, and
its usage, see http://dev.mysql.com/doc/dev/connector-nodejs/.

Please note that the X DevAPI requires at least MySQL Server version
8.0 or higher with the X Plugin enabled. For general documentation
about how to get started using MySQL as a document store, see
http://dev.mysql.com/doc/refman/8.0/en/document-store.html.

Changes in MySQL Connector/Node.js 8.0.15 (2019-02-01, General Availability)

This release contains no functional changes and is published
to align version number with the MySQL Server 8.0.15 release.

On Behalf of Oracle/MySQL Release Engineering Team,
Hery Ramilison

Categories: Web Technologies

MySQL Connector/C++ 8.0.15 has been released

Planet MySQL - Fri, 02/01/2019 - 08:27

Dear MySQL users,

MySQL Connector/C++ 8.0.15 is a new release version of the MySQL
Connector/C++ 8.0 series.

Connector/C++ 8.0 can be used to access MySQL implementing Document
Store or in a traditional way, using SQL queries. It allows writing
both C++ and plain C applications using X DevAPI and X DevAPI for C.
It also supports the legacy API of Connector/C++ 1.1 based on JDBC4.

To learn more about how to write applications using X DevAPI, see
“X DevAPI User Guide” at

https://dev.mysql.com/doc/x-devapi-userguide/en/

See also “X DevAPI Reference” at

https://dev.mysql.com/doc/dev/connector-cpp/devapi_ref.html

and “X DevAPI for C Reference” at

https://dev.mysql.com/doc/dev/connector-cpp/xapi_ref.html

For generic information on using Connector/C++ 8.0, see

https://dev.mysql.com/doc/dev/connector-cpp/

For general documentation about how to get started using MySQL
as a document store, see

http://dev.mysql.com/doc/refman/8.0/en/document-store.html

To download MySQL Connector/C++ 8.0.15, see the “Generally Available (GA)
Releases” tab at

https://dev.mysql.com/downloads/connector/cpp/

==================================================

Changes in MySQL Connector/C++ 8.0.15 (2019-02-01, General
Availability)

This release contains no functional changes and is published
to align version number with the MySQL Server 8.0.15 release.

Enjoy and thanks for the support!

On Behalf of Oracle/MySQL Release Engineering Team,
Piotr Obrzut

Categories: Web Technologies

MySQL Connector/Python 8.0.15 has been released

Planet MySQL - Fri, 02/01/2019 - 08:26

Dear MySQL users,

MySQL Connector/Python 8.0.15 is the latest GA release version of the
MySQL Connector Python 8.0 series. The X DevAPI enables application
developers to write code that combines the strengths of the relational
and document models using a modern, NoSQL-like syntax that does not
assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see
http://dev.mysql.com/doc/x-devapi-userguide/en/. For more information
about how the X DevAPI is implemented in MySQL Connector/Python, and its
usage, see http://dev.mysql.com/doc/dev/connector-python.

Please note that the X DevAPI requires at least MySQL Server version 8.0
or higher with the X Plugin enabled. For general documentation about how
to get started using MySQL as a document store, see
http://dev.mysql.com/doc/refman/8.0/en/document-store.html.

To download MySQL Connector/Python 8.0.15, see the “General Available
(GA) releases” tab at http://dev.mysql.com/downloads/connector/python/

Enjoy!

Changes in MySQL Connector/Python 8.0.15 (2019-02-01, General Availability) Bugs Fixed * The default value of the allow_local_infile option changed from True to False. (Bug #29260128)

Enjoy and thanks for the support!

On behalf of the MySQL Release Team,
Nawaz Nazeer Ahamed

Categories: Web Technologies

MySQL Connector/J 8.0.15 has been released

Planet MySQL - Fri, 02/01/2019 - 08:23

Dear MySQL users,

MySQL Connector/J Version 8.0.15 is the GA release of the 8.0
branch of MySQL Connector/J. It is suitable for use with MySQL Server
versions 8.0, 5.7, 5.6, and 5.5. It supports the Java Database
Connectivity (JDBC) 4.2 API, and implements the X DevAPI.

This release includes the following new features and changes, also
described in more detail on

https://dev.mysql.com/doc/relnotes/connector-j/8.0/en/news-8-0-15.html

As always, we recommend that you check the “CHANGES” file in the
download archive to be aware of changes in behavior that might affect
your application.

To download MySQL Connector/J 8.0.15 GA, see the “Generally Available
(GA) Releases” tab at http://dev.mysql.com/downloads/connector/j/

Enjoy!

Changes in MySQL Connector/J 8.0.15 (2019-02-01, General Availability)

Functionality Added or Changed

* Default value of the connection property
allowLoadLocalInfile has been changed to false.
Applications that use the LOAD DATA LOCAL INFILE
(http://dev.mysql.com/doc/refman/8.0/en/load-data.html)
statement on MySQL Server needs to set this property to
true explicitly. (Bug #29261254)

Enjoy and thanks for the support!

On Behalf of MySQL/ORACLE RE Team
Gipson Pulla

Categories: Web Technologies

MySQL Workbench 8.0.15 has been released

Planet MySQL - Fri, 02/01/2019 - 08:07

Dear MySQL users,

The MySQL developer tools team announces 8.0.15 as our general available (GA) for
MySQL Workbench 8.0.

For the full list of changes in this revision, visit
http://dev.mysql.com/doc/relnotes/workbench/en/changes-8-0.html

For discussion, join the MySQL Workbench Forums:
http://forums.mysql.com/index.php?152

The release is now available in source and binary form for a number of
platforms from our download pages at:

http://dev.mysql.com/downloads/tools/workbench/

Enjoy!

Categories: Web Technologies

Covering Indexes in MySQL, PostgreSQL, and MongoDB

Planet MySQL - Fri, 02/01/2019 - 08:04

A covering index is a fantastic query performance optimization. An index covers a query when the index has all the data needed to execute the query, so the server can retrieve the query’s data without reading any rows or documents. Covered queries are usually SELECT queries, but in addition to reads, indexes can cover portions of what a write query needs to do its work.

In this article I’ll explain what a covering index is in a bit more detail; the technical implementation and caveats in MySQL, PostgreSQL, and MongoDB; and how to check that a query is using a covering index.

 

 

What’s a Covering Index?

A covering index, or index-covered query, doesn’t refer just to an index. Instead, it’s the combination of a query and an index: the index covers the query. An index that covers one query might not cover another query, so “covering” doesn’t solely describe the index, it describes the index and query together.

To “cover” a query, an index must contain all of the data mentioned in the query. That is, the index has the data in the columns the query returns, as well as the columns the query uses for WHERE clauses, grouping, or any other part of the query.

Covering indexes make queries run faster! That’s because the server is accessing less data, and potentially in a more optimized way. This is because of how indexes work. The most common implementation of indexing is basically a sorted copy of the original data, with a quick-lookup data structure to navigate it, and pointers back to the original rows or documents. It’s a lot like the index in a physical book: there’s a keyword in sorted order, followed by page numbers where you can find the keyword.

Covering indexes optimize query speed because accessing rows or documents through an index is slow, just like finding page numbers in the book’s index and then flipping to the right page to find the related text. When the index covers the query, the server doesn’t have to go elsewhere to find more data. The index has everything that’s needed. And a lot of times it has it in the order that’s needed, too, which helps avoid random jumping around from place to place to find data.

How do Databases Support Covering Indexes?

Not all databases offer covering-index support, and those that do, usually have some caveats and small details to be aware of, lest the covering index be disabled or disallowed for helping optimize the query. Fortunately, there’s support for covering indexes in MySQL, PostgreSQL, and MongoDB. Here’s an overview of each of those.

MySQL

  • Supported since: early versions
  • Terminology: covering index, index-covered query
  • Caveats: works best with the most common storage engines, like InnoDB and MyISAM. Some storage engines like HEAP don’t support covering indexes. With InnoDB, sometimes data that’s been modified by a transaction will be ineligible for a covering index optimization.
  • Extras: with the InnoDB storage engine, the primary key columns are always invisibly included in secondary keys, and can be used for index-covered queries.
  • Documentation for more details: https://dev.mysql.com/doc/refman/8.0/en/explain-output.html#jointype_index

PostgreSQL

  • Supported since: 9.2, with more robust support in version 9.6 and newer
  • Terminology: index-only scan
  • Caveats: works best with B-Tree indexes, but sometimes works with other index types. GIN indexes don’t work. Some rows’ visibility might not be set in the visibility map if they’ve been modified recently, so access to the original rows might still be required. The planner doesn’t always know how to use index-only scans in all theoretically possible cases.
  • Extras: can work with expression indexes too, but the rules are complicated. Since version 11, indexes can INCLUDE extra payload columns that aren’t indexed, but are useful for allowing index-only scans.
  • Documentation for more details: https://www.postgresql.org/docs/current/indexes-index-only-scans.html

MongoDB

  • Supported since: very old versions, with improvements over time
  • Terminology: covered query
  • Caveats: Doesn’t work with array fields or geospatial indexes. Doesn’t work when querying sharded collections through mongos unless the index contains the shard key.
  • Extras: in version 3.6, covering can work with fields within embedded documents.
  • Documentation for more details: https://docs.mongodb.com/manual/core/query-optimization/#covered-query
How To Use EXPLAIN To Tell If A Query Uses A Covering Index

The best way to figure out whether a query benefits from a covered index optimization is to explain the query and examine its execution plan. The output of explaining a query is pretty complicated and different for each database, so I’ll discuss this only at a pretty high level here, with links to documentation.

  • MySQL puts a note in the Extra field of the EXPLAIN output. In older-style tabular EXPLAIN, it’s “Using index”. There are a few other notes that can go in Extra that begin with “Using index” but have different meaning. Covering indexes are notated by “Using index” without any further details. In newer-style JSON format, there’s a property named using_index which is true or false.
  • PostgreSQL indicates the access type prominently in the EXPLAIN output. It’ll appear something like “Index Only Scan using tbl1_pkey on tbl1”.
  • MongoDB is a bit trickier. In earlier versions of MongoDB, there’s an indexOnly true/false property in the JSON document that you get as a result of running a query with explain. In more recent versions, quoting the manual, “When an index covers a query, the explain result has an IXSCAN stage that is not a descendant of a FETCH stage, and in the executionStats, the totalDocsExamined is 0.”
Concluding Thoughts

Covering indexes are such a powerful optimization that if the query is a heavy hitter in general in your server, then creating a new index is often well worth the extra cost and disk space. You can use a workload profile to figure this out. For example, in this screenshot from the VividCortex profiler, you can see the first two SELECT queries are a huge proportion of the overall workload, making them potentially good candidates for optimizing with a covering index.

Using an index to cover a query can often speed it up by orders of magnitude. It's not always that dramatic an optimization, but I've personally seen those types of results many times. Of course your mileage may vary, etc.

Now you know what a covering index (or covered query) is, why it's faster than a query that's not covered by an index, and how to check whether a query is covered by an index. Next time you're looking at a query that's slower than you want, check whether an index could potentially cover it. Happy query optimization!

Photo by James Sutton on Unsplash

Categories: Web Technologies

How do you figure?

CSS-Tricks - Fri, 02/01/2019 - 07:32

Scott O'Hara digs into the <figure> and <figcaption> elements. Gotta love a good ol' HTML deep dive.

I use these on just about every blog post here on CSS-Tricks, and as I've suspected, I've basically been doing it wrong forever. My original thinking was that a figcaption was just as good as the alt attribute. I generally use it to describe the image.

<figure> <img src="starry-night.jpg" alt=""> <figcaption>The Starry Night, a famous painting by Vincent van Gogh</figcaption> </figure>

I intentionally left off the alt text, because the figcaption is saying what I would want to say in the alt text and I thought duplicating it would be annoying (to a screen reader user) and unnecessary. Scott says that's bad as the empty alt text makes the image entirely undiscoverable by some screen readers and the figure is describing nothing as a result.

The correct answer, I think, is to do more work:

<figure> <img src="starry-night.jpg" alt="An abstract painting with a weird squiggly tree thing in front of a swirling starry nighttime sky."> <figcaption>The Starry Night, a famous painting by Vincent van Gogh</figcaption> </figure>

It's a good goal, and I should do better about this. It's just laziness that gets in the way, and laziness that makes me wish there was a pattern that allowed me to write a description once that worked for both. Maybe something like Nino Ross Rodriguez just shared today where artificial intelligence can take some of the lift. But that's kinda not the point here. The point is that you can't write it once because <figcaption> and alt do different things.

Direct Link to ArticlePermalink

The post How do you figure? appeared first on CSS-Tricks.

Categories: Web Technologies

Using Artificial Intelligence to Generate Alt Text on Images

CSS-Tricks - Fri, 02/01/2019 - 07:30

Web developers and content editors alike often forget or ignore one of the most important parts of making a website accessible and SEO performant: image alt​ text. You know, that seemingly small image attribute that describes an image:

​​​<img src="/cute/sloth/image.jpg" alt="A brown baby sloth staring straight into the camera with a tongue sticking out." >

&#x1f4f7; Credit: Huffington Post

If you regularly publish content on the web, then you know it can be tedious trying to come up with descriptive text. Sure, 5-10 images is doable. But what if we are talking about hundreds or thousands of images? Do you have the resources for that?

Let’s look at some possibilities for automatically generating alt text for images with the use of computer vision and image recognition services from the likes Google, IBM, and Microsoft. They have the resources!

Reminder: What is alt text good for?

Often overlooked during web development and content entry, the alt​ attribute is a small bit of HTML code that describes an image that appears on a page. It’s so inconspicuous that it may not appear to have any impact on the average user, but it has very important uses indeed:

  • ​​Web Accessibility for Screen Readers: Imagine a page with lots of images and not a single one contains alt​ text. A user surfing in using a screen reader would only hear the word “image” blurted out and that’s not very helpful. Great, there’s an image, but what is it? Including alt​ enables screen readers to help the visually impaired “see” what’s there and have a better understanding of the content of the page. They say a picture is worth a thousand words — that’s a thousand words of context a user could be missing.
  • Display text if an image does not load: The World Wide Web seems infallible and, like New York City, that it never sleeps, but flaky and faulty connections are a real thing and, if that happens, well, images tend not to load properly and “break.” Alt text is a safeguard in that it displays on the page in place of where the “broken” image is, providing users with content as a fallback.
  • ​​SEO performance: Alt text on images contributes to SEO performance as well. Though it doesn’t exactly help a site or page skyrocket to the top of the search results, it is one factor to keep in mind for SEO performance.

Knowing how important these things are, hopefully you’ll be able to include proper alt​ text during development and content entry. But are your archives in good shape? Trying to come up with a detailed description for a large backlog of images can be a daunting task, especially if you’re working on tight deadlines or have to squeeze it in between other projects.

What if there was a way to apply alt​ text as an image is uploaded? And! What if there was a way to check the page for missing alt​ tags and automagically fill them in for us?

There are available solutions!

Computer vision (or image recognition) has actually been offered for quite some time now. Companies like Google, IBM and Microsoft have their own APIs publicly available so that developers can tap into those capabilities and use them to identify images as well as the content in them.

There are developers who have already utilized these services and created their own plugins to generate alt​ text. Take Sarah Drasner’s generator, for example, which demonstrates how Azure’s Computer Vision API can be used to create alt​ text for any image via upload or URL. Pretty awesome!

​​See the Pen
​​Dynamically Generated Alt Text with Azure's Computer Vision API
by Sarah Drasner (@sdras)
​​on CodePen.​​

There’s also Automatic Alternative Text by Jacob Peattie, which is a WordPress plugin that uses the same Computer Vision API. It’s basically an addition to the workflow that allows the user to upload an image and generated alt​ text automatically.

​​Tools like these generally help speed-up the process of content management, editing and maintenance. Even the effort of thinking of a descriptive text has been minimized and passed to the machine!

Getting Your Hands Dirty With AI

I have managed to have played around with a few AI services and am confident in saying that Microsoft Azure’s Computer Vision produces the best results. The services offered by Google and IBM certainly have their perks and can still identify images and proper results, but Microsoft’s is so good and so accurate that it’s not worth settling for something else, at least in my opinion.

Creating your own image recognition plugin is pretty straightforward. First, head down to Microsoft Azure Computer Vision. You’ll need to login or create an account in order to grab an API key for the plugin.

Once you’re on the dashboard, search and select Computer Vision and fill in the necessary details.

Starting out

Wait for the platform to finish spinning up an instance of your computer vision. The API keys for development will be available once it’s done.

​​Keys: Also known as the Subscription Key in the official documentation

Let the interesting and tricky parts begin! I will be using vanilla JavaScript for the sake of demonstration. For other languages, you can check out the documentation. Below is a straight-up copy and paste of the code and you can use to replace the placeholders.

​​var request = new XMLHttpRequest(); request.open('POST', 'https://[LOCATION]/vision/v1.0/describe?maxCandidates=1&language=en', true); request.setRequestHeader('Content-Type', 'application/json'); request.setRequestHeader('Ocp-Apim-Subscription-Key', '[SUBSCRIPTION_KEY]'); request.send(JSON.stringify({ "url": "[IMAGE_URL]" })); request.onload = function () { var resp = request.responseText; if (request.status >= 200 && request.status < 400) { // Success! console.log('Success!'); } else { // We reached our target server, but it returned an error console.error('Error!'); } console.log(JSON.parse(resp)); }; request.onerror = function (e) { console.log(e); };

Alright, let’s run through some key terminology of the AI service.

  • Location: This is the subscription location of the service that was selected prior to getting the subscription keys. If you can’t remember the location for some reason, you can go to the Overview screen and find it under Endpoint.
  • ​​

Overview > Endpoint : To get the location value
  • ​​Subscription Key: This is the key that unlocks the service for our plugin use and can be obtained under Keys. There’s two of them, but it doesn’t really matter which one is used.
  • ​​Image URL: This is the path for the image that’s getting the alt​ text. Take note that the images that are sent to the API must meet specific requirements:
    • File type must be JPEG, PNG, GIF, BMP
    • ​File size must be less than 4MB
    • ​​Dimensions should be greater than 50px by 50px
Easy peasy

​​Thanks to big companies opening their services and API to developers, it’s now relatively easy for anyone to utilize computer vision. As a simple demonstration, I uploaded the image below to Microsoft Azure’s Computer Vision API.

Possible alt​ text: a hand holding a cellphone

​​The service returned the following details:

​​{ "description": { "tags": [ "person", "holding", "cellphone", "phone", "hand", "screen", "looking", "camera", "small", "held", "someone", "man", "using", "orange", "display", "blue" ], "captions": [ { "text": "a hand holding a cellphone", "confidence": 0.9583763512737793 } ] }, "requestId": "31084ce4-94fe-4776-bb31-448d9b83c730", "metadata": { "width": 920, "height": 613, "format": "Jpeg" } }

​​From there, you could pick out the alt​ text that could be potentially used for an image. How you build upon this capability is your business:

  • ​​You could create a CMS plugin and add it to the content workflow, where the alt​ text is generated when an image is uploaded and saved in the CMS.
  • ​​You could write a JavaScript plugin that adds alt​ text on-the-fly, after an image has been loaded with notably missing alt​ text.
  • ​​You could author a browser extension that adds alt​ text to images on any website when it finds images with it missing.
  • ​​You could write code that scours your existing database or repo of content for any missing alt​ text and updates them or opens pull requests for suggested changes.

​​Take note that these services are not 100% accurate. They do sometimes return a low confidence rating and a description that is not at all aligned with the subject matter. But, these platforms are constantly learning and improving. After all, Rome wasn’t built in a day.

The post Using Artificial Intelligence to Generate Alt Text on Images appeared first on CSS-Tricks.

Categories: Web Technologies

MySQL Connector/NET 8.0.15 has been released

Planet MySQL - Fri, 02/01/2019 - 07:08

Dear MySQL users,

MySQL Connector/NET 8.0.15 is the third version to support
Entity Framework Core 2.1 and the fifth general availability release
of MySQL Connector/NET to add support for the new X DevAPI, which
enables application developers to write code that combines the
strengths of the relational and document models using a modern,
NoSQL-like syntax that does not assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see
http://dev.mysql.com/doc/x-devapi-userguide/en/index.html. For more information about how the X DevAPI is implemented in Connector/NET, see
http://dev.mysql.com/doc/dev/connector-net. NuGet packages provide functionality at a project level. To get the
full set of features available in Connector/NET such as availability
in the GAC, integration with Visual Studio’s Entity Framework Designer
and integration with MySQL for Visual Studio, installation through
the MySQL Installer or the stand-alone MSI is required.

Please note that the X DevAPI requires at least MySQL Server version
8.0 or higher with the X Plugin enabled. For general documentation
about how to get started using MySQL as a document store, see
http://dev.mysql.com/doc/refman/8.0/en/document-store.html.

To download MySQL Connector/NET 8.0.15, see
http://dev.mysql.com/downloads/connector/net/

Installation instructions can be found at
https://dev.mysql.com/doc/connector-net/en/connector-net-installation.html
Changes in MySQL Connector/NET 8.0.15 (2019-02-01)
Bugs Fixed

* The client library has been modified to initialize the
MySqlBulkLoader class with the local-infile capability
disabled by default (see Using the BulkLoader Class
(http://dev.mysql.com/doc/connector-net/en/connector-net-programming-bulk-loader.html)).
(Bug #29259767)

On Behalf of MySQL Release Engineering Team,
Surabhi Bhat

Categories: Web Technologies

IPv6 support in Group Replication

Planet MySQL - Fri, 02/01/2019 - 07:00

In 8.0.14, we add to Group Replication (GR) the ability to use IPv6 in all of its network-related configuration parameters. This means that now you can take advantage of this technology and “rock” those billion addresses using MySQL Group Replication.

What’s New

When you operate a Group Replication group, some variables use network addresses, mainly:

  • group_replication_local_address;
  • group_replication_ip_whitelist
  • group_replication_group_seeds;
  • group_replication_force_members.
Categories: Web Technologies

MySQL Connector/ODBC 8.0.15 has been released

Planet MySQL - Fri, 02/01/2019 - 06:14

Dear MySQL users,

MySQL Connector/ODBC 8.0.15 is a new version in the MySQL Connector/ODBC 8.0 series,
the ODBC driver for the MySQL Server.

The available downloads include both a Unicode driver and an ANSI driver based on the
same modern codebase. Please select the driver type you need based on the type of your
application – Unicode or ANSI. Server-side prepared statements are enabled by default.
It is suitable for use with any MySQL server version from 5.5.

This release of the MySQL ODBC driver is conforming to the ODBC 3.8 specification.
It contains implementations of key 3.8 features, including self-identification
as a ODBC 3.8 driver, streaming of output parameters (supported for binary types
only), and support of the SQL_ATTR_RESET_CONNECTION connection attribute (for the
Unicode driver only).

The release is now available in source and binary form for a number of platforms
from our download pages at

https://dev.mysql.com/downloads/connector/odbc/

For information on installing, please see the documentation at

https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation.html

Enjoy and thanks for the support!

==================================================

Changes in MySQL Connector/ODBC 8.0.15 (2019-02-01, General Availability)

This release contains no functional changes and is published
to align version number with the MySQL Server 8.0.15 release.

On Behalf of Oracle/MySQL Release Engineering Team,
-Sreedhar S

Categories: Web Technologies

Pages