int64

How to change System.DirectoryEntry “uSNChanged” attribute value to an Int64

烈酒焚心 提交于 2019-12-01 17:37:06
I'm trying to get the Int64 value of a Directory Services object's "uSNChanged" value. Unfortunately, it is always coming back as a COM object of some kind. I've tried using casting to Int64, calling Int64.Parse(), and calling Convert.ToInt64(). None of these work. For a given DirectoryEntry object, this code will display the properties: private static void DisplaySelectedProperties(DirectoryEntry objADObject) { try { string[] properties = new string[] { "displayName", "whenCreated", "whenChanged", "uSNCreated", "uSNChanged", }; Console.WriteLine(String.Format("Displaying selected properties

Swift: Cast Any Object to Int64 = nil

倖福魔咒の 提交于 2019-12-01 17:16:33
问题 i have a question. I was wondering why this is happend? var dict : [String : Any] = ["intValue": 1234, "stringValue" : "some text"] dict["intValue"] as? Int64 // = nil (why) dict["intValue"] as? Int // = 1234 can anybody tell me why the cast to Int64 returns nil? Edited part: I have simplify my question, but i think this was not a good idea. :) In my special case I will get back a Dictionary from a message body of WKScriptMessage. I know that in one field of the Dictionary there is a Int

How to change System.DirectoryEntry “uSNChanged” attribute value to an Int64

旧时模样 提交于 2019-12-01 16:28:35
问题 I'm trying to get the Int64 value of a Directory Services object's "uSNChanged" value. Unfortunately, it is always coming back as a COM object of some kind. I've tried using casting to Int64, calling Int64.Parse(), and calling Convert.ToInt64(). None of these work. For a given DirectoryEntry object, this code will display the properties: private static void DisplaySelectedProperties(DirectoryEntry objADObject) { try { string[] properties = new string[] { "displayName", "whenCreated",

Random long long generator C++ [closed]

江枫思渺然 提交于 2019-12-01 14:50:32
What is a solution to generate random long long with cryptographic strength С++? (boost is allowed) The <random> header provides portable access to random number facilities including, potentially, a cryptographic pRNG. #include <random> // random_device, uniform_int_distribution #include <algorithm> // generate_n #include <iterator> // ostream_iterator #include <iostream> // cout #include <functional> // bind, ref int main() { std::random_device r; std::uniform_int_distribution<long long> dist; std::generate_n(std::ostream_iterator<long long>(std::cout, "\n"), 10, std::bind(dist,std::ref(r)));

Random long long generator C++ [closed]

北城以北 提交于 2019-12-01 13:32:31
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . What is a solution to generate random long long with cryptographic strength С++? (boost is allowed) 回答1: The <random> header provides portable access to random number facilities including, potentially, a

Go: convert uint64 to int64 without loss of information

白昼怎懂夜的黑 提交于 2019-12-01 05:12:25
The problem with the following code: var x uint64 = 18446744073709551615 var y int64 = int64(x) is that y is -1 . Without loss of information, is the only way to convert between these two number types to use an encoder and decoder? buff bytes.Buffer Encoder(buff).encode(x) Decoder(buff).decode(y) Note, I am not attempting a straight numeric conversion in your typical case. I am more concerned with maintaining the statistical properties of a random number generator. VonC Seeing -1 would be consistent with a process running as 32bits. See for instance the Go1.1 release notes (which introduced

manipulating LARGE_INTEGERS

和自甴很熟 提交于 2019-12-01 03:09:11
I am converting some code from C to C++ in MS dev studio under win32. In the old code I was doing some high speed timings using QueryPerformanceCounter() and did a few manipulations on the __int64 values obtained, in particular a minus and a divide. But now under C++ I am forced to use LARGE_INTEGER because that's what QueryPerformanceCounter() returns. But now on the lines where I try and do some simple maths on the values I get an error: error C2676: binary '-' : 'LARGE_INTEGER' does not define this operator or a conversion to a type acceptable to the predefined operator I tried to cast the

manipulating LARGE_INTEGERS

感情迁移 提交于 2019-11-30 23:12:08
问题 I am converting some code from C to C++ in MS dev studio under win32. In the old code I was doing some high speed timings using QueryPerformanceCounter() and did a few manipulations on the __int64 values obtained, in particular a minus and a divide. But now under C++ I am forced to use LARGE_INTEGER because that's what QueryPerformanceCounter() returns. But now on the lines where I try and do some simple maths on the values I get an error: error C2676: binary '-' : 'LARGE_INTEGER' does not

FILETIME to __int64

一个人想着一个人 提交于 2019-11-30 17:48:08
What is the proper way to convert a FILETIME structure into __int64 ? Can you please tell me? GManNickG I don't think you're suppose to: "Do not cast a pointer to a FILETIME structure to either a ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows." Source. If you really wanted it would be something like: __int64 to_int64(FILETIME ft) { return static_cast<__int64>(ft.dwHighDateTime) << 32 | ft.dwLowDateTime; } FILETIME ft = // ... __int64 t = to_int64(ft); But something like: FILETIME ft = // ... __int64 t = *reinterpet_cast<__int64*>(&ft); Is bad. There

How to convert string to int64_t?

戏子无情 提交于 2019-11-30 08:15:37
How to convert program parameter from argv to int64_t ? atoi() is suitable only for 32 bit integers. A C99 conforming attempt. [edit] employed @R. correction // Note: Typical values of SCNd64 include "lld" and "ld". #include <inttypes.h> #include <stdio.h> int64_t S64(const char *s) { int64_t i; char c ; int scanned = sscanf(s, "%" SCNd64 "%c", &i, &c); if (scanned == 1) return i; if (scanned > 1) { // TBD about extra data found return i; } // TBD failed to scan; return 0; } int main(int argc, char *argv[]) { if (argc > 1) { int64_t i = S64(argv[1]); printf("%" SCNd64 "\n", i); } return 0; }