casting

Encrypt password in insert statement in postgresql throws an error (Need to add explicit type cast)

寵の児 提交于 2020-01-04 05:50:07
问题 New to postgresql. It might be very simple; but am not getting it. I've this in mysql: insert into APP_USERS VALUES (1, 'admin', 'adminemailid','', 'System', 'Administrator', 'SysAdmin', 'CompanyName', sha('password123'), 'ADMIN', 2,'SCREEN',0); After referring postgresql documentations on password encryption/hashing and various similar questions on Stackoverflow; I tried it's equivalent in postgresql as: insert into APP_USERS VALUES (1, 'admin', 'adminemailid','', 'System', 'Administrator',

Check if a string is parsable as another Java type

北战南征 提交于 2020-01-04 05:42:05
问题 I'm trying to find a way to check if a string is parsable as a specific type. My use case is : I've got a dynamic html form created from a map of field (name and type) In my controller I get back the form values from the http request as strings I'd like to check if the retrieved string is parsable as the wanted type, in order to display an error message in the form if this is not possible. Does someone know a way to check if the parsing is possible without testing each type one by one ?

Check if a string is parsable as another Java type

 ̄綄美尐妖づ 提交于 2020-01-04 05:42:02
问题 I'm trying to find a way to check if a string is parsable as a specific type. My use case is : I've got a dynamic html form created from a map of field (name and type) In my controller I get back the form values from the http request as strings I'd like to check if the retrieved string is parsable as the wanted type, in order to display an error message in the form if this is not possible. Does someone know a way to check if the parsing is possible without testing each type one by one ?

C++ - Convert array of floats to std::string

痞子三分冷 提交于 2020-01-04 04:34:11
问题 I have an array of floats with a fixed length. Now I want to convert that array to a binary string. I cannot use const char * because my string will contain null-bytes. How would I use memcpy in that case? I have already tried a reinterpret_cast<string *> , but that won't work because the string is also/only storing pointers to the begin and end of the data (correct me if I am wrong). I'm already constructing an empty string: string s; s.resize(arr_size); But how would I copy an array of

Topshelf exception

左心房为你撑大大i 提交于 2020-01-04 04:32:46
问题 I'm using topshelf and I'm getting this exception when I try to use the "-i" option to install as a service. Unable to cast object of type 'Magnum.CommandLineParser.SwitchElement' to type 'Magnum.CommandLineParser.IArgumentElement'. Exception occurs in this function static void Set(TopshelfArguments args, IEnumerable<ICommandLineElement> commandLineElements) { var command = commandLineElements .Take(1) .Select(x => (IArgumentElement) x) //EXCEPTION BREAKS ON THIS LINE .Select(x => x.Id)

How do I CAST AS DECIMAL in postgresql?

我的未来我决定 提交于 2020-01-04 04:05:33
问题 The Percent_Failure in the query below is giving results as either 1.00 or 0.00. Can anyone help me understand why it's not giving me the actual decimal? SELECT sf.hierarchy_name AS Hierarchy_Name, cl.cmh_id AS CMH_ID, cl.facility_name AS Clinic_Name, sf.billing_city AS City, sf.billing_state_code AS State, cl.num_types AS Num_Device_Dypes, cl.num_ssids AS Num_SSIDs, SUM(CAST(CASE WHEN (d.mdm_client_version NOT LIKE '1.14%' AND d.type = 'Wallboard') OR (d.mdm_client_version NOT LIKE '1.14%'

How to get the address of an objective c object into a void * volatile * under ARC?

ぐ巨炮叔叔 提交于 2020-01-04 04:04:07
问题 I have a simple objective c object NSManagedObjectContext * moc = nil Now I need to pass it into a function in an ARC environment that accepts parameter of type void *volatile * value I tried &((__bridge void *)moc)) but I get the following compiler error Address expression must be lvalue or a function pointer I also tried void ** addr = (__bridge void **)(&moc); But I get the error Incompatible types casting 'NSManagedObjectContext * __strong *' to 'void **' with a __bridge cast Is there any

Dynamic Casts or Function Overloads?

こ雲淡風輕ζ 提交于 2020-01-04 03:53:25
问题 Consider the following abstract class: class Abstract { public: // ... virtual bool operator==(const Abstract& rhs) const = 0; // ... }; Now suppose I'm creating multiple derived classes from this abstract class. However, each one uses a different algorithm when comparing with its own type, and a generic algorithm when comparing with any of the other derived classes. Between the following two options, which would be the better, more efficient option? Option A: class Derived : public Abstract

Different results when casting int and const int to float

只愿长相守 提交于 2020-01-04 02:38:04
问题 Would anyone be able to explain why int and const int give different results when cast to float and used in floating point math? See for example this piece of code: int _tmain(int argc, _TCHAR* argv[]) { int x = 1000; const int y = 1000; float fx = (float) x; float fy = (float) y; printf("(int = 1000) * 0.3f = %4.10f \n", 0.3f*x); printf("(const int = 1000) * 0.3f = %4.10f \n", 0.3f*y); printf("(float)(int = 1000) * 0.3f = %4.10f \n", 0.3f*fx); printf("(float)(const int = 1000) * 0.3f = %4

Innosetup SendMessage after changing the environment values

与世无争的帅哥 提交于 2020-01-04 01:29:08
问题 I set environment variable in the registry using InnoSetup: [Registry] Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "MY_PROGRAM_HOME_DIR"; ValueData: "{app}" But system cannot see this variable until I call SendMessage . [Code] procedure DeinitializeSetup(); begin // HWND_BROADCAST = $FFFF // WM_SETTINGCHANGE = $001A SendMessage($FFFF, $001A, 0, Longint(PChar('Environment'))); end; InnoSetup says: ... Column 60: Type