zero

php read start from zero number case

Hi All, May you can help me... many years ago my friend gave me php script code presented below, now i want to change it can read numbering start from zero existing just possible read 1:1, 10:200 etc.. but i want to make also possible read from 01:01, 0000002:0120 etc... function is_valid_number($sesuatu) { if(preg_match("/^([0-9]+)$...

MYSQL: returning zero when no value is present, categorized monthly

I have the following two tables that record expenditure and provide expenditure category information: Table transactions: +-------+--------+--------+ | month | cat_id | amount | +-------+--------+--------+ | 1 | 2 | 3 | | 1 | 2 | 8 | | 2 | 1 | 7 | | 2 | 1 | 5 | +-------+--------+-...

Get rid of leading zeros for date strings in Python?

Is there a nimble way to get rid of leading zeros for date strings in Python? In the example below I'd like to get 12/1/2009 in return instead of 12/01/2009. I guess I could use regular expressions. But to me that seems like overkill. Is there a better solution? >>> time.strftime('%m/%d/%Y',time.strptime('12/1/2009', '%m/%d/%Y')) '12/0...

How to ignore first entered character to be zero in a textbox with jQuery

Hi, Basically, I do not want the user to enter '0' (zero) as the first character in a textbox which represents data with type of integer? I would like to bind an event handler to handle this with jQuery. Any experience? Thanks, ...

Why does my Perl program print the help message when an arguments has 0 as a value?

If i do this: GetOptions( 'u=s' => \$in_username, 'r=i' => \$in_readonly, 'b=i' => \$in_backup ); exit usage() unless $in_username && $in_readonly && $in_backup; and call the program like this: ./app.pl -u david -r 12 -b 0 it always results in calling usage(), so obviously the 0 is not seen as an integer value...

How to add a trailing zero to a price with jQuery

So I have a script which returns a price for a product. However the price may or may not include trailing zeros so sometimes I might have: 258.22 and other times I might have 258.2 In the later case I need to add the trailing zero with jQuery. How would I go about doing this? ...

SQL: How do I return zeroes where there is nothing to aggregate across?

Hi What I would like ask is best illustrated by an example, so bear with me. Suppose I have the following table: TypeID Gender Count 1 M 10 1 F 3 1 F 6 3 M 11 3 M 8 I would like to aggregate this for every possible combination of TypeID and Gender...

Remove leading zeros from abbreviated date with PHP

Hello, I was wondering if there is a way, using PHP, to change this date format: 01.08.86 (January 8, 1986) to this format: 1.8.86. ...

Fastest way to zero out a 2d array in C?

I want to repeatedly zero a large 2d array in C. This is what I do at the moment: for(j = 0; j < n; j++) { for(i = 0; i < n; i++) { array[i][j] = 0; } } I've tried using memset: memset(array, 0, sizeof(array)) But this only works for 1D arrays. When I printf the contents of the 2D array, the first row is zeroe...

[C++] Initializing Primitive Array to One Value

Is there a way to initialize an array of primitives, say a integer array, to 0? Without using a for loop? Looking for concise code that doesn't involve a for loop. :) ...

Changing a SUM returned NULL to zero

I have a Stored Procedure as follows: CREATE PROC [dbo].[Incidents] (@SiteName varchar(200)) AS SELECT ( SELECT SUM(i.Logged) FROM tbl_Sites s INNER JOIN tbl_Incidents i ON s.Location = i.Location WHERE s.Sites = @SiteName AND i.[month] = DATEADD(mm, DATEDIFF(mm, 0, GetDate()) -1,0) GROUP BY s.Site...

Cuda program results are always zero in HW, correct in EMU??

Hi all! I am having a weird problem .. I have written a CUDA code which executes correctly in emulation and all results show up.. however, when executed on hardware "G210" .. the results in the result memory are always 0 I am passing two vectors to the kernel, one with random variables the other is initialized to zero, the code copies ...

Change nil's to zeroes in elisp

Hi all I'd like to ask - what is the function doing nil conversion from nil's to zeroes in elisp? I'm a newbie and I think I am inventing the wheel with my code: (defun chgnull (x) (if (null x) 0 1)) (mapcar 'chgnull '(1 2 nil)) Search through Emacs sources by keyword "to zero" and such haven't shown anything relevant. ...

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

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 ret...

PHP: Check if 0?

Hi, I am using a class which returns me the value of a particular row and cell of an excel spreadsheet. To build up an array of one column I am counting the rows and then looping through that number with a for() loop and then using the $array[] = $value to set the incrementing array object's value. This works great if none of the value...

Zero division does not throw exception in nunit

Running the following C# code through NUnit yields Test.ControllerTest.TestSanity: Expected: `<System.DivideByZeroException>` But was: null So either no DivideByZeroException is thrown, or NUnit does not catch it. Similar to this question, but the answers he got, do not seem to work for me. This is using NUnit 2.5.5.10112, and .NET ...

How to "zero" a file with 1's

I'll often create a file of a particular size with a trick like dd if=/dev/zero of=1gb.dd bs=1M count=1024 or perhaps even dd if=/dev/urandom of=1gb.dd bs=1M count=1024 dd if=/dev/random of=1gb.dd bs=1M count=1024 But what if I want to get all 1's instead of 0's or random? ...

Does anyone actually have the facebook graph insights api working today?

I went through all the oauth setup, authorized my app, got a token, but when I try to pull insights data for any page, the values are all zeros, see this thread others are having same problem: http://forum.developers.facebook.com/viewtopic.php?pid=239754#p239754 Im just wondering if its a code problem or a problem with facebook? If you...

Can an MD5-hash begin with a zero?

Can an MD5-hash begin with a zero? What about SHA-1? ...

SSAS - Always show zeros - NOT blanks

Hi, I have a cube that I access via Targit (BI Solution). When I browse / use that cube I want all quantity results to be a zero if null / blank NOT a blank, but no matter what I try I get blanks. I have changed the Null Processing property for the measure in question as well as attempted to change / remove the format string. I still...