java,casting,data-type-conversion
You want to transfer a String into a Treecreat? You should give Treecreat a constructor like this. public Treecreat(String yourString){ this.myString = yourString; } So the String is in Treecreat and you can work with it in your method, with call the method in this way: add(new Treecreat(data). ...
data-type-conversion,dynamics-ax-2012
The AX TimeOfDay type is number of seconds from midnight. You can use time2Str function or use div and mod operand to calculate hours and minutes. Example: info(time2Str(31501, TimeSeparator::Colon, TimeFormat::AMPM)); ...
swift,type-conversion,data-type-conversion
The CGFloat(...) part is fine; the error-message isn't saying that you can't explicitly convert an integer to a CGFloat, but rather, that you can't implicitly convert from a CGFloat to an Int. More specifically, I think it's complaining because of the final assignment x = ...; the part on the...
mysql,double,decimal,data-type-conversion
Yes, you do have a risk of losing data unless planned carefully, but as long as you ensure that your data is already consistent and you choose correct length for the field you should be fine. Consider the following: ALTER TABLE yourtable MODIFY COLUMN yourcolumn DECIMAL; This will convert yourcolumn...
javascript,string,data-type-conversion
By using parseInt. parseInt(Number(100).toString(16), 16); parseInt(Number(1000).toString(36), 36); ...
sql-server,sql-server-2008,ms-access,data-type-conversion,sqldatatypes
The reason is that you selected a number for precision which is 38 that is larger than the maximum acceptable precision by MS Access 2013 which is 28 So, It failed to map it to Number data type in access, that's why it was converted to short_text However, I see...
java,android,data-type-conversion
To format a decimal use: http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html In this case the format you want is ###.## An example of using this would be float f = 123456.78f; DecimalFormat format = new DecimalFormat("###.##'); String formatted = format.format(f); Note that if you are using this for monetary calculations you should use BigDecimal instead....
r,data.frame,data-type-conversion
data.frame starts of with ..., which is often populated with "tag/value" pairs to be combined as columns. Thus, data.frame(x = x, y = y) would work as you expected. as.data.frame expects a single object that can be coerced into a data.frame using one of the as.data.frame.* methods. It also has...
oracle11g,data-type-conversion,to-date,to-char
To select rows inserted in the last minute: select * from my_table where inserted_date > sysdate-1/(24*60); (This assumes your table has a date column called inserted_date that holds the date and time of insertion.) SYSDATE always returns the current date and time, but what you see in a tool like...
mysql,types,data-type-conversion
Try this SELECT CONV( BINARY( '100101' ) , 2, 10 ) It will do the trick. I was inspired by Convert a binary to decimal using MySQL EDIT In fact you can make it even more simple by using just CONV SELECT CONV( '100101' , 2, 10 ) See http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html#function_conv...
c,variables,integer,data-type-conversion
Yes, you cannot declare a very big local array because its sits in the call stack. I'm sure your local variable int f[]; is a typo (that won't compile). You probably meant (after having set n) something like int f[n]; so you are using a VLA. The call stack has...
java,performance,coding-style,utc,data-type-conversion
ZonedDateTime value = ZonedDateTime.now(ZoneOffset.UTC); System.out.println(value.get(ChronoField.NANO_OF_SECOND)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"); long time = Long.parseLong(formatter.format(value)) * 100; System.out.println(time); ...
sql,database,timestamp,teradata,data-type-conversion
Instead of casting from/to a string two times it's probably more efficient to substract intervals: ts - (EXTRACT(MINUTE FROM ts) * INTERVAL '01' MINUTE) - (EXTRACT(SECOND FROM ts) * INTERVAL '01' SECOND) If this is to much code simply put it in a SQL UDF....
r,numeric,data-type-conversion,factors
if train_new is a data.frame and you want to change the columns starting with "Q1...", try this: train_new[,grep(pattern="^Q1",colnames(train_new))] = lapply(train_new[,grep(pattern="^Q1",colnames(train_new))],as.integer) or if not every column you are converting is a factor (could be char or numeric): train_new[,grep(pattern="^Q1",colnames(train_new))] = lapply(train_new[,grep(pattern="^Q1",colnames(train_new))], function(x) { as.integer(as.factor(x)) } ) Applied on a general data.frame df:...
c++,malloc,data-type-conversion
The equivalent of SP->xs = malloc(size * sizeof(double)); is SP->xs = new double[size]; This does not require any #includes. To free the allocated array, use delete[]: delete[] SP->xs; The square brackets are important: without them, the code will compile but will have undefined behaviour. Since you're writing in C++, consider...
django,timestamp,tastypie,data-type-conversion
Use the hydrate method on your resource. class EntryResource(ModelResource): def hydrate(self, bundle): if field in bundle.data: date = bundle.data['pub_date'] bundle.data['pub_date'] = time.strptime(date, "%Y-%m-%d %H:%M:%S") return bundle ...
c#,data-type-conversion,slimdx,numerical-stability
If this were my application and I was that concerned about the possible loss of integrity, I would recreate the appropriate methods using the required data types. .Net is a general platform that attempts to solve a majority of problems, but it can't solve them all. Although it may be...
sql,sql-server,data-type-conversion,sqldatatypes
Divide by 100. Convert(money, field) / 100 Try These Formats if you want : MonyFormat...
I've just tested CHAR_HEX_CONVERSION and I get what I think is the same dump: For the statement "WRITE src TO dest" only flat, character-type data objects are supported at the argument position "dest". In this case, the operand "dest" has the non-character-type or non-flat type "X". The current program is...
java,string,data-type-conversion
The problem here is you are putting a char value to a int array resulting the unexpected behaviour. a[k][i][j] = inpline[k][i].charAt(j); I'm not sure but I think this will put the ASCII value related to the referring char value to your int array. Which will give you that unexpected answer....
In the case of int to byte, there's no real concern about a loss of precision, because both types have the same degree of granularity. You'll get an error if you try to convert a literal with a value outside the range of byte to byte. (The error message given...
sql,oracle,data-type-conversion,clob,varchar2
You can drop CLOB column, add the varchar2 column, and then 'fix' the column order using online table redefinition; assuming you're on a version that supports that and you have permission to use the DBMS_REDEFINITION package. Very simple demo for a table with a primary key: create table in_msg_board(col1 number...
java,integer,hex,data-type-conversion
Based on the example you provided, my guess is that convertByteToHex(byte) is converting to a single-digit hex string when the byte value is less than 0x10. 16900 is 0x4204 and 1060 is 0x424. You need to ensure that the conversion is zero-padded to two digits. A much simpler approach is...
php,sql-server,data-type-conversion
you can try this $variable = round($row['column_name'],2); //display 2 decimal ...
java,mysql,jpa,data-type-conversion
Try to give the classname you expect as the second argument of your createNativeQuery call: studentsInCourse = em .createNativeQuery( "SELECT * FROM Student WHERE id IN (SELECT student_id FROM CourseResult WHERE course_id = ?)", Student.class) .setParameter(1, course.getId()).getResultList(); ...
sql,oracle,timestamp,data-type-conversion
The message for ORA-01861 is literal does not match format string. This error means we're casting a string to another data type but the string has the wrong format. Your insert statement features two casts of a string to a TIMESTAMP datatype using the ANSI SQL style timestamp() function. This...
javascript,file,binary,data-type-conversion,8bit
That is hexadecimal. Each one of those 4-digit chunks are the equivalent of 2 bytes or 16 bits. As far as what it's supposed to represent, that is completely dependent upon how you choose to interpret it. The data itself does not provide context. For example, you could choose to...
The signature of atoi() is int atoi(const char *nptr); It will return an int value, not a float or double. In your case, input 0.1 is returned as 0. If you want a float value, try atof(). Note: as a suggestion, it's better to check for NULL before using the...
java,matlab,file,data-type-conversion
A solution as mentioned by Daniel Save your java results in a .txt file that looks like that: 1 2 3 4 5 6 7 8 9 use textscan to convert it into a matlab variable file= fopen('whatever.txt') Variable=textscan(file,'%d %d %d') Hoping this is useful to someone else. Any other...
c#,datetime,data-type-conversion
Use MM instead of MMMM: string[] formats = { "yyyy/MM/dd" }; MM is month number 01 to 12 MMMM is full month name january to december (strings depend on culture). Check out MSDN: Custom date and time format strings...
java,string,char,data-type-conversion
The assignment of a character to a String is invalid. You can use a concatenation trick to do it anyway, but that borders on a hack: String[] oneLetter = ""+alphabet[i]; A better approach would be to check that letter has the length of 1, and that its only character matches...
c++,type-conversion,implicit-conversion,data-type-conversion,rank
The 4.13 section says that Every integer type has an integer conversion rank defined as follows: — No two signed integer types other than char and signed char (if char is signed) shall have the same rank, even if they have the same representation. — The rank of a signed...
java,data-type-conversion,ternary-operator
Isn't the return type for a ternary expression evaluated at runtime? No, absolutely not. That would be very contrary to the way Java works, where overload resolution etc is always performed at compile-time. What would you expect to happen if you hadn't passed the result to a method, but...
r,datetime,data-type-conversion
Here are some alternatives: 1) The chron package has a "times" class in which 1 unit is a day and there are 60 * 24 minutes in a day so: library(chron) 60 * 24 * as.numeric(times(Time.Training)) giving: [1] 60 45 30 90 1a) Another approach using chron is the following...
c#,sql,sql-server,date,data-type-conversion
You should have some kind of validation on your input. If it doesn't look like a date, throw an error. You can use DateTime.TryParse() for this. DateTime date = new DateTime(); if(DateTime.TryParse(textBox1.Text, out date)) { //The text is a valid date //Insert it } If you need a specific format...
Leaving aside that you can't split 8 bits into 16 (I'm going to assume you actually have a uint16_t, since that makese sense here), what you want to is called a mask. Let's say your 16 bit value is stored in variable "value" To get the first (most significant) 5...
Modify the following, short key = i + (short)1; to short key = (short) (i + (short)1); The reason being, any additions of short + short might overflow short range. and hence this requires a explicit casting....
java,double,data-type-conversion
Assuming your value in scientific notation is a String, you can do this: Double d = Double.parseDouble("3.2179465E7"); DecimalFormat df = new DecimalFormat("#.00"); System.out.println(df.format(d)); ...
sql,database,oracle,oracle11g,data-type-conversion
While I advise not to proceed like this as this could be rife for errors and a possible maintenance nightmare, I do like a challenge and have been forced to do some screwy things myself in order make some vendor's bizarre way of doing things work for us so I...
r,date,line-breaks,data-type-conversion,factors
You could specify na.strings and stringsAsFactors=FALSE in the read.csv/read.table. (I changed the delimiter to , and saved the input data) stk <- read.csv('Akash.csv', header=TRUE, stringsAsFactors=FALSE, sep=",", na.strings="\\N") head(stk,3) # sku Stockout_start Stockout_End create_date #1 0BX-164463 <NA> 1/29/2015 11:35 1/29/2015 11:35 #2 0BX-164463 2/11/2015 18:01 <NA> 2/11/2015 18:01 #3 0BX-164464 <NA>...
arrays,perl,math,data-type-conversion
Quote Words: my @xs = qw/22.595451 20.089094 17.380813 15.091260 12.477935 10.054821 7.270003 4.804673 4.728526 4.619254 4.526920 4.418416 4.321419 4.219890 4.123336 4.009777 3.912648 3.804183 3.705847 3.597756 3.512301 3.393413 3.301963 3.196725 3.098560 3.007482 2.899825 2.801002 2.688680 2.598862 2.496139 2.393526 2.282183 2.190449 2.084530 1.987778 1.877562 1.788788 1.678473 1.578123 1.467071 1.373372 1.283629 1.176670 1.071805...
python,arrays,list,numpy,data-type-conversion
A numpy array: >>> A=np.array([1,4,9,2,7]) delete: >>> A=np.delete(A, [2,3]) >>> A array([1, 4, 7]) append: >>> A=np.append(A, [5,0]) >>> A array([1, 4, 7, 5, 0]) sort: >>> np.sort(A) array([0, 1, 4, 5, 7]) index: >>> A array([1, 4, 7, 5, 0]) >>> np.where(A==7) (array([2]),) ...
These are two very similar operations - but with different results (in some cases). (int) is a Casting Operator. Operators are used for various things, such as Addition, Subtraction, and Bitwise operations. A conversion operator is used to implicitly(implicit), or explicitly(explicit) convert one type to another. This is an example...
Here you go, use raw_input in python 2 (and input in python 3): >>> inp = raw_input("Enter space separated values of form 'a b 2 5' \n") Enter space separated values of form 'a b 2 5' a b 2 5 >>> vars = [int(i) if i.isdigit() else i for...
postgresql,data-type-conversion
You can specify your view just like you'd specify any other query without needing to change the underlying table types. Here's a Fiddle with your example. CREATE TABLE mytable (length INTERVAL); INSERT INTO mytable (length) VALUES (INTERVAL '1 minute'); CREATE VIEW myview AS SELECT to_char(length, 'yy-mm-dd HH24:MI:SS.MS') AS length FROM...
java,character-encoding,bytearray,data-type-conversion,utf-16
You can try this: byte[] b = ... char[] c = new String(b, "UTF-16").toCharArray(); From String(byte[] bytes, String charsetName): Constructs a new String by decoding the specified array of bytes using the specified charset. ...
c#,sql,syntax,data-type-conversion
After retrieving the data from the database, you have to Read it: while (myReader.Read()) { Console.Out.WriteLine(myReader[5].ToString()); } You can see an example on MSDN. A couple other notes: If myReader[5] might be null, then consider using Convert.ToString(myReader[5]). That'll return an empty string instead of throwing an exception. If you're using...
Up to the representation of a, you are correct. However, the %d and %u conversions of the printf() function both take an int as an argument. That is, your code is the same as if you had written int main() { unsigned char a = -1; printf("%d", (int)a); printf("%u", (int)a);...
sql-server,entity-framework,precision,data-type-conversion,sqldatatypes
(@p__linq__0 decimal(5,0)) is the Precision of the parameter value your provided. For example, decimal number = 12345m; var result = context.MyTables.Where(x => x.Number == number).ToList(); Then the query will be like this - exec sp_executesql N'SELECT [Extent1].[Id] AS [Id], [Extent1].[Number] AS [Number] FROM [dbo].[MyTable] AS [Extent1] WHERE [Extent1].[Number] = @p__linq__0',N'@p__linq__0...
sql-server-2008,datetime,ssis,data-type-conversion,data-conversion
I solved it Myself. Thank you for your suggestion gvee but the way I did it is way easier. In the Flat File Source when making a new connection in the advanced tab I fixed all the data types according to the table in the database EXCEPT the column with...
c++,function,scope,main,data-type-conversion
You are doing it wrong. You should read about function signature and passing arguments. You have defined weight as a function that doesn't take any arguments double weight() { //...} but you are calling it with some parameter userWeight in main function weight(userWeight); and this parameter in addition is not...
java,hibernate,data-binding,data-type-conversion,java-stored-procedures
I have resolved such a problem using Hibernate Result Transformer functionality. You just need to extend SQL query in the next way: select RES1 as PROP1, RES2 as PROP2 from Table (select sp_MyProcedure(?) from dual) And then create result POJO: class MyProcRes { public String getPROP1() {} public void setPROP1(String...
sql,sql-server,integer,decimal,data-type-conversion
Easy - just run this SQL statement ALTER TABLE dbo.Budget ALTER COLUMN ROE DECIMAL(20,2) -- or whatever precision and scale you need..... See the freely available MSDN documentation on what exactly the precision, scale and length in decimal numbers are and what ranges of values are possible...
matlab,char,data-type-conversion
Ok I'm not entirely sure about whether you need letters all the time, but here regular expressions would likely perform what you want. Here is a simple example to help you get started; in this case I use regexp to locate the numbers in your entries. clear %// Create dummy...
r,image,tiff,data-type-conversion
And here is dickoa's solution within a loop: library(raster) input <- list.files(pattern='tif$') output <- gsub("tif", "img", input) for (i in seq(along=input)) { r <- raster(input[i]) # using "2 byte unsigned integer" data type r <- calc(r, fun = function(x) x * 2, datatype='INT2U', filename = output[i]) } ...
datetime,sql-server-2012,bit,data-type-conversion,sqldatatypes
you get this error because DF____Person__onvac__59062A42 sql object Depends on onvacation column. You can Find Dependency of Person table by Right Click-->View Dependancy remove that dependent object and try to alter column...
java,byte,data-type-conversion
Actually you are trying to convert an int to byte here: Byte byt=new Byte(00000001); If you want to call the function you could do this, using a cast: Byte byt=new Byte((byte)1); Hope it helps....
c#,string,type-conversion,data-type-conversion,formatexception
hexdigits: A sequence of hexadecimal digits from 0 through f, or 0 through F. It won't parse your X at the end....
function,haskell,tuples,data-type-conversion,maybe
You could also use Bitraversable: bitraverse id pure :: (Bitraversable t, Applicative f) => t (f c) d -> f (t c d) which specializes to bitraverse id pure :: (Maybe a, b) -> Maybe (a, b) ...
c,arrays,data-type-conversion,fgets
I think you need to say something like file_data[data_index++] = atoi(line);...
sql-server,ssis,null,data-type-conversion
I ended up using the approach from this blog post: http://www.proactivespeaks.com/2012/04/02/ssis-transform-all-string-columns-in-a-data-flow-stream/ to handle all of the null and blank columns via a script task and data conversion....
sql,oracle,datetime,data-type-conversion,timestamp-with-timezone
It is stored in a column with data type VARCHAR2(100 BYTE). First of all, you should never ever store DATE/TIMSTAMP as string. It is a database design flaw. Anyway, you could convert it to TIMESTAMP WITH TIMEZONE. For example, SQL> SELECT to_timestamp_tz('2015-06-04T02:58:00.134+08:00', 2 'YYYY-MM-DD"T"HH24:MI:SS.FF TZH:TZM') 3 AT TIME ZONE...
xslt,decimal,rounding,xslt-2.0,data-type-conversion
Assuming there is no schema involved, the typed value of the element InvoiceAmount is xs:untypedAtomic - which essentially means a string, but one that adapts itself to the context in which it is used. If you do an explicit conversion to xs:decimal, the untypedAtomic value "-62.84" will convert exactly. If...
memory-management,go,data-type-conversion
Yes in both cases. String types are immutable. Therefore converting them to a mutable slice type will allocate a new slice. See also http://blog.golang.org/go-slices-usage-and-internals The same with the inverse. Otherwise mutating the slice would change the string, which would contradict the spec....
assembly,hex,decimal,data-type-conversion,base
(@chathux hints at the answer). You have a value X==FFFC0888_16. When you converted X to 0003F778 (by taking "twos complement"), you did so because you (should have) thought the X value was "negative" (the sign bit is set). The decimal value you produced 259960 is the correct magnitude, that is...
sql-server,tsql,decimal,data-type-conversion,sqldatatypes
SQL server does integer arithmetic, to force it to use numeric, you can multiply it by 1.0 No need of using convert twice. This gives 89456.123 with out double convert. select convert(decimal(11,3),89456123*1.0/1000) as TotalUnits ...
sql-server,tsql,data-type-conversion
When you CAST your Productid with value say 123 using CAST(Productid as VARCHAR(10)), it's converted to variable character type which does not have padding of spaces at the end. However If you use CHAR(10), it will pad spaces at the end of 123 and you'll get '123 ' with 7...
python,arrays,numpy,data-type-conversion,custom-data-type
np.array([tuple(py_list)], custom_type) produces array([(2013, 8, 0.6552734375)], dtype=[('YEAR', '<u2'), ('DOY', '<u2'), ('REF', '<f2')]) Data for structured arrays are supposed to a list of tuples (orjust one tuple). Notice how the values are displayed. [(...)]. There may be a way of doing this with astype, but it is tricky. Also,notice what NumPy_array...
java,string,int,data-type-conversion
Here is a very simple example to process your file and split the string line and obtain the date object. public class FileReaderExample { public static void main(String[] args) { File file = new File("d:\\text.txt"); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; int lineNo = 1; while...
r,date,numbers,rstudio,data-type-conversion
You can do this easily with lubridate although it indexes Sunday as '1'. So since March 1, 2014 was a Saturday it would return '7' library(lubridate) wday(mdy("3-1-2014")) [1] 7 ...
c++,arrays,data-type-conversion
Since you are restricted to using only the standard library you will need to either implement a solution yourself or use an existing easily adaptable solution. What you are looking for is referred to as a tagged union or variant. This is a data structure that contains a union to...
objective-c,nsdictionary,data-type-conversion
Your countRowsInSection: seems to expect its argument to be a long. But you're sending it an object (probably an NSNumber). If that is the case, the following will work: [objectp.methodA countRowsInSection:[[tableSections objectForKey:[NSString stringWithFormat:@"%ld", sect] longValue]]]; ...
java,types,data-type-conversion
How about doing that by hand. Just create a wrapper class and make an enum with values AfterNoon, Morning, ... And provide a constructor that takes a Date object and code the logic as you want. Class DateWrapper { private Date date; private DayTime dayTime; public DateWrapper (Date date){ ......
c#,sql-server,string,binary-data,data-type-conversion
The nvarchar value is converted to a binary value where each character is two bytes. You can convert it already when you read it from the database: select convert(nvarchar(max), QRCodeData) from dbo.QRCode ... Or you can use the UTF-16 encoding to convert the data in C#: string qrCodeLink = Encoding.Unicode.GetString(qrCodeData);...
c++,c,types,data-type-conversion
You are ultimately asking how compilers work and how they handle type information and data representation. The answer here is broad and there are multiple approaches: Some compilers carry out type erasure, so that there is no information about what type a particular variable is when it is in memory....
java,data-type-conversion,linkedhashmap
Here's the official tutorial on Generics in Java. Read it. You've used a parameterized type with sections, but stopped using it after Set set = sections.entrySet(); Iterator iter = set.iterator(); Map.Entry me = (Map.Entry)iter.next(); These are raw types and should rarely be used. Parameterize them correctly (and change the type...
sql,sql-server-2012,data-type-conversion
You can use the internal system tables that store the metadata about the tables and columns to generate your ALTER TABLE statements. SELECT 'ALTER TABLE ' + OBJECT_NAME(c.object_id) + ' ALTER COLUMN ' + c.name + ' DECIMAL(30,10);' AS sqlCommand FROM sys.columns AS c INNER JOIN sys.types AS t ON...
sql-server,data-type-conversion,sqldatatypes,dbml
From the MSDN reference http://msdn.microsoft.com/en-us/library/ms177603.aspx, for bit on MSSQL "The string values TRUE and FALSE can be converted to bit values: TRUE is converted to 1 and FALSE is converted to 0." Going by that logic, I would use boolean for your mapping. NOTE: This is a pretty commonly discussed...
c#,function,data-type-conversion
Yes, it is called generics: public T GetValue<T>(Object value) { if (value == DbNull.Value) { return default(T); } return (T)value; } Then call it like this: string s = GetValue<string>(DataRow["CustomerName"]); Or, as Tim Schmelter suggested, in this case you could use: DataRow.Field<string>("CustomerName"); ...
python,csv,numpy,data-type-conversion
Your date format is incorrect, it needs to be year,month and day "%Y%m%d", you also cannot have a datetime object and floats in your array but using a structured array allows you to have mixed types. If mdates returns a float using the correct format should work again providing you...
type-conversion,data-type-conversion,julia-lang,julia-jump
The problem is that the second @defVar(m, 0 <= x <= 1, Bin) actually creates a new variable in the model, but with the same name in Julia. There currently isn't a good way to change a variable from continuous to binary, but you can do setLower(x, 0.0) setUpper(x, 1.0)...
postgresql,timestamp,data-type-conversion
Try this: update mytable set last_updated_att='today'::timestamp+last_updated_at from mytable; ...
plsql,sql-update,data-type-conversion,varray
Initialize v_initial to 1 instead of 0. Varray indexes start at one. Also, here's another technique for committing every X records you may want to consider for simplicity: commit_count_const CONSTANT number := 5000; -- commit every 5000 v_loop_counter := 0 ... FOR i in... UPDATE... v_loop_counter := v_loop_counter + 1;...
java,sql-server,jdbc,types,data-type-conversion
You can call getBoolean directly and let it take care of all the casting/coverting: result.add(rs.getBoolean("columnName")); ...
r,variables,numeric,data-type-conversion,recode
First, here's why you would have to convert to character before converting to numeric: Lets say we have a factor that contains a handful of numbers x = factor(c(1,2,7,7)) you can inspect how this is represented in R like so: unclass(x) #> [1] 1 2 3 3 #> attr(,"levels") #>...
javascript,data-type-conversion
Expected results When you are adding two arrays, everything works as expected: [] + []//output'' Converting [] to a primitive first tries valueOf() which returns the array itself (this): var arr = []; arr.valueOf() === arr true As that result is not a primitive, toString() is called next and returns...
scheme,racket,data-type-conversion
It's a list of symbols (not strings). It's the same as this: (list 'ace 'spade 'king 'queen) For more details please check the documentation. Notice that a list of strings would look like this: '("ace" "spade" "king" "queen") Or equivalently: (list "ace" "spade" "king" "queen") ...
c#,datetime,format,data-type-conversion
If you assume that all the letters inserted in your format are either separators or letters that should be converted to a DatePart, you can check if after converting the date you still have non separator chars that were not converted, as follows: public static class DateTimeExtension { public static...
javascript,variables,data-type-conversion
In Javascript (and most other languages), you write a string by putting a sequence of characters between a pair of quote characters. So a string containing abc is written as "abc" If you want one of the characters in the string to be a quote character, you have to escape...
c#,ms-access,data-type-conversion
Your issue appears to be a limitation of the Access ODBC driver when dealing with Currency fields using System.Data.Odbc in .NET. An OdbcDataReader will return those fields as System.Decimal (if the value is not NULL), but System.Data.Odbc apparently won't accept a System.Decimal parameter for a Currency field. As a workaround...
c#,datagridview,datatable,data-type-conversion,sqlcommand
The following line will give an error if the database field is an "int": command.Parameters.AddWithValue("@DWFieldScale", "DWFieldScale"); It will give an error because you are passing as value to the field a string "DWFieldScale". The idea behind the command.Parameters is the control to make any conversion required for you. See this:...
c,arduino,data-type-conversion
Convert the String into a char array first: size_t len = myString.length(); char buf[len+1]; // +1 for the trailing zero terminator myString.toCharArray(buf, len); and then you can pass buf: bool ok = network.write(header,buf,strlen(buf)); ...
nginx,elasticsearch,logstash,data-type-conversion
You're on the right track with (?:%{NUMBER:bytes:long}|-), but "long" isn't a valid data type. Quoting the grok documentation (emphasis mine): Optionally you can add a data type conversion to your grok pattern. By default all semantics are saved as strings. If you wish to convert a semantic’s data type, for...