Search Results

Search found 732 results on 30 pages for 'trailing zeros'.

Page 4/30 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Javascript to remove trailing &nbsp;

    - by ria
    I am getting a string which is nothing but innerHTML, and so it has instances of &nbsp;. I need to trim the string such that the trailing &nbsp; alone are removed. Tried this: var text; text = txtInnerHTML.replace(/(&nbsp;)*/g,""); This removes all instances of &nbsp; which is not desired.. Only the trailing &nbsp; need to be removed.

    Read the article

  • adding zeros in objective-c string formats

    - by Chris
    Hello- Quick question: I am trying to fill in empty spaces with a specific number of zeroes in an NSString stringWithFormat formatting string. For example, I want: @"The number is %d", 5 // I want this to output 'the number is 05' @"the number is %d", 10 // I want this to output 'the number is 10' I know how to do this in Java, but I cant seem to find the same function in objective-c. Any help would be great.

    Read the article

  • casting void* to float* creates only zeros

    - by Paperflyer
    I am reading an audio file using CoreAudio (Extended Audio File Read Services). The audio data gets converted to 4-byte float and handed to me as a void* buffer. It can be played with Audio Queue Services, so its content is correct. Next, I want to draw a waveform and thus need access to the actual samples. So, I cast void* audioData to float*: Float32 *floatData = (Float32 *)audioData; When accessing this data however, I only get 0.0 regardless of the index. Float32 value = floatData[index]; // Is always zero for any index Am I doing something wrong with the cast?

    Read the article

  • Format string, integer with leading zeros

    - by ghiboz
    Hi all! I Use this code: NSString* strName = [NSString stringWithFormat:@"img_00%d.jpg", pp]; and works fine, but if pp took the value of 10 for example I wish have img_010.jpg as result, and not img_0010.jpg... how can I format the string?? thanks

    Read the article

  • How to efficiently compare the sign of two floating-point values while handling negative zeros

    - by François Beaune
    Given two floating-point numbers, I'm looking for an efficient way to check if they have the same sign, given that if any of the two values is zero (+0.0 or -0.0), they should be considered to have the same sign. For instance, SameSign(1.0, 2.0) should return true SameSign(-1.0, -2.0) should return true SameSign(-1.0, 2.0) should return false SameSign(0.0, 1.0) should return true SameSign(0.0, -1.0) should return true SameSign(-0.0, 1.0) should return true SameSign(-0.0, -1.0) should return true A naive but correct implementation of SameSign in C++ would be: bool SameSign(float a, float b) { if (fabs(a) == 0.0f || fabs(b) == 0.0f) return true; return (a >= 0.0f) == (b >= 0.0f); } Assuming the IEEE floating-point model, here's a variant of SameSign that compiles to branchless code (at least with with Visual C++ 2008): bool SameSign(float a, float b) { int ia = binary_cast<int>(a); int ib = binary_cast<int>(b); int az = (ia & 0x7FFFFFFF) == 0; int bz = (ib & 0x7FFFFFFF) == 0; int ab = (ia ^ ib) >= 0; return (az | bz | ab) != 0; } with binary_cast defined as follow: template <typename Target, typename Source> inline Target binary_cast(Source s) { union { Source m_source; Target m_target; } u; u.m_source = s; return u.m_target; } I'm looking for two things: A faster, more efficient implementation of SameSign, using bit tricks, FPU tricks or even SSE intrinsics. An efficient extension of SameSign to three values.

    Read the article

  • Cron expressions: leading zeros ok?

    - by JimBurnell
    A quartz-scheduled process did not kick off last evening. The only thing that looks like it MIGHT be off is that, in one entry: 0 00 23 13,15 APR ? The "minutes" field is specified as a 2-digit 00 rather than a single-digit 0. I can't find any definitive cron documentation saying whether or not this would cause a problem. I can't test it again until the off-hours. Anyone know for sure if this could be a problem? if so, it's rather a silly one.

    Read the article

  • Import a number of csv files and replace NA by Zeros

    - by tao.hong
    I know how to do this individually. However, I have more than 1000 files. I decided to use a for loop. However, it seems like I did not find the correct way to evaluate my variables. Here is my code setwd('C:/data') filenames=dir() #find file names for (i in filenames){ adt = substr(x = i, start = 1, stop = nchar(i)-4) name=paste("data_", adt, sep="") assign(name, read.csv(i,header=T,sep=",")) #read each file and assign a variable name starting with data_ to it func=paste('name[is.na(name)] <- 0',sep="") # here is the place I have problem. R will not consider name is a parameter whose values change in each iteration eval((text=func)) }

    Read the article

  • MIN array function non zeros only

    - by user1717622
    I have been trying to get this array function to output (non-zero) minimum values in the 'FINAL DATA' AE column. Can you see a structural error in this formula? =IF($C$4="All EMEA", MIN(IF('FINAL DATA'!$2:$AE$250000<>0, ('FINAL DATA'!$J$2:$J$250000=$C$4)*('FINAL DATA'!$E$2:$E$250000=$E$4)*( 'FINAL DATA'!$AE$2:$AE$250000))), MIN(IF('FINAL DATA'!$AE$2:$AE$250000<>0, ('FINAL DATA'!$K$2:$K$250000=$C$4)*('FINAL DATA'!$E$2:$E$250000=$E$4)*( 'FINAL DATA'!$AE$2:$AE$250000))) )

    Read the article

  • MySQL: NOW() giving me zeros

    - by Tunji Gbadamosi
    I have a table which I want to record the timestamp of every order at every insertion time. However, I'm getting zero values for the timestamps. Here's my schema: CREATE TABLE IF NOT EXISTS orders( order_no VARCHAR(16) NOT NULL, volunteer_id VARCHAR(16) NOT NULL, date TIMESTAMP DEFAULT NOW(), PRIMARY KEY (order_no), FOREIGN KEY (volunteer_id) REFERENCES volunteer(id) ON UPDATE CASCADE ON DELETE CASCADE)

    Read the article

  • Adding zeros when length is less

    - by David
    Is there a smart way to convert numbers to string and automatically add zeroes so the length is the same as the maximum? like this: for (var i=0; i<30; i++) { var c = i.toString(); if (c.length == 1) { c = '0'+=c; } } But smarter

    Read the article

  • Find largest rectangle containing only zeros in an N&times;N binary matrix

    - by Rajendra
    Given an NxN binary matrix (containing only 0's or 1's), how can we go about finding largest rectangle containing all 0's? Example: I 0 0 0 0 1 0 0 0 1 0 0 1 II->0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 <--IV 0 0 1 0 0 0 IV is a 6×6 binary matrix; the return value in this case will be Cell 1: (2, 1) and Cell 2: (4, 4). The resulting sub-matrix can be square or rectangular. The return value can also be the size of the largest sub-matrix of all 0's, in this example 3 × 4.

    Read the article

  • Spring Annotation trailing slash

    - by Eqbal
    I have a controller with @RequestMapping for root path "/". There are other controllers with say a @RequestMapping of "/test" etc. My application seems to be mapping correctly for paths like /appname/test, but if I add a trailing slash to the path, like so "/appname/test/ then it maps to the controller that has the @RequestMapping for root path "/". Any idea why?

    Read the article

  • Missing trailing / for admin page edits in django-cms

    - by 47
    I've managed to set up Django CMS for my website successfully...however, when editing a page in the admin, the trailing / isn't added automatically so my URL's look something like: http://localhost:8000/admin/cms/page/22 When I tried running the example project that comes bundled with the Django-CMS setup, this slash is added automatically....how can I have the same for my project?

    Read the article

  • Inserting Strings Without Trailing Spaces SQL

    - by Soo
    I have a database with a field named Field1 that has 100 nchars per entry. Each time I add a value, it is stored as: "value (100-ValueLength Spaces) " So Basically each stored value has a string of spaces after it. This is getting to be an issue when I try doing: if (value == "Example") because of all of the empty spaces after the string. How can I get it so the stored values don't have all of these trailing spaces?

    Read the article

  • Redirects in Glassfish (adding trailing slash)

    - by echox
    Is it possible to add a trailing slash to the default context of an application? Example: http://www.uri.com/foo -> http://www.uri.com/foo/ I added the following redirect to the server properties: redirect_1: from=/foo url-prefix=/foo/ and this ends up in a loop... Several other configurations also didn't work :-/ I'm using glassfish v2.1-b60e.

    Read the article

  • Remove trailing letters at the end of string

    - by wang
    I have some strings like below: ffffffffcfdeee^dddcdeffffffffdddcecffffc^cbcb^cb`cdaba`eeeeeefeba[NNZZcccYccaccBBBBBBBBBBBBBBBBBBBBBB eedeedffcc^bb^bccccbadddba^cc^e`eeedddda`deca_^^\```a```^b^`I^aa^bb^`_b\a^b```Y_\`b^`aba`cM[SS\ZY^BBB Each string MAY (or may not) end with a stretch of trailing "B" of varied length. I'm just wondering if we can simply use bash code to remove the "B" stretch? thx

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >