mongodb – Query doesn’t return data that’s written recently

I have two micro services where one write to DB and another read from DB.

The first micro service is written in C++ while the other is written in NodeJS.

When querying for data say for a IP the MongoDB return older data or no data at all (In case if the client is new) but If I query like say after 5 min it returns the recent data.

I don’t think this has to do with concurrency at all because C++ is performant enough to write to DB faster

amazon web services – aws ecs describe-task-definition doesn’t return EFS file system specification

I tried with

aws ecs describe-task-definition --task-definition task1

but only get the volume names

"volumes": [{
     "name": "test1"
}], ... 

According to spec I should receive an efsVolumeConfiguration object inside each volume, too. Does anyone know why I can’t see the information or how I otherwise can retrieve it? Thanks in advance!

shaders – How to convert from frag position to UV coordinates when my viewport doesn’t cover the screen?

So, I’m implementing SSAO as part of my rendering pipeline using OpenGL/GLSL. It works pretty well when I have a camera that takes up the entire screen. However, when my camera is smaller than the full screen size, the SSAO texture doesn’t get sampled correctly. Here is the relevant GLSL shader code:

// Convert from clip-space
vec2 fragCoords = (fragPos.xy/ fragPos.w); // fragPos is MVP * worldPosition
vec2 screenCoords = fragCoords * 0.5 + 0.5; // Convert from (-1, 1) to (0, 1) to sample UV coordinates

// Sample texture
float ssaoFactor = texture2D(ssaoTexture, screenCoords).r;

I know that there is some funkiness going on with the viewport, but the fixes that I’ve tried haven’t worked. My first thought was to scale fragCoords by normalized size of my viewport (e.g. vec2(0.5, 0.5) for a viewport with half of the width and height of the screen), but that just produced a very strange result. Any thoughts?

html – SVG doesn´t show up

this is the HTML code:

    <title>HOME | index</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width-device-width, initial-scale=1.0">
    <!-- <link rel="stylesheet" type="text/css" href="style.css"> -->
    <div style="text-align:center;padding:150px 0;">
        <object type="image/svg+xml" data="/img/menu.svg">
            <!-- <embed src="/img/menu.svg"> -->

And this is the SVG:

<svg version="1.1" id="menu" xmlns="" xmlns:xlink="" x="0px" y="0px"
         viewBox="0 0 228.4 18.2" style="enable-background:new 0 0 228.4 18.2;" xml:space="preserve" width="500px" height="500px">
    <style type="text/css">
    <line id="XMLID_1_" class="st0" x1="5.8" y1="10" x2="221.8" y2="10"/>

Same result if I use embed src.
The SVG is just a stroke, and doesn’t show up with any browsers (firefox, chrome, edge). I am new with SVG images.

headphones – Lower half of Apple watch screen doesn’t respond to touches any more

I’ve had this Apple Watch 3 for almost three years. Earlier this year a hairline crack appeared diagonally across the glass and the bottom half of the screen no longer responds to my touches. Also, the display doesn’t light up when I look at the watch anymore like it used to. The top half work and I can control the watch for touches to the top half, but most buttons are on the bottom and I can’t dismiss screens. For example, I used to have a pair of wireless Anker earbuds but it broke and the Apple Watch keeps searching for it and won’t let me change to my new wireless earbuds. Any one know how to control the watch from the iphone for example, like changing settings and such?

I am going to get a new Apple Watch 6 in a few weeks but trying to make do with a beloved watch that I’ve had 3 years now.

Why doesn’t a simple Http request to display a remote web page violate the Same Origin Policy?

On a w3schools page, I found that HTTP requests work like this:

  • A client (a browser) sends an HTTP request to the web
  • A web server receives the request, and runs an application to process it
  • The server returns an HTTP response (output) to the browser
  • The client (the browser) receives the response.

On the same page I found that an XMLHttpRequest works like this:

  • A browser creates an XMLHttpRequest object and sends it to the server
  • The server processes the request, creates a response and sends data back to the browser
  • The browser processes the returned data using JavaScript and updates the page content.

The above two processes appear pretty much the same to me. However, the latter one violates the Same Origin Policy (SOP) if the server runs on a remote domain. This question on stackoverflow about the url in the open() method says that

As we can only send requests to our own web server, I assume that we don’t have to rewrite the website’s name in the URL.

Applying the same logic to the first case (Http requests) would mean that I couldn’t open a web page if it is not on my own computer. Luckily, this is not the case.

So, why doesn’t an Http request to display a remote web page violate the SOP? What is the key point/difference here?

I assume it’s about the fact that the second process (XMLHttpRequest) is initiated from a script, while the first one is triggered by the user. However, isn’t the Http request sent from a script when I click a hyperlink on a web page? And how can a web server distinguish between requests coming from a script and coming from a user?

functional programming – Doesn’t “Always test through the public interface” contradict testing of individual composed functions?

It’s not the size of the function. It’s how it’s used.

Let’s take some well tested functions, + - * and Math.sqrt(), and compose them into a distance function:

function getDistance(xA, yA, xB, yB) { 
    var xDiff = xA - xB; 
    var yDiff = yA - yB;

    return Math.sqrt(xDiff * xDiff + yDiff * yDiff);

kirupa – using the pythagorean theorem to measure distance

All these little functions have been tested. This code follows the well proven pythagorean theorem. So we’re good right?

Well, no. Because we happen to know that the inputs 59.3293371,13.4877472 to 59.3225525,13.4619422 are supposed to give us 1.6.

The problem wasn’t with the little functions, or how they were composed. It was how they got used. The pythagorean theorem works with cartesian coordinates in a two dimensional plane. Not with latitude and longitude on the curved surface of the earth. We can sometimes catch errors like this by testing against expected results. But those expected results can’t always be pushed down into the smaller functions.

Some might think of this as integration testing. I still think of it as unit testing. Because a unit isn’t a class, or a function. A unit is a testable, deterministic, side effect free, chunk of code. Syntax doesn’t decide what it’s boundaries are. Structure doesn’t decide what it’s boundaries are. Behavior does.

Here are some unit testing rules that might help make this clear.

A test is not a unit test if:

  • It talks to the database
  • It communicates across the network
  • It touches the file system
  • It can’t run at the same time as any of your other unit tests
  • You have to do special things to your environment (such as editing config files) to run it.

Michael Feathers – A Set of Unit Testing Rules

Notice nothing was said about functions, classes, packages, objects, or procedures. Your code structure is not the issue here. It’s about behavior.

So I think of a unit as any chunk of code that you can carve out to test, so long as it follows these rules.

Does this mean every function must have tests written against it? No. Every function should be tested against how it’s used. Private functions have a limited use so they can be tested by testing the public functions that use them. Make that use wide spread though and you’re going to need more testing.

Focus on use and behavior.

website – What the EMR Advantage patient portal lets patients see, and what it doesn’t let them see

I used to live in Ottawa. At the time, I visited an Appletree Medical Group doctor. The doctor then stored some information in my electronic medical record (“chart”).

This week, my dental-hygiene clinic asked me for some information from my chart.

Today, I logged into the Appletree patient portal, which is really just an instance of the Canadian Health Systems EMR Advantage patient portal. But I couldn’t find the information I was looking for.

Why not?

python – tight_layout() doesn’t work with changing tick labels

I am attempting to switch between a linear and logit scaling in my PyQt graph widget.

    from matplotlib import pyplot
    class GraphWidget(QWidget):
        rightClickEvent = QtCore.pyqtSignal()
        def __init__(self, parent=None):
            QWidget.__init__(self, parent=parent)
            self.parent = parent
            self.figure, self.axes = pyplot.subplots()
            pyplot.grid(b=True, which='major', color='#666666', linestyle='-')
   = QtGui.QMenu(self)
            self.rightClickEvent.connect(self.show_menu) # There is an edit button in the menu
        def edit(self): # Gets called when the "edit" button in the menu is triggered
            FigureOptions.figure_edit(self.axes, self)

When I switch, it goes from a normal notation to scientific notation (e.g. 1 – 10^3). When this changes the y-axis, the tick label will be cut off by the left edge of the application window. However, when I open and close the figure edit menu a second time, the layout changes to include the logit tick labels. This is because of where I’m calling tight_layout() or does the appear of the figure change only when plot() is called?

Is it harmful to add Conversion Linker tag in Tag Manager, even if website doesn’t need it?

I have a multi-site set-up, using one Tag Manager container to post data to each website’s respective Google Analytics account, based on the URL.

Some of the sites use Google Ads to run promotions etc, so I believe those sites require the addition of a ‘Conversion Linker’ tag to fire on all page views. However, I’m wondering whether that tag can be included by default without any harm, on sites that don’t currently run campaigns?

Would this be wise? If not, I can always load it conditionally depending on the site URL, but I’d rather not have to manage that if it’s ‘fine’ to just include the tag across the board, with no conditions.