casting

How to get VS2013 to stop generating calls to __dtol3, __dtoui3, and other functions for casting between integer types?

蓝咒 提交于 2019-12-18 13:22:30
问题 I am in the process of upgrading a Visual Studio 2010 project that targets the INtime RTOS. Code that performs casting operations fail to link. When investigating the "inline assembly" output files, it turns out that for some integer casting operations, VS2013 is generating assembly instructions to calls to __dtol3, __dtoui3, __dtoul3, __ltod3, and __ultod3. The problem is that the INtime libraries do not contain definitions for these functions. I've verified that VS2013 does the same for

How to compare time in javascript?

不羁岁月 提交于 2019-12-18 13:03:07
问题 I have two time in the format "HH:MM" i want to compare them i have the following code to get the time of now in my format: current_time = new Date(); hour = current_time.getHours(); minute = current_time.getMinutes(); if(hour<10){hour='0'+hour} if(minute<10){minute='0'+minute} my_time = hour+':'+minute; And this code is to get the time after subtracting the GMT difference : d = new Date() var n = d.getTimezoneOffset(); var n1 = Math.abs(n); var difference = (n1/60); my_time = my_time - (0

How can I convert from int to hex

做~自己de王妃 提交于 2019-12-18 12:12:42
问题 I want to convert from int to hex in Golang. In strconv, there is a method that converts strings to hex. Is there a similar method to get a hex string from an int? 回答1: Since hex is a Integer literal, you can ask the fmt package for a string representation of that integer, using fmt.Sprintf(), and the %x or %X format. See playground i := 255 h := fmt.Sprintf("%x", i) fmt.Printf("Hex conv of '%d' is '%s'\n", i, h) h = fmt.Sprintf("%X", i) fmt.Printf("HEX conv of '%d' is '%s'\n", i, h) Output:

When an object is cast to a base class, how does it remember what it really is?

99封情书 提交于 2019-12-18 12:10:05
问题 This is a beginner's question, but I am interested in learning what's going on here. My question is, what goes on behind the scenes when you down-cast an object? Does it maintain some sort of metadata about what it originally was? Here's what I mean: Suppose I have a method called "ClockIn" that accepts a parameter of type "Employee": public static void ClockIn(Employee employee) { var manager = employee as Manager; if (manager != null) { manager.OpenSafe(); } } So, assume that Manager is a

Hive cast string to date dd-MM-yyyy

扶醉桌前 提交于 2019-12-18 11:07:21
问题 How can I cast a string in the format 'dd-MM-yyyy' to a date type also in the format 'dd-MM-yyyy' in Hive? Something along the lines of: CAST('12-03-2010' as date 'dd-mm-yyyy') 回答1: try: from_unixtime(unix_timestamp('12-03-2010' , 'dd-MM-yyyy')) 回答2: If I have understood it correctly, you are trying to convert a String representing a given date, to another type. Note: (As @Samson Scharfrichter has mentioned) the default representation of a date is ISO8601 a date is stored in binary (not as a

Haskell: Converting Int to String

十年热恋 提交于 2019-12-18 09:57:09
问题 I know you can convert a String to an number with read : Prelude> read "3" :: Int 3 Prelude> read "3" :: Double 3.0 But how do you grab the String representation of an Int value? 回答1: The opposite of read is show . Prelude> show 3 "3" Prelude> read $ show 3 :: Int 3 回答2: An example based on Chuck's answer: myIntToStr :: Int -> String myIntToStr x | x < 3 = show x ++ " is less than three" | otherwise = "normal" Note that without the show the third line will not compile. 回答3: Anyone who is just

SQL Server Datetime Subquery Conversion Error?

时光怂恿深爱的人放手 提交于 2019-12-18 09:54:35
问题 Can't comprehend why when my subquery properly filters out bad date data (user entered in real query) but that the query fails when I cast the results of the subquery (which has clean dates) back to a datetime for the where clause. I've included a tableless example which fails. Spent a long time on this thus far - hating life. select date_test from ( select date_test from ( select '01/01/1980' as date_test union select 'a' ) as qry_bad_date where ISDATE(date_test) = 1 ) as qry_only_valid_date

Explicit type conversion between child spring object, and it's super java.util object

十年热恋 提交于 2019-12-18 09:35:06
问题 In spring I am using jdbcTemplate, but having a problem that it is returning a Linkedcaseinsensitivemap when querying for a List, when doing the following I still get the spring linkedcaseinsensitivemap, even if I cast it to java util List and define the left-side of the assignment as a java.util.List. Firstly how is that even possible? final java.util.List<Map<String, Object>> list = (java.util.List<Map<String, Object>>) jdbc .queryForList("SELECT * FROM customer"); so, how would one achive

boost::any replacement for the code below

你说的曾经没有我的故事 提交于 2019-12-18 09:24:33
问题 I wish get rid of boost dependency on my code. I have the following struct construct. When calling and using this struct at another place in the code boost::any_cast is used. I know a template class would do it, but finding it hard to write this template. - C++ Rookie. struct Properties { public: Properties() {} Properties(const std::string &s, const boost::any & p) { name = s; value = p; } template <typename T> Properties(T n) { value = n; } boost::any value; std::string name; }; 回答1: Just

Converting int to byte in Android

夙愿已清 提交于 2019-12-18 09:06:44
问题 Actually I need to transfer the integer value along with the bitmap via bluetooth .. Now my problem is I need to transfer the integer as single byte value.. Is tat possible to convert int as single byte value.. and retrieve it as a integer there... I tried byteValue() and the casting thing but its not usefull.. If my approach is right just help me out with this or say some other way. (Each time when I am using casting then it's returning as 65535) 回答1: What about this? public static byte[]