Congressional Research Service Reports Now Officially Publicly Available

For many, many years we’ve been writing about the ridiculousness of the Congressional Research Service’s reports being kept secret. If you don’t know, CRS is a sort of in-house think tank for Congress, that does, careful, thoughtful, non-partisan research on a variety of topics (sometimes tasked by members of Congress, sometimes of its own volition). The reports are usually quite thorough and free of political nonsense. Since the reports are created by the federal government, they are technically in the public domain, but many in Congress (including many who work at CRS itself) have long resisted requests to make those works public. Instead, we were left with relying on members of Congress themselves to occasionally (and selectively) share reports with the public, rather than giving everyone access to the reports.

Every year or so, there were efforts made to make all of that research available to the public, and it kept getting rejected. Two years ago, two members of Congress agreed to share all of the reports they had access to with a private site put together by some activists and think tanks, creating EveryCRSReport.com, which was a useful step forward. At the very least, we’ve now had two years to show that, when these reports are made public, the world does not collapse (many people within CRS feared that making the reports public would lead to more political pressure).

Earlier this year, in the Consolidated Appropriations Act of 2018, there was a nice little line item to officially make CRS reports publicly available.

And, this week, it has come to pass. As announced by Librarian of Congress Carla Hayden, there is now an official site to find CRS reports at crsreports.congress.gov. It appears that the available catalog is still limited, but they’re hoping to expand backwards to add older reports to the system (a few quick test searches only shows fairly recent reports). But all new reports will be added to the database.

The result is a new public website for CRS reports based on the same search functionality that Congress uses – designed to be as user friendly as possible – that allows reports to be found by common keywords. We believe the site will be intuitive for the public to use and will also be easily updated with enhancements made to the congressional site in the future.

Moving forward, all new or updated reports will be added to the website as they are made available to Congress. The Library is also working to make available the back catalog of previously published reports as expeditiously as possible.

This is a big deal. The public pays over $100 million every year to have this research done, and all of it is in the public domain. Starting now, we can actually read most of it, and don’t need to rely on leaks to find this useful, credible research.

Permalink | Comments | Email This Story

via Techdirt
Congressional Research Service Reports Now Officially Publicly Available

Amazon Says It is Investigating Claims That Its Employees Are Taking Bribes To Sell Internal Data To Merchants To Help Them Increase Their Sales on the Website


Amazon.com is investigating internal leaks as it fights to root out fake reviews and other seller scams from its website, the company told WSJ. From the report:

Employees of Amazon, primarily with the aid of intermediaries, are offering internal data and other confidential information that can give an edge to independent merchants selling their products on the site, according to sellers who have been offered and purchased the data, brokers who provide it and people familiar with internal investigations. The practice, which violates company policy, is particularly pronounced in China, according to some of these people, because the number of sellers there is skyrocketing. As well, Amazon employees in China have relatively small salaries, which may embolden them to take risks. In exchange for payments ranging from roughly $80 to more than $2,000, brokers for Amazon employees in Shenzhen are offering internal sales metrics and reviewers’ email addresses, as well as a service to delete negative reviews and restore banned Amazon accounts, the people said.

Amazon is investigating a number of cases involving employees, including some in the U.S., suspected of accepting these bribes, according to people familiar with the matter. An internal probe began in May after Eric Broussard, Amazon’s vice president who oversees international marketplaces, was tipped off to the practice in China, according to people familiar with the matter. Amazon has since shuffled the roles of key executives in China to try to root out the bribery, one of these people said.


via Slashdot
Amazon Says It is Investigating Claims That Its Employees Are Taking Bribes To Sell Internal Data To Merchants To Help Them Increase Their Sales on the Website

SaaS at scale: Here’s how five cloud tech experts are building enterprise software empires


Susan Galbriath, senior manager of software development at Smartsheet, speaks at the 2018 GeekWire Cloud Tech Summit. (GeekWire Photo / Kevin Lisota)

Until very recently, very few people actually liked the enterprise software they were forced to use at work, from the technology managers grumbling about extortionist vendors to the end users grappling with user interfaces designed by engineers. That all started to change once the industry began to realize that software could be provided as a service.

As browsers and internet connections became more reliable, software-as-a-service emerged as the modern way to deliver enterprise applications, and the industry hasn’t looked back. Mobile apps accelerated this shift to an even greater degree, and now hundreds of dedicated apps for the different parts of running a business — from sales and marketing to operations and finance — are available for companies to adopt on a trial basis, rather than locking themselves into three-year contracts with indifferent vendors hawking huge, sprawling software suites that companies still had to manage themselves.

But the inherent bargain with this new world is that the SaaS provider is now the one responsible for all of the technical complexity associated with delivering these applications to the end user. And expectations for performance and uptime go up every year alongside demand for new features and potentially game-changing technologies like machine learning.

Doing this right is hard. That’s why we invited five experts who have worked inside the technology organizations behind some of the most widely used and liked enterprise software applications of the day to speak at our 2018 GeekWire Cloud Tech Summit this past June.

Learn what forward-thinking SaaS operations are doing to keep up with customer demand in the sessions below.

Milena Talavera, Senior Engineering Manager, Slack

Slack’s workplace collaboration software has been widely adopted among the tech set, but it has faced scaling issues as more and more users demand more and more of its product. Talavera explained how Slack developed Flannel, an edge caching system that helps the company deliver some of its main product features to end users without delay.

Mark Nelson, EVP of Product Development, Tableau

The “consumerization of IT” is another way to describe some of the changes that have taken place in the enterprise software market as SaaS has taken over. Nelson walked attendees through the history of this shift, and how engineering teams need to have a different mindset to deliver SaaS products compared to traditional IT products.

Susan Galbraith, Sr. Manager of Software Development, Smartsheet

Push notifications are both an absolute necessity and an easy way to drive your users crazy; it’s easy to run into problems getting the balance right. Galbraith showed attendees how Smartsheet built its notification system, and how it supported the back end of the system while using data to get the front end just right.

Bob Karaban, VP of Engineering, SkyKick

Given the scale at which modern SaaS apps can operate, automating as much of one’s technical infrastructure as possible is a smart idea. Karaban discussed how SkyKick has used automation to improve performance and reliability as user demands grow.

Catherine Renwick, VP Platform Engineering at Workday

Workday’s SaaS human resources products are used startups and big companies alike, and the most personal part of a company’s relationships with its employees demands a certain approach. Renwick revealed how Workday’s technical organization focuses on delivering its service as reliably as possible while absorbing feedback from customer behavior on what it needs to improve.


via GeekWire
SaaS at scale: Here’s how five cloud tech experts are building enterprise software empires

DIY NERF Bow

DIY NERF Bow

Link

Looking for a fun NERF toy that nobody else on the block has? The Q has you set, with this sweet bow setup that automatically loads the next foam projectile from its magazine. The DIY build requires PVC pipe, rubber bands, plywood, and some miscellaneous other hardware.

via The Awesomer
DIY NERF Bow

How to Set Up HTTPS on Your Site: A Simple Guide


As of July 2018, Google started marking your website as “not secure” for anyone visiting it using Google Chrome. If you don’t want to lose traffic, it’s a good idea to make sure SSL is set up on your site so people can visit it via HTTPS protocol.

Now is the time to set that up; here’s what you need to do.

Note: You may still see your site as “Not secure” after “successfully” installing an SSL certificate. See our troubleshooting tips at the end of this article for that.

Step 1: Grab Your SSL Certificate

According to the Google Developers blog, enabling HTTPS on your website doesn’t only protect the integrity of your data. HTTPS is also a requirement for many new browser features. Not only that, but it makes your visitors feel more secure whenever they visit your site. These are important reasons your site needs an SSL certificate.

Recently, if you open your website using a Chrome browser, you’ve probably seen that big, ugly “Not Secure” message in front of your URL.

website not secure

That’s not a pleasant thing to see when you’ve invested so much of your time and effort into developing a great website for your visitors.

Before you run out and look for an SSL certificate to buy, make sure you already know where you stand with your current web host.

SSL is fairly simple to set up, but you need to follow the right procedure for your situation. If your web host already offers a free SSL solution, then don’t waste money buying a certificate.

You might also consider reconsidering your choice of web hosts


The Best Web Hosting Services




The Best Web Hosting Services

Looking for the best web hosting service for your needs? Whether it’s for a small blog or a major corporate website, here are our best recommendations.
Read More

.

These are typically the SSL certificate options you have to choose from.

SSL services that offer free SSL certificates often also offer paid ones.

ssl certificate options

The difference is that most free certificates need to be manually renewed. You can do this via a cron job


How to Schedule Tasks in Linux with Cron and Crontab




How to Schedule Tasks in Linux with Cron and Crontab

The ability to automate tasks is one of those futuristic technologies that is already here. Every Linux user can benefit from scheduling system and user tasks, thanks to cron, an easy-to-use background service.
Read More

, but that’s beyond the scope of this article.

Some web hosts actually offer free management of those cron jobs if you use a service like Let’s Encrypt. SiteGround is one host that does this.

Whichever option you go with, when you order a certificate you’ll see a page like the one below. Both the certificate and the key are a part of the package.

ssl certificate text

Copy both blocks of encrypted text and save them to a safe place.

Step 2: Install Your SSL Certificate

Most guides that describe how to install an SSL certificate will tell you that you have to have a dedicated IP. This means purchasing a more expensive dedicated hosting plan


What Should You Be Looking for in a Web Host?




What Should You Be Looking for in a Web Host?

Whether you’re creating a new website, or migrating an old one, you need to make sure you’re getting the best deal possible from your chosen web host.
Read More

.

If you have such a plan, and you go into your account you’ll see that you have a dedicated IP associated with it.

website ip address

If you have a shared hosting plan, where multiple websites share the same server, then you don’t have a dedicated IP that goes with your URL.

Does that mean you can’t install an SSL certificate without a dedicated hosting plan? No. Thanks to a technology called Server Name Indicator (SNI), you can still install an SSL certificate for your site.

If you have a shared hosting plan, ask your web host whether they support SNI for SSL encryption.

To install your certificate, you’ll need to go into cPanel and click on SSL/TLS Manager.

ssl tls manager

You should see various options for managing SSL certificates.

To install your initial SSL certificate for HTTPS, choose the Install option.

cpanel install ssl

You’ll see the option to choose the domain you’d like to install the certificate onto. Choose the correct domain from the dropdown box.

Next, paste the long encrypted certificate text that you copied when you purchased the certificate.

website certificate text

Then, scroll down and also paste the encrypted text for the Private Key that you copied when you bought the certificate.

Once you save, make sure to go into WordPress and refresh all caching. Also clear your browser cache (press Ctrl + F5).

View your site again by typing the site URL with “https://” in front of it. If all is well, you’ll see the “Secure” status in front of your site URL.

secure https url

Congratulations! You now have a functioning SSL certificate, and your site can be accessed via HTTPS.

But, you’re not done. If people type in the old URL of your site into their browser, they’ll still see the unsecure version. You need to force all traffic through HTTPS.

How to Enforce HTTPS on Your Site

Your host may actually have a management area set up for you to handle required SSL changes.

For example, Siteground embeds Let’s Encrypt into cPanel. There, HTTPS Settings allow you to turn on HTTP Enforce and External Links Rewrite.

  • HTTPS Enforce redirects traffic (like people who only type in the site URL without “https” in front of it, to HTTPS.
  • External Links Rewrite modifies external links that start with “http” to “https” so a “Mixed Content” warning doesn’t show up in the browser for your site.

manage https settings

If you don’t have this automated feature with your web host, then you have to do it the manual way.

Browse to the .htaccess file in the root of your web server. Edit it to include the following lines of code.

RewriteCond %{HTTP_HOST} yoursitedomain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yoursitedomain.com/$1 [R,L]

Once you’ve saved this change, anyone who accesses your site via HTTP will be redirected to HTTPS.

Problem 1: CDN Images

You’d think at this point that you’re home free. Well think again.

In many cases, your site may come up, but many of the images will appear broken.

insecure website images

This can happen if you’re using a CDN service for your images. This is because all of your images are provided via the unsecured CDN links. Since your traffic is all redirected to use HTTPS, those images can’t load.

There are two methods of fixing this. The easiest is to modify your SSL certificate to use a wildcard. For example if you use Let’s Encrypt, you’ll see the option to use a wildcard in the SSL management page.

How to Set Up HTTPS on Your Site: A Simple Guide wildcard

A wildcard lets you use your SSL certificate on any subdomain of your site.

Enable this, and obtain the certificate, private key, and CA bundle encrypted texts from the SSL details.

Go into your CDN service. In the example below, I use MaxCDN. You should find an SSL option in the area where you can manage the Zone for your site.

cdn ssl menu

In here, you’ll see fields where you can paste the SSL Certificate and the Private Key.

Use the same encrypted text that you pasted into cPanel previously.

cdn ssl setup

Once you save this, the images should all load properly on your site.

If the SSL service you use doesn’t offer the wildcard option, you’ll actually need to purchase a second SSL certificate for your CDN image assets, and install it using the steps above.

Problem 2: Insecure Links

If you haven’t done anything else to your site except enabled your SSL Certificate and enforced HTTPS, you may still see the “Not Secure” error.

This will even show up when your site loads through HTTPS. The most common cause of this problem is that you still have a bunch of insecure links on your site. This is usually due to links in your sidebar, header, or footer.

Go into WordPress and look through all of your header and footer code, as well as your sidebar widgets. Look for links to services like Gravatar, Facebook, or others.

insecure images

Change those links to use “https” rather than “http”.

Once you’re finished, clear all caches and reload your site. All issues should be resolved at this point and your site is now fully secure!

Protecting Your Visitors With HTTPS Is Smart

Even though your motivation for doing this may be to boost your SEO, the reality is that you’re also protecting your visitors from any packet sniffing hackers.

This is especially valuable if you ask your visitors for information about themselves like names, addresses, phone numbers, or credit card info.

For a personal website, that’s important enough. But if you’re running a business, you should understand why website security is so important to your business success


5 Reasons Why Website Security Is Crucial for a Growing Business




5 Reasons Why Website Security Is Crucial for a Growing Business

Let’s look at how having strong security standards can help with your growing website’s promotional efforts.
Read More

.




via MakeUseOf.com
How to Set Up HTTPS on Your Site: A Simple Guide

The SIG P365 Meets All Four Criteria for Pocket Pistol Perfection


By George Oliveira

Pocket carry is a great alternative when belt-borne holsters aren’t an option. It can be very fast on the draw. Standing around with your hands casually in your pockets is and looks quite natural. Doing so allows you to have a full grip on your pocket pistol and the draw is lightening-quick since your hand is already on your gun.

Pocket carry is also a good choice when hugs and accidental bump-frisks might happen such as at family get-togethers. It’s a great option in non permissive environments since most people don’t expect someone to carry a gun in a pocket and it also makes a great carry method for a back-up gun.

To qualify for service in my pocket, a handgun has to meet four criteria:

  1. It must be 100% reliable with carry ammunition. No if, ands or buts. My reliability test is 500 rounds of FMJ ammunition plus 200 rounds of carry ammunition, all run flawlessly. Yes, ammunition, especially carry ammo, is expensive, but failure at the wrong time is much more costly.
  2. For me, 9mm is my choice. It’s a formidable caliber, especially with +P or +P+ ammunition, and offers high capacity. I understand that many shooters like even smaller calibers, but 9mm is my personal minimal caliber limit. Your mileage may vary.
  3. The firearm’s size must be compact enough to not only fit in the pocket, but small enough to allow it to be drawn from the pocket with a hand wrapped around its grip. The frame can’t be too thick otherwise it could be difficult navigating the pocket opening, and the grip shouldn’t extend beyond the hand as it most likely will snag while being drawn. A pistol with a grip shorter than the hand is wasting valuable ammo-estate. Fill the hand with ammunition!

  1. The shape of the rear end of the slide must be angled. A square-edge slide tends to get caught in the corner of the pocket during the draw stroke. That means that the gun shouldn’t get caught in the pocket during the draw even once. When it comes to life-saving tools and techniques, 99.9% success is failure in my book.

Once a pistol passes my four-point test, it comes down to how well it can be shot and its magazine capacity.

Notice that I didn’t include “accuracy.” A firearm can be inherently accurate, but demonstrate reduced practical accuracy. That is, it’s difficult to actually shoot it accurately.

Small revolvers are a good example. They’re very accurate guns, but their short sight radius, minimalistic sights and long, heavy trigger pull make it hard for shooters to attain the level of accuracy that they’re capable of achieving.

With all of that said and done, the last criteria is capacity. The more here, the better. After a gunfight, no one ever said that they wished they had less ammunition.

Smith & Wesson 642 Airweight

My pocket carry journey started with lightweight snubbies. Never really enjoying their recoil, I found that I didn’t practice as much as I should with them. It didn’t take too many cylinders worth of shooting for it to strain my wrist.

I tried carrying a heavier gun, a Ruger’s SP101. It’s a great gun and its steel frame greatly reduces recoil to a very comfortable level. I carried a light .38 in one pocket and the SP101 in the other. Surprisingly, I found the extra weight didn’t bother me. The SP101 reigned supreme for me as a pocket gun for several years.

That is, until Smith & Wesson introduced the M&P Shield. The Shield was about the same size as the SP101, lighter, has much better trigger, real sights and offered three extra rounds. What’s not to love? The Shield was my new pocket gun.

It was, until SIG SAUER introduced the P365. Its 12+1 capacity bests the Shield’s 8+1 and it’s even a bit smaller. Wow!

Capacity is where SIG’s new P320 really shines. It comes with two 10-round magazines, one flush and one extended, but, both leave the had unfulfilled. But their optional 12-round magazine fills the hand perfectly without extending beyond the hand’s grasp. Not only does the magazine offer higher capacity, it fits the hand better making it easier to shoot accurately.

What’s really amazing about the design of the P320 is that it manages to packs 12+1 rounds into a package that others only manage to get ten or less into.

I know that the P365 has had its growing pains, in particular, there are several reports of broken strikers. I changed out the factory MIM striker on my pistol with a steel version from Lightning Strike, and tested it extensively with both practice and carry ammo. All seems good, and the P365 is now officially my new pocket gun.

That is until…?

 


via The Truth About Guns
The SIG P365 Meets All Four Criteria for Pocket Pistol Perfection

We’ve Got a Sneak Peek at Anne Rice’s New Vampire Lestat Tale, Blood Communion


Blood Communion comes to life on the page.
Illustration: Mark Edward Geyer (Knopf)

Anne Rice has a much-anticipated Vampire Chronicles TV show in the works at Hulu, and now she’s got a new book in the series starring her most beloved character: Blood Communion: A Tale of Prince Lestat. It’s the first Rice novel to include illustrations—and we’ve got an exclusive excerpt and some image reveals to share.

First, here’s some words from the author herself, explaining a little bit more about her book and its accompanying drawings by artist Mark Edward Geyer:

This is a dream come true, to see a tale of Lestat, my beloved Brat Prince, illustrated, and so beautifully, and tastefully. Mark Edward Geyer’s work makes this a unique and special volume of the Vampire Chronicles. I’m confident the readers will share my enthusiasm when they hold the book in their hands. I am so happy with this publication.

Geyer also contributed illustrations to The Alphabettery, a companion guide for all of the author’s Vampire novels written by Rice scholar Becket, with an introduction by Rice. That comes out October 23, but you’ll be able to get your hands on Blood Communion much sooner, since it publishes October 2.

Actually, why wait that long for your first taste?

Check out the illustrations above and below, and then read on for a juicy sneak peek at Blood Communion’s third chapter.


Vampires, this-a-way?
Illustration: Mark Edward Geyer (Knopf)
In Blood Communion, this illustration faces the chapter three excerpt you can read below.
Illustration: Mark Edward Geyer (Knopf)
Full moon fever.
Illustration: Mark Edward Geyer (Knopf)

Chapter 3

I was in love with the being the moment I glimpsed the house and the great black iron picket fence surrounding it. Such high fences these days are often made of aluminum, and they just don’t look the same as iron. But this fence was indeed crafted from true iron and very high, with gilded pickets like the great fences and gates of Paris, and I loved that mark of care, including the heaviness of the arched gate as I opened it.

Down a relatively short drive lined with majestic oaks stood the house itself, with high front steps of marble and galleries upstairs and down running across its broad façade. Graceful two-story Corin­thian columns punctuated these galleries, giving the place a Graeco-Roman grandeur that suggested a temple.

I figured the place had been built in the flush years right before the Civil War when rich Americans threw up such immense houses in desperate competition with one another, using the native cypress wood and stucco to produce an edifice that appeared to be all of marble when it was not.

I caught the scent of the oil lamps before I marked their soft mellow light behind the heavily figured lace curtains, and I stood for a moment on the bottom step looking up at the fanlight above the broad front door. All the scents of Louisiana, so familiar, so enticing, descended on me: the raw fragrance of the magnolias blooming in abundance on the nearby trees, and the deep perfume of the roses in the garden patches along the galleries, and jasmine, night jasmine of such a sweetness that one could drift off into endless dreaming just breathing it in, and remembering long-ago nights, and life moving confidently at a slower pace.

Steps in the hall beyond, and then a figure in the doorway, impe­rially slim, as the poet says, and with hair like my own, long, so blond it was almost white, gathered back in the fashion Marius and I had popularized at Court. And a hand raised with the flash of a ruby ring beckoning for me to enter.

I hurried to accept the welcome while Thorne and Cyril drifted off to make an inspection of the property, as they so often did.

As soon as I clasped his hand, I liked this blood drinker. His eyes were not large, but they were radiantly blue and his smile animated his entire face.

“Come in, Prince, do come in,” he said in very precise English, sharpened by an accent I couldn’t place.

He was my height and indeed quite thin, wearing a narrow-waisted modern coat and an old-fashioned lace-trimmed shirt over flannel trousers, and wingtipped shoes polished to a mirror luster, with string ties.

He drew me into a broad central hallway, paved in black-and-white marble, and then into a great spacious double parlor, so com­mon in old plantation houses, which had become a library lined with books of all ages. A center table stood in the second parlor, and there we sat down to talk.

By then I’d glimpsed a dining room across the hallway, with a long oval table and English Chippendale chairs. That room too was lined with bookshelves.

Quaint glass oil lamps scattered here and there on the periphery of these rooms provided warm light. The highly polished heart-pine floors were lustrous. Those old floors had never meant to be bare, but rather an under flooring for carpets or parquet. But the poly­mer lacquer had rendered them hard and beautiful and they gave an amber glow to the room.

“Please call me Mitka,” he said, “and your bodyguards are most welcome to come in. My name is Dmitri Fontayne. I’m part Russian, part French. I was made a blood drinker in the time of Great Cath­erine in Russia.”

This delighted me. Vampires in the main don’t volunteer their age or their history this readily, and he seemed entirely trusting when he came so easily to the point.

His mind was entirely in accord with his words, and these words particularly fascinated me. I don’t think I’d ever encountered a blood drinker with quite this background. And there was a great deal I wanted to tell him about Louis suddenly, Louis who was immersed in the novels of Tolstoy, and had myriad questions about them which no one cared to answer, and how much Louis would love him right off.

But I came back to the moment.

“Mitka, my pleasure,” I said. “And you know who I am. Lestat will do, though it seems the world likes to address me as ‘the Prince.’ Don’t worry about Thorne or Cyril. They know I want to talk to you alone.”

“As you wish,” he said. “But they mustn’t go far. You have enemies.”

“If you’re speaking of Rhoshamandes, I know all about him and his latest activities. . . .”

“Ah, but there are others, Prince,” he said. “Please tell them to remain near at hand.”

I did as he wished, sending a silent message to the others, who were prowling around the stables now, having a good time with the horses, which were apparently splendid, and which they wanted to ride.

“Which enemy is this? You do know the band of mavericks in New Orleans has been annihilated?”

“Yes, I do,” he said. A shadow passed over his face, and he looked down for a moment as if he were murmuring a prayer for the dead, but I caught nothing, and then he surprised me by quickly making the Russian Sign of the Cross. Like the Greeks, the Russians touch the right shoulder before the left.

As he looked up, his face brightened beautifully and I felt a kind of elation that was all too common of late, simply being here with him in this ornate parlor surrounded by hundreds of enticing vol­umes, and feeling the night air through the long open windows to the south. Roses again, the scent of roses in Louisiana is perhaps stronger than anywhere else, and then there came on the breeze a great drift of green fragrances from the nearby swamp, all so redo­lent of life.

I had to get myself in hand. Fits of laughter, I’d always strug­gled with at odd moments, and fits of rage occasionally, but now it was spells of elation, as if the common comforts of the world were miracles.

A passage came to me suddenly from Tolstoy, something that Louis had read to me, something that Prince Andrei Bolkonsky was thinking as he lay close to death. Something about love, love making everything possible, and then Louis’s strange comment that Tolstoy’s first two great novels were studies of happiness.

“Ah yes,” said the blood drinker opposite me with irresistible enthusiasm. “ ‘Happy families are all alike,’ ” he said quoting the famous first line from Anna Karenina. Then he caught himself. “For­give me. I make it a matter of courtesy not to ransack the minds of those I’ve only just met. But I couldn’t help it.”

“No need to be concerned at all,” I said. I looked about the room. Too many topics of conversation pressed in on me and I tried to find some order. What had we been talking about? Enemies. I didn’t want to talk about enemies. I started to talk about all that I saw before me, the inevitable Philadelphia wing chairs flanking the marble fireplace, and a tall secretaire punctuating the bookshelves, a lovely piece with inlaid designs and mirrored doors above the flap of the desk.

He was at once brightly happy over this. And something mad occurred to me, that every single time I ever encountered another blood drinker in friendship, it was as if I were meeting and entering an entire world. Seems I’d read somewhere, or heard it in a film, that the Jews believe each life is a universe, and if you take a life, well, then you are destroying a universe. And I thought, Yes, this is true of us, this is why we must love one another, because we are each an entire world. And with blood drinkers there were centuries of stories to tell, millennia of experiences to be related and understood.

Yes, I know what you’re thinking as you read this. All this is obvi­ous. When people suddenly understand love they can sound like per­fect idiots, true.

“This enemy is a creature named Baudwin.” Mitka’s voice star­tled me. “An unsavory creature but a powerful creature, ancient, as ancient perhaps as Marius or Pandora, though I couldn’t myself tell. He was on the prowl in New York at the time that you came there, and made an enemy of Rhoshamandes, and were proclaimed the Prince. I haven’t seen him, however, in over a year.”

“It’s a pleasure to meet you,” I said. “I’ll meet this Baudwin when the time comes. Let’s not waste these moments on him, though I appreciate the warning.”

There was no need for us to discuss the obvious, that if this Baud­win was of the same age as Marius or Pandora, he would destroy me in a moment with the Fire Gift just as I’d destroyed the mavericks in New Orleans. It was sobering to realize that there might be any number of such creatures whom I hadn’t come to know yet, who knew of me. I liked to believe that I met all of the Children of the Millennia and had a fair idea of who hated me and who did not. But I’d never heard of Baudwin.

“I love your house and all you’ve achieved here,” I said, pushing the darker thoughts from my mind. It was enough to know that Cyril and Thorne were paying heed to every word we said.

“I’m so happy you approve,” he responded. “I wouldn’t call it a restoration, since I have used some modern materials and made some distinctly modern choices, but I’ve done my best to use only superior materials throughout.” He too seemed to forget the darker thoughts and his face was fired with enthusiasm now, and as so often happens, the human warmth and the human lines came back to it, and I could see what sort of man he might have been. Likely thirty years of age, no more than that, and I noted how very delicate were his hands with which he gestured easily, and all of the rings he wore—even his ruby ring—were made with pearls.

“It’s taken me years to acquire the furnishings,” he said. “I remember in the beginning when I first came here in the 1930s, it seemed easier to find the very high-quality survivals from the eigh­teenth century—paintings, chairs, that sort of thing.”

He talked on easily of the bones of the house being excellent, and the old plaster falling away to leave bare-brick chain walls. Chain walls are walls that went all the way down to the ground rather than a foundation, and I had not heard that term in many years.

“The house was a total ruin when I first happened upon it. You understand I had no idea you were in New Orleans in those times. I knew there were blood drinkers about, but I knew nothing of them until many decades later when I read all of your stories, and I was riding on the old road to Napoleonville when I saw the house on the night of a bright moon, and I swore it spoke to me. It beckoned me to brave the wreckage and come inside, and once I did I knew I must bring it all back to its former glory, so that some night when I finally left it, it would be infinitely better than I’d found it, and I’d left my stamp upon it with pride.”


Excerpt from Blood Communion: A Tale of Prince Lestat (Vampire Chronicles) by Anne Rice, reprinted by permission. Copyright Knopf.


via Gizmodo
We’ve Got a Sneak Peek at Anne Rice’s New Vampire Lestat Tale, Blood Communion

Comic for September 09, 2018


Transcript

Jerry: Omg! You are soooo wrong! I literally cannot believe you are this gullible. Hahahahaha! Hahahaha! I can’t wait to tweet about your stupidity. Your dumbness will live forever on the internet!
Dilbert: You probably haven’t seen the new data that proves I’m right. Will you apologize like a decent human being or will you move the goalposts claim victory. And trash my name like a demented weasel?
Jerry: Can you tell me more about the weasel option?


via Dilbert Daily Strip
Comic for September 09, 2018

Manipulating queries with non-conforming data via MySQL Query Rewrite Plugin, triggers and stored procedures

The MySQL database is used in thousands of third-party applications, but what can you do when you want to use MySQL with an application, but that application’s queries or data doesn’t match MySQL’s data type or SQL format?

This post will show you three ways to alter a query or mismatched data when you don’t have control of the application’s source code. Of course, there are hundreds of different ways to do what I am about to show you. In this example, I will show you how to use the MySQL Query Rewrite Plugin along with a trigger to alter the non-conforming data. I will also show you an example of manipulating data with a stored procedure.

A customer emailed me with a problem. They wanted to use MySQL for a third-party application, but they didn’t have access to the source code. Their main problem was the application’s TIMESTAMP format didn’t conform to MySQL’s TIMESTAMP format. To be specific, this application produced a TIMESTAMP value that included a trailing time zone, such as “2018-09-05 17:00:00 EDT”. MySQL has two column data types where you can store both the date and time in one column: TIMESTAMP and DATETIME – but MySQL cannot handle TIMESTAMP or DATETIME data with a trailing time zone.

When a TIMESTAMP value is being inserted into a row, MySQL converts the TIMESTAMP value from the current time zone set by the MySQL server (see Time Zone Support) to UTC (Coordinated Universal Time) for storage, and converts the data back from UTC to the current time zone (of the server) when retrieved. (This conversion does not occur for other types such as DATETIME.) By default, the current time zone for each connection is the server’s local time. The time zone can be set on a per-connection basis, and as long as the time zone setting remains constant, you will get back the same value you stored. If you store a TIMESTAMP value, and then change the time zone and retrieve the value, the retrieved value is different from the value you stored. This occurs because the same time zone was not used for conversion in both directions. The current time zone is available as the value of the time_zone system variable. For more information, see Section 5.1.12, “MySQL Server Time Zone Support”.

(From: https://dev.mysql.com/doc/refman/8.0/en/datetime.html)

The customer told me that this application would only be sending data with two different trailing time zones – Central and Eastern. With daylight-savings in use in both of these time zones, this would give us four possible trailing time zone values – CDT, CST, EDT and EST. What we want to do is to intercept the query, and write this TIMESTAMP data to a different column, and then convert the value to UTC time to be stored in the correct column in the database. Because we don’t have access to the source code, I am assuming we have full access to the MySQL database.


NOTE: Since we are using time zone information, if you want to duplicate this post, be sure to load the MySQL time zone information. See: https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html

 

The MySQL Rewrite Plugin

In MySQL version 5.7, a plugin named the “Query Rewrite Plugin” was introduced. This plugin can examine SQL statements received by the server and modify those statements before the server executes them. In other words, this gives you the ability to intercept “bad” queries and re-format them to be “good” queries for use with MySQL – or to rewrite the queries to do whatever you need. Think of it as a way to change the source code without actually having the source code.

Installing the plugin is fairly easy. In MySQL version 8.0, you install (or uninstall) the plugin via an SQL script provided with your MySQL installation. The script is named install_rewriter.sql and is located in the “share” directory under your MySQL home directory.

# cd /usr/local/mysql/share  (your directory may be different)
# mysql -u root -p < install_rewriter.sql
Enter password: (enter root password here)

The script only takes a few seconds to load (The uninstall script is named uninstall_rewriter.sql). To check and make sure the plugin was installed, run this command from within MySQL:

mysql> SHOW GLOBAL VARIABLES LIKE 'rewriter_enabled';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| rewriter_enabled | ON    |
+------------------+-------+
1 row in set (0.00 sec)

The plugin was installed correctly if the column named “Value” is set to “ON“.

For this example, I am going to create a small table with three columns, and assume that this is an table from a third-party application. The date_time_value column is where the application would normally store the timestamp information.

mysql> create database test;
 Query OK, 1 row affected (0.01 sec)
mysql> use test;
 Database changed
mysql> CREATE TABLE `time_example` (
  `idtime` int(11) NOT NULL AUTO_INCREMENT,
  `action_record` varchar(30) NOT NULL,
  `date_time_value` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`idtime`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=UTF8MB4;
Query OK, 0 rows affected (0.03 sec)

The date_time_value column will obviously not be able to store timestamp data with a trailing time zone, but let’s see what happens when we try and insert a row of data – and let’s pretend that this is the query the application uses.

mysql> insert into test.time_example (action_record, date_time_value) 
 values ('Arrived at work', '2018-09-05 17:00:00 EDT');
Error Code: 1292. Incorrect datetime value: '2018-09-05 17:00:00 EDT' 
 for column 'date_time_value' at row 1

Of course, we get an error because the format for the timestamp is incorrect.

What we want to do is to alter the table and add a column to store this improperly-formatted timestamp data.

mysql> ALTER TABLE `test`.`time_example` 
    -> ADD COLUMN `date_time_storage` VARCHAR(23) NULL AFTER `date_time_value`;
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

Now that we have a column (date_time_storage) to store the “bad” timestamp data, we need to modify the incoming query so that it writes the timestamp data into the new column.


Note: In MySQL 8.0+, with the Query Rewrite Plugin, you can modify SELECT, INSERT, REPLACE, UPDATE, and DELETE statements. (Prior to MySQL 8.0.12 you could only modify SELECT statements)

 

This is the query the application is sending to the database:

insert into test.time_example (action_record, date_time_value) values (?, ?);

We want to modify the query to use the new date_time_storage column, instead of the date_time_value column. The new query would look like this:

insert into test.time_example (action_record, date_time_storage) values (?, ?);

Now that we have our old (bad) and new (good) queries, we can insert this into the rewrite_rules table of the query_rewrite database.

INSERT INTO query_rewrite.rewrite_rules
    (pattern, replacement, pattern_database) VALUES(
    'insert into test.time_example (action_record, date_time_value) values (?, ?)',
    'insert into test.time_example (action_record, date_time_storage) values (?, ?)',
    'time_example'
    );
1 row(s) affected, 1 warning(s): 1105 Query 'insert into test.time_example 
 (action_record, date_time_value) values ('Left building', '2018-09-05 17:00:00 EDT')' 
 rewritten to 'insert into test.time_example (action_record, date_time_storage) 
 values ('Left building', '2018-09-05 17:00:00 EDT')' by a query rewrite plugin

(More examples may be found on this page: Query Rewrite Plugin Usage)

We need to execute a stored procedure named flush_rewrite_rules to make this query-rewrite change permanent: (See: https://dev.mysql.com/doc/refman/8.0/en/rewriter-query-rewrite-plugin-usage.html)

mysql> CALL query_rewrite.flush_rewrite_rules();
Query OK, 1 row affected (0.00 sec)

We can confirm the INSERT INTO query_rewrite.rewrite_rules by looking at the rewrite_rules table:

mysql> SELECT * FROM query_rewrite.rewrite_rules\G
*************************** 1. row ***************************
                id: 1
           pattern: insert into test.time_example (action_record, date_time_value) values (?, ?)
  pattern_database: time_example
       replacement: insert into test.time_example (action_record, date_time_storage) values (?, ?)
           enabled: YES
           message: NULL
    pattern_digest: e823e987338aeae6d47f7a729e78f532d3ff3721237c15981bcd11fc2607efda
normalized_pattern: insert into `test`.`time_example` (`action_record`,`date_time_value`) values (?,?)
1 row in set (0.00 sec)

Next, let’s run the same query as before, and see if it puts the timestamp data that is supposed to go into the date_time_value column into the new date_time_storage column:

mysql> insert into test.time_example (action_record, date_time_value) 
 values ('Arrived at work', '2018-09-05 17:00:00 EDT');
Query OK, 1 row affected, 1 warning (0.01 sec)

And now the table contains this data:

mysql> select * from time_example;
+--------+-----------------+-----------------+-------------------------+
| idtime | action_record   | date_time_value | date_time_storage       |
+--------+-----------------+-----------------+-------------------------+
|      1 | Arrived at work | NULL            | 2018-09-05 17:00:00 EDT |
+--------+-----------------+-----------------+-------------------------+
1 rows in set (0.00 sec)

We now have the timestamp with the time zone data stored in the MySQL database, but we need to convert this to a proper format, and put the result into the date_time_value column.

To do this, we can use a trigger.

Normally, you would want your application to produce data in the correct format, but in this example, we don’t have access to the source code. So, we can create a trigger to convert the “incorrectly-formatted” data in date_time_storage to the correct data and store it in date_time_value.


NOTE: These examples won’t work if your TIMESTAMP uses microseconds (6-digits) precision (example: ‘1970-01-01 00:00:01.000000’) – but you can modify the code to accommodate microseconds.

 

Here is the SQL to create the trigger:

DELIMITER $$
  
CREATE TRIGGER _time_zone_convert_insert2
AFTER INSERT ON time_example
FOR EACH ROW
BEGIN

DECLARE _date_time_no_tz varchar(20);

SET _date_time_no_tz = SUBSTRING(NEW.date_time_storage, 1, 20);

IF NEW.date_time_storage like '%EDT' THEN
    SET NEW.date_time_value = CONVERT_TZ(_date_time_no_tz,'EST5EDT','GMT');
END IF;

IF NEW.date_time_storage like '%EST' THEN
    SET NEW.date_time_value = CONVERT_TZ(_date_time_no_tz,'EST5EDT','GMT');
END IF;

IF NEW.date_time_storage like '%CDT' THEN
    SET NEW.date_time_value = CONVERT_TZ(_date_time_no_tz,'EST5EDT','GMT');
END IF;

IF NEW.date_time_storage like '%CST' THEN
    SET NEW.date_time_value = CONVERT_TZ(_date_time_no_tz,'EST5EDT','GMT');
END IF;

END$$

DELIMITER ;

Now that we have a trigger in place, let’s insert another line into the database – BUT, we still want to use the SQL from the application. The query will try and write to the date_time_value column, but the Query Rewrite Plugin will intercept the original query and substitute our new query instead – which will insert the timestamp data into the date_time_storage column, and then the trigger will convert the timestamp and place the correct value into the date_time_value column.

mysql> INSERT INTO time_example (action_record, date_time_value) 
 VALUES ('Lunch Break', '2018-09-05 18:00:00 EDT');
Query OK, 1 row affected (0.00 sec)

The table now contains a true timestamp column with the correct timestamp value in UTC. (The old row didn’t change)

mysql> SELECT * FROM test.time_example;
+--------+------------+---------------------+-------------------------+
| idtime | product_id | date_time_value     | date_time_storage       |
+--------+------------+---------------------+-------------------------+
|      1 | time now1  | NULL                | 2018-09-05 18:00:00 EDT |
|      2 | time now2  | 2018-09-05 22:00:00 | 2018-09-05 18:00:00 EDT |
+--------+------------+---------------------+-------------------------+
2 rows in set (0.00 sec)

But what about stored procedures?

The easiest way to handle the time zone conversion is with a trigger. But, to show you how stored procedures can do the same thing, I have an example of a stored procedure. In this example, I will be passing the values of the idtime and date_time_storage columns.

This example will be similar to the one above – I created a table named time_example, but this time, I am including the extra column:

'CREATE TABLE `time_example` (
  `idtime` int(11) NOT NULL AUTO_INCREMENT,
  `action_record` varchar(30) NOT NULL,
  `date_time_value` timestamp NULL DEFAULT NULL,
  `date_time_storage` varchar(23) DEFAULT NULL,
  PRIMARY KEY (`idtime`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8'

I then inserted a row, where I am storing the time stamp with the time zone information:

mysql> insert into test.time_example (action_record, date_time_storage) 
 values ('Left work', '2018-09-05 17:00:00 EDT’);
Query OK, 1 row affected (0.00 sec)

Here is what the row looks like:

mysql> SELECT * FROM test.time_example;
+--------+------------+-----------------+-------------------------+
| idtime | product_id | date_time_value | date_time_storage       |
+--------+------------+-----------------+-------------------------+
|      1 | Left work  | NULL            | 2018-09-05 17:00:00 EDT |
+--------+------------+-----------------+-------------------------+
1 row in set (0.00 sec)

Again, the date_time_storage column is a temporary storage column. I will call the stored procedure, and provide the idtime and date_time_storage values. The stored procedure which will look at the last three characters in the date_time_storage column, and then convert the time to UTC, which is then stored in the date_time_value column.

call _check_time_zone('1','2018-09-05 17:00:00 EDT');

Now the row looks like this, where the date_time_value column is now stored as UTC:

mysql> SELECT * FROM test.time_example;
+--------+------------+---------------------+-------------------------+
| idtime | product_id | date_time_value     | date_time_storage       |
+--------+------------+---------------------+-------------------------+
|      1 | Left work  | 2018-09-05 21:00:00 | 2018-09-05 17:00:00 EDT |
+--------+------------+---------------------+-------------------------+
1 row in set (0.00 sec)

And here is the code to create the stored procedure:

DELIMITER $$
CREATE DEFINER=`root`@`localhost` 
PROCEDURE `_check_time_zone`(IN _id_time INT, IN _date_time_storage VARCHAR(23))
BEGIN

DECLARE _date_time_no_tz varchar(20);

SET _date_time_no_tz = SUBSTRING(_date_time_storage, 1, 20);

IF _date_time_storage like '%EDT' THEN 
UPDATE time_example SET date_time_value = CONVERT_TZ(_date_time_no_tz,'EST5EDT','GMT')
WHERE idtime = _id_time;
END IF;

IF _date_time_storage like '%EST' THEN 
UPDATE time_example SET date_time_value = CONVERT_TZ(_date_time_no_tz,'EST5EDT','GMT')
WHERE idtime = _id_time;
END IF;

IF _date_time_storage like '%CDT' THEN 
UPDATE time_example SET date_time_value = CONVERT_TZ(_date_time_no_tz,'CST5CDT','GMT')
WHERE idtime = _id_time;
END IF;

IF _date_time_storage like '%CST' THEN 
UPDATE time_example SET date_time_value = CONVERT_TZ(_date_time_no_tz,'CST5CDT','GMT')
WHERE idtime = _id_time;
END IF;

IF _date_time_storage like '%UTC' THEN 
UPDATE time_example SET date_time_value = _date_time_no_tz
WHERE idtime = _id_time;
END IF;

END $$
DELIMITER ;

 


Tony Darnell is a Principal Sales Consultant for MySQL, a division of Oracle, Inc. MySQL is the world’s most popular open-source database program. Tony may be reached at info [at] ScriptingMySQL.com and on LinkedIn.
Tony is the author of Twenty Forty-Four: The League of Patriots 
Visit http://2044thebook.com for more information.
Tony is the editor/illustrator for NASA Graphics Standards Manual Remastered Edition 
Visit https://amzn.to/2oPFLI0 for more information.

via Planet MySQL
Manipulating queries with non-conforming data via MySQL Query Rewrite Plugin, triggers and stored procedures