Unit Testing – Bad Practice – If a SUT in test mode uses a different execution path?

I recently encountered code in a public repo that I thought was just wrong. The first thing I noticed was

/**
 * Sets a test mode status.
 *
 * @param boolean $mode Mode to set
 */
public function testMode(bool $mode = true)
{
    $this->testMode = $mode;
    return $this;
}

Then another method used the testMode Property like this (mostly pseudocode for the protection of the innocent).

public someDatabaseFunc($arg1)
{
    $sql = somefunction_that_returns_a_query_statement($arg);

    if ($this->testMode)
    {
        return $sql;
    }

   // code that really does database stuff
   //...
}

Does not this sort of thing make unit testing senseless?
What's worse, the test code or the code being tested?

vga – Configures the custom resolution mode

I use Hackintosh. I want my exhibited items to be the size I want. I've found that I like the existing resolutions of my 27-inch 1280 x 720 display parameter
But of course it is too blurry for the 1920×1080 27 & # 39; s display. MacOs only supports "HiDpi Scaling": I need to create a resolution of 2560 x 1440 (twice the size needed). MacOS then renders everything in this HQ resolution and resizes it the way I want it. But I can not find any parameters for the resolution 2560×1440. As far as I know, there are automatic calculation methods, like CVT, CVT-RB, but I do not know which one to choose. I think the vertical sampling rate should be 60 Hz …
(via HDMI the monitor uses 67KHZx60HZ for 1920×1080)
helper
Although it is related to this topic: For unknown reasons, "HiDPI 1280×720" is listed as supported in VGA mode only. However, in HDMI mode, the maximum listed is 960 x 540 HiDPI (this is the "maximum supported by the monitor 1920 x 1080, as you can see"). Is the availability of 2560×1440 via HDMI connected to the above "porch" and other parameters?
Enter image description here


PS: On Windows, I just use 1920×1080 and either 150% or 175% scale.) And it works just fine (but not here under these circumstances) under the Monitor / GPU modes listed:
Enter image description here


UPD: So when I use:
Enter image description here
The screen has a disproportionate black border. On the left, the screen is wider than on the right and not scaled correctly.
Enter image description here
And when I use
Enter image description here
then it does not work at all (monitor skips vga) …

bitcoind – How to import addresses into a wallet that runs in clipped mode

I'm using the Bitcoin Cash node prune=99000 Mode activated. Therefore, I tried to import BCH addresses from another BCH wallet using the importprivkey method, and an error message appears: Rescan is disabled in pruned mode,

How can I import addresses from another wallet in cleanse mode?

Thank you so much!

Flash – Why do not any red lights flash in slave mode on one of my Yongnuo flashes?

I recently bought two Yongnuo 568 EX II and they work great! I have only one problem with either: If I put the flash in one of the slave modes (Sc, Sn, S1 or S2), the red lights will not flash like my other flash. However, the flash works perfectly as a slave, it just flashes no red lights on it. If it makes a difference, I use it with a Canon 600D.

Is lack of light a symptom of a problem that I am unaware of, and can I do something about it?

mongodb – Error: read host {mode: "primary", could not find tags: [ {} ] } for set cluster0-shard-0:

any ideas on how to solve this problem:
I am trying to connect to the class atlas cluster. In the cmd shell, run the following command: mongo "mongodb: //cluster0-shard-00-00-jxeqq.mongodb.net: 27017, cluster0-shard-00-01-jxeqq.mongodb.net: 27017, cluster0-shard -00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0 "–authenticationDatabase admin –ssl –username m001-student –password m001-mongodb-basics
then I get this error:

C: Users nzedginidze> mongo "mongodb: //cluster0-shard-00-00-jxeqq.mongodb.net: 27017, cluster0-shard-00-01-jxeqq.mongodb.net: 27017, cluster0-shard-00 -02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0 "–authenticationDatabase admin –ssl –username m001-student –password m001-mongodb-basics
2019-10-15T11: 02: 01.915 + 0400 W CONTROL (Main) Option: SSL is outdated. Please use tls instead.
MongoDB shell version v4.2.0
Connect to: mongodb: //cluster0-shard-00-00-jxeqq.mongodb.net: 27017, cluster0-shard-00-01-jxeqq.mongodb.net: 27017, cluster0-shard-00-02-jxeqq .mongodb .net: 27017 / test? authSource = admin & compressors = disabled & gssapiServiceName = mongodb & replicaSet = Cluster0-shard-0
2019-10-15T11: 02: 02.095 + 0400 I NETWORK (js) Starting the new Replica Set Monitor for Cluster0-shard-0 / cluster0-shard-00-00-jxeqq.mongodb.net: 27017, cluster0-shard-00-01 -jxeqq.mongodb.net:27017, cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 02.095 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 02.096 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connect to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 02.096 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 03.271 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 03.605 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 04.402 + 0400 I NETWORK (js) Successfully connected to cluster0-shard-00-00-jxeqq.mongodb.net:27017 (1 connections are now open to cluster0-shard-00-00-jxeqq mongodb.net:27017 with a timeout of 0 seconds)
2019-10-15T11: 02: 04.612 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 04.876 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 06.043 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 06.095 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connect to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 07.103 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 07.376 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connect to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 08.543 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 08.876 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 10.043 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the Cluster0-Shard-0 set could not be reached
2019-10-15T11: 02: 10.095 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connect to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 11.103 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary address for the Cluster0-shard-0 group could not be reached
2019-10-15T11: 02: 11.376 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 12.543 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 12.876 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connect to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 14.044 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the Cluster0-Shard-0 set could not be reached
2019-10-15T11: 02: 14.095 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connect to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 15.102 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 15.376 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 16.543 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 16.876 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 18.044 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the Cluster0-Shard-0 set could not be reached
2019-10-15T11: 02: 18.095 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 19.101 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the set Cluster0-Shard-0 could not be reached
2019-10-15T11: 02: 19.379 + 0400 I CONNPOOL (ReplicaSetMonitor TaskExecutor) Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T11: 02: 20.546 + 0400 W NETWORK (ReplicaSetMonitor TaskExecutor) The primary value for the Cluster0-Shard-0 set could not be reached

*** It looks like this is a MongoDB Atlas cluster. Make sure your IP whitelist allows connections from your network.

2019-10-15T11: 02: 20.547 + 0400 E QUERY (js) Error: Read host {mode: "primary", Tags: ({})} for group Cluster0-shard-0 could not be found:
connect@src/mongo/shell/mongo.js: 341: 17
@ (Connect): 2: 6
2019-10-15T11: 02: 20.551 + 0400 F – (Main) Exception: Connection failed
2019-10-15T11: 02: 20.551 + 0400 E – (main) exit with code 1

To enable debug mode through the ADB shell or ADB through the terminal on Linux

So far I have put my Android device in FTP mode
I tried it adb sideload
Now I try it busybox ash

I can run ls
but everything else says that the permission is denied or there is a mistake: closed.

/ $ ls
acct
cache
charger
config
d
data
default.prop
dev
etc
file_contexts
firmware
fstab.qcom
icon_ftm.png
init
init.class_main.sh
init.environ.rc
init.ftm.rc
init.mdm.sh
init.offcharge.rc
init.qcom.bms.sh
init.qcom.class_core.sh
init.qcom.early_boot.sh
init.qcom.factory.rc
init.qcom.ftm.rc
init.qcom.rc
init.qcom.sh
init.qcom.syspart_fixup.sh
init.qcom.usb.rc
init.qcom.usb.sh
init.rc
init.target.ftm.rc
init.target.rc
init.trace.rc
init.usb.rc
init.vendor.rc
init.zygote32.rc
mnt
persist
proc
property_contexts
res
root
sbin
sdcard
seapp_contexts
selinux_version
sepolicy
service_contexts
storage
sys
system
tombstones
ueventd.qcom.rc
ueventd.rc
vendor
verity_key

Report trident tokens or other user credentials in Google Analytics compatibility mode

I've noticed that the number of users who use Internet Explorer 9 in Google Analytics is high under browser and operating system (2%). When reviewing the user agent, it becomes apparent that an increased number of them are running Internet Explorer 11 in compatibility mode. It would appear that Google Analytics would be the following user as IE9. However, the trident value 7 indicates that Internet Explorer 11 is being used. What is my browser example?

DeviceType
Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+10.0;+Win64;+x64;+Trident/7.0;+Touch)

I've seen older threads that said it's not possible to report a browser with the trident token or when the user is in compatibility mode.

Is that still the case? Are there other tools in Google Analytics that could give an accurate representation of IE 9 usage?

software – How can I find out which camera mode I used for a digital photo?

You can use an Exif reader (like exiftool) to find out this information. For example, I check a picture of myself and I can see


Shutter speed: 1/250

F number: 8.0

Exposure program: Program AE

ISO: 200


The program automation has aperture priority. A quick Google search (for Exposure Program Exif) provides the following values ​​(taken from this link):

  • 0 = not defined
  • 1 = manual
  • 2 = normal program
  • 3 = aperture priority
  • 4 = shutter priority
  • 5 = creative program (biased towards depth of field)
  • 6 = action program (set to fast shutter speed)
  • 7 = portrait (for close-ups with a blurred background)
  • 8 = landscape mode (for landscape photos with a sharp background)

Note, however, that you do not necessarily need the name of the mode to know what worked and what did not. What is really important is the combination of ISO (the so-called exposure triangle or better tricycle as @mattdm clearly explained), shutter speed and aperture (and exposure compensation …).

The different camera modes will only help you to set these values: but in the end, you have to say, "Look, I really would like to have more exposed for this part of the photo and less for that other part …".

You'll find that some modes are more useful in certain situations and others in other situations (for example, when you try to freeze an action, the shutter priority is much more useful than the aperture priority). But it's the final combination of values ​​that really matter to you.

6.0 Marshmallow – My phone continues to beep at random! Also in safe mode

It started about two days ago. It beeps randomly every two to three minutes. Sometimes it beeps more often, sometimes less. It has no pattern. I recently downloaded the reddit app and turbo VPN, so I thought it may have something to do with them, but that's safe mode, which means it has nothing to do with the apps I downloaded. There is also no notification in the notification bar and no indicator like a flickering light or something else, just that beep. I have this phone for several months now. I think this thing started two days ago.

Wireless Network – What is the Performance of the TP-Link Archer C3 v3 in AP and Client 5 GHz Mode?

I set up a TP-Link Archer C7 v3 with OpenWRT. I have created an AP client (80 MHz wide) for another wireless router with Internet access and another AP mode (Master), both of which use a single 5 GHz radio. I get at least 116 Mbps on the AP client, but only 15 Mbps on the AP master. A Qualcomm Atheros QCA9880 chipset is used.

Are these results normal when a 5 GHz radio is used for both client and AP modes?