vba – How to paste text with leading “0” in excel

I have this code that pastes entire txt file contents to my active workbook but it loses leading “0” in cells:

Dim FileToOpen As Variant
Dim OpenBook As Workbook

FileToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt")

If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
OpenBook.Sheets(1).UsedRange.Select
Selection.NumberFormat = "@"
OpenBook.Sheets(1).UsedRange.Copy
ThisWorkbook.Worksheets("BOM").Range("C1").PasteSpecial xlPasteValues
OpenBook.Close False
End If

I tried to work around it by adding

OpenBook.Sheets(1).UsedRange.Select
Selection.NumberFormat = "@"

But it doesn’t do the trick.

So how do I paste the contents and not lose leading “0”?

combinatorial identities – An identity for rational functions leading to equations for multiple polylogarithms

The following identity is not hard to prove:
$$
sum_{1leq i_1<i_2<ldots <i_{2n}leq N} (-1)^{i_1+ldots+i_{2n}}frac{(1-x_{i_1})(1-x_{i_3})ldots(1-x_{i_{2n-1}})}{(1-x_{i_2})(1-x_{i_4})ldots (1-x_{i_{2n}}) }=
frac{x_{1}(x_{2}-x_{3})(x_{3}-x_{4})ldots (x_{N-1}-x_{N})}{(1-x_{1})(1-x_{2})ldots (1-x_{N-1})(1-x_{N})}.
$$

I am curious if it appeared anywhere before and if it is a part of a certain family of similar identities. As a corollary, one immediately sees that LHS is a power series starting with degree $N-1.$ This fact leads to a family of functional equations for multiple polylogarithms.

data – How can we communicate how leading zeros work for a number generator?

I guess what you are looking for is “minimum number of digits”, or if you support non-digit characters then “minimum number of characters”.

I think it would also be perfectly acceptable to use “length” if you prefer, as in: “Minimum length”.

Perhaps this is enough information for the user as it is, however you may consider adding an addition explanation that help makes it more clear, if your design allows for adding longer explanations of course…

The “minimum number of digits” specifies the minimum length that a generated code must be. If a code is shorter than the minimum length, then leading zeros are prepended until the minimum length is satisfied. For example, the code “123” with a minimum length of “5” will be generated as “00123”.

So it ends up looking something like this:

enter image description here


This assumes you are already within some sort of section that is obviously related to “generating codes”. Depending on the rest of your design, you might need to consider making the label specific to code generation, for example:

Minimum length of generated code

9 – Media ‘external video’ requests iframe over http instead of https, leading to mixed content errors and blocked video

I have a drupal 9 site where I use the media library. I’ve created a media type with source “External video”, allowing youtube videos. As far as I can see this uses oEmbed.

I’ve added a media reference field for this type in a contenttype and created content. However, when I try to view the page the video won’t show and I have a mixed content warning in the console of the browser.

Mixed Content: The page at 'https://xxx' was loaded over HTTPS, but requested an insecure frame
 'http://xxx/media/oembed/?url=https%3A//youtu.be/someIDHERE&max_width=890&max_height=560&hash=0nPSIkGE5CqEuiNAmZ1wdR1rXpwkg5r3GkoTyeZaR-g'. 
This request has been blocked; the content must be served over HTTPS.

I’ve set all correct settings for reverse proxy in settings.php, and the base url in the settings reflects this by showing https, but somehow this particular part of Drupal insists on using http, rather than https.

How can I make sure it requests this video frame using https?

base58 – How to handle leading 0’s (b58 1’s) when base58check encoding

I’m trying to more fully understand the base58check encoding algorithm.

Unfortunately, I keep running into a problem with how to handle a situation where the base58 value of an input would have leading 0’s (1’s in base58).
Everywhere I find any information about this online, it simply states that “the data is encoded to avoid having leading 0s, except to represent full ‘0’ bytes in then input.”

What I need to understand is:
What is changed in the data (input or output) to avoid/correct this situation in the output string?

magento2.4.1 – 2.4.1: Elasticsearch/MySQL memory spikes leading to SWAP

Low traffic site on 2.4.1, elasticsearch, 16GB RAM, but memory usage seems to climb constantly, with CPU usage spiking, until mysql and elastic are basically running in SWAP. Site was running fine on 2.3 but has been having these issues since upgrade. I’ve seen issues like this on another site too but not sure the cause on there either

Elastic has been set to not use SWAP but there are about 90 elastic processes running which seems excessive.

Any thoughts?

Consider 4 positive integers a,b,c,d having exactly 10^11 bits (considering the leading zeroes) in the binary representations

Consider 4 positive integers a,b,c,d having exactly 10^11 bits (considering the leading zeroes) in the binary representations. Positions are numbered from 1 to 10^11. Every 3rd bit of a is equal to 1 (in other words bits number 3,6,9 and so-on), every 7th bit of b is equal to 1, every 4th bit of c is equal to 1, every 5th bit of d is equal to 1. The task is to determine the number of 1 bits in a ⊕ b ⊕ c ⊕ d, where ⊕ is bitwise XOR operation.

sql server 2014 – Convert to 2 decimals and keep leading zero

The following piece of code is resulting in a value with 4 decimals.

COALESCE (SUM( CASE WHEN PLL_TRANSACTIONTYPE = ‘TAX’ and PLL_REVENUETYPE = ‘OTHER’ then CAST(ROUND(PLL_AMOUNT,2) as decimal (9,2))
WHEN PLL_REVENUETYPE = ‘TAX’ THEN CAST(ROUND(PLL_TAXAMOUNT,2) as decimal (9,2))
WHEN PLL_ISINCLUSIVETAX = ‘-‘ THEN CAST(ROUND(PLL_NETAMOUNT,2) as decimal (9,2))
ELSE CAST(ROUND(PLL_NETAMOUNT,2)as decimal (9,2)) END ), 0) * -1.00 AS AMOUNT

I found many suggestions on the web, but I haven’t been able to round the amount with 2 decimals.

Also, when I do a SQMCMD to export the query to a CSV, it will drop the leading zero if the amount is 0.00

Any help would be appreciated.

excel – .cvs export of sharepoint list removes leading zero’s

My site includes functionality that exports a list as a .csv file. I can’t change the fact that the list is being exported as a .csv.

The problem is that when the list is exported, the leading zeros get automatically removed from one of the numeric columns.

Does anyone know a way to STOP this from happening BEFORE the list is exported? AKA Changing excel settings does not satisfy the customer and I need code that I can add to the existing export functionality.