verbosity

Is it better coding practice to define variables outside a foreach even though more verbose?

青春壹個敷衍的年華 提交于 2019-11-28 10:43:51
In the following examples: the first seems more verbose but less wasteful of resources the second is less verbose but more wasteful of resources (redefines string each loop) Which is better coding practice? First example: using System; using System.Collections.Generic; namespace TestForeach23434 { class Program { static void Main(string[] args) { List<string> names = new List<string> { "one", "two", "two", "three", "four", "four" }; string test1 = ""; string test2 = ""; string test3 = ""; foreach (var name in names) { test1 = name + "1"; test2 = name + "2"; test3 = name + "3"; Console

Suppress console output in PowerShell

[亡魂溺海] 提交于 2019-11-27 14:17:51
问题 I have a call to GPG in the following way in a PowerShell script: $key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose > $null I don't want any output from GPG to be seen on the main console when I'm running the script. Due to my noobness in PowerShell, I don't know how to do this. I searched Stack Overflow and googled for a way to do it, found a lot of ways to do it, but non of it worked. The "> $null" for example has no effect. I found the --quiet --no-verbose options for GPG to put

Is it better coding practice to define variables outside a foreach even though more verbose?

限于喜欢 提交于 2019-11-27 03:46:06
问题 In the following examples: the first seems more verbose but less wasteful of resources the second is less verbose but more wasteful of resources (redefines string each loop) Which is better coding practice? First example: using System; using System.Collections.Generic; namespace TestForeach23434 { class Program { static void Main(string[] args) { List<string> names = new List<string> { "one", "two", "two", "three", "four", "four" }; string test1 = ""; string test2 = ""; string test3 = "";

How do I disable log messages from the Requests library?

喜夏-厌秋 提交于 2019-11-26 11:31:30
By default, the Requests python library writes log messages to the console, along the lines of: Starting new HTTP connection (1): example.com http://example.com:80 "GET / HTTP/1.1" 200 606 I'm usually not interested in these messages, and would like to disable them. What would be the best way to silence those messages or decrease Requests' verbosity? I found out how to configure requests 's logging level, it's done via the standard logging module. I decided to configure it to not log messages unless they are at least warnings: import logging logging.getLogger("requests").setLevel(logging

How do I disable log messages from the Requests library?

柔情痞子 提交于 2019-11-26 02:40:10
问题 By default, the Requests python library writes log messages to the console, along the lines of: Starting new HTTP connection (1): example.com http://example.com:80 \"GET / HTTP/1.1\" 200 606 I\'m usually not interested in these messages, and would like to disable them. What would be the best way to silence those messages or decrease Requests\' verbosity? 回答1: I found out how to configure requests 's logging level, it's done via the standard logging module. I decided to configure it to not log

How do I force make/GCC to show me the commands?

我的梦境 提交于 2019-11-26 02:27:27
问题 I\'m trying to debug a compilation problem, but I cannot seem to get GCC (or maybe it is make??) to show me the actual compiler and linker commands it is executing. Here is the output I am seeing: CCLD libvirt_parthelper libvirt_parthelper-parthelper.o: In function `main\': /root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:102: undefined reference to `ped_device_get\' /root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:116: undefined reference to `ped_disk_new\' /root/qemu-build