Search Results

Search found 3141 results on 126 pages for 'zero'.

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

  • Terminology: opposite of "zero copy"?

    - by Mark Harrison
    We're benchmarking some code that we've converted to use sendfile(), the linux zero-copy system call. What's the term for the traditional read()/write() loop that sendfile() replaces? I.e., in our report I want to say "zerocopy is X millisecs, and ??? is Y millisecs." What word/phrase should I use?

    Read the article

  • Why is FLT_MIN equal to zero?

    - by Nick Forge
    limits.h specifies limits for non-floating point math types, e.g. INT_MIN and INT_MAX. These values are the most negative and most positive values that you can represent using an int. In float.h, there are definitions for FLT_MIN and FLT_MAX. FLT_MAX is equal to a really large number, as you would expect, but why does FLT_MIN equal zero?

    Read the article

  • write system call to file desciptor ZERO

    - by shadyabhi
    int main ( ) { char C[] = "Hello World"; write(0,C,sizeof(C)); return 0; } In the above program, I am writing to File descriptor ZERO which I suppose by default is STDIN.. Then why I am I getting output at STDOUT? shadyabhi@shadyabhi-desktop:~$ ./a.out Hello Worldshadyabhi@shadyabhi-desktop:~$

    Read the article

  • Model a Zero or One to Many Relationship

    - by John
    How should I model a zero or one to a many relationship in the database? For example, a user record may or may not have a parent. So should my user table have a t_user.parent_id or should I have an associative table called t_user_hierarchy with the columns t_user_hierarchy.parent_id and t_user_hierarchy.user_id?

    Read the article

  • Django Include Aggregate Sums of Zero

    - by tomas
    I'm working on a Django timesheet application and am having trouble figuring out how to include aggregate sums that equal zero. If I do something like: entries = TimeEntry.objects.all().values("user__username").annotate(Sum("hours")) I get all users that have time entries and their sums. [{'username': u'bob' 'hours__sum':49}, {'username': u'jane' 'hours__sum':10}] When I filter that by a given day: filtered_entries = entries.filter(date="2010-05-17") Anyone who didn't enter time for that day is excluded. Is there a way to include those users who's sums are 0? Thanks

    Read the article

  • Top 10 unless count is zero

    - by datatoo
    This is probably easy, but eludes me. SQL server2005 I want to show top 100 but if there are not 100 only want to show those and not include zero counts in the result SELECT TOP (100) UserName, FullName_Company, FullName, (SELECT COUNT(*) FROM dbo.Member_Ref WHERE (RefFrom_UserName = dbo.view_Members.UserName) AND (RefDate >= '5/1/2010') AND (RefDate <= '6/1/2010')) AS RefFromCount FROM dbo.view_Members WHERE (MemberStatus = N'Active') ORDER BY RefFromCount DESC I have tried using Group By and HAVING COUNT(*)0 all with the same wrong results

    Read the article

  • Silverlight - round doubles away from zero

    - by Cornel
    In Silverlight the Math.Round() method does not contain an overload with 'MidpointRounding' parameter. What is the best approach to round a double away from zero in Silverlight in this case? Example: Math.Round(1.4) = 1 Math.Round(1.5) = 2 Math.Round(1.6) = 2

    Read the article

  • Remove leading zero's from alphanumeic text

    - by cedar715
    I've seen questions to prefix zeros here in SO. But not the other way !! Can you guys suggest me how to remove the leading zeros in alphanumeric text. Are there any built-in APIs or do I need to write a method to trim the leading zero's? Example: 01234 converts to 1234 0001234a converts to 1234a 001234-a converts to 1234-a 101234 remains as 101234 2509398 remains as 2509398 123z remains as 123z 000002829839 converts to 2829839

    Read the article

  • Parameter becoming zero somewhere

    - by Nick
    Hey guys, Something really weird is happening: when I call foo(100*1.0f), somewhere along the line that becomes 0. To verify I put a breakpoint on foo(), and it indeed is zero and it indeed gets called with 100*1.0f. The code is in Obj-C++. Here is the calling function in XCode's GDB frontend, as you can see, score*scoreMultiplier is 100. And here is the called function in XCode's GDB frontend, here _score is 0.

    Read the article

  • Numpy zero rank array indexing/broadcasting

    - by Lemming
    I'm trying to write a function that supports broadcasting and is fast at the same time. However, numpy's zero-rank arrays are causing trouble as usual. I couldn't find anything useful on google, or by searching here. So, I'm asking you. How should I implement broadcasting efficiently and handle zero-rank arrays at the same time? This whole post became larger than anticipated, sorry. Details: To clarify what I'm talking about I'll give a simple example: Say I want to implement a Heaviside step-function. I.e. a function that acts on the real axis, which is 0 on the negative side, 1 on the positive side, and from case to case either 0, 0.5, or 1 at the point 0. Implementation Masking The most efficient way I found so far is the following. It uses boolean arrays as masks to assign the correct values to the corresponding slots in the output vector. from numpy import * def step_mask(x, limit=+1): """Heaviside step-function. y = 0 if x < 0 y = 1 if x > 0 See below for x == 0. Arguments: x Evaluate the function at these points. limit Which limit at x == 0? limit > 0: y = 1 limit == 0: y = 0.5 limit < 0: y = 0 Return: The values corresponding to x. """ b = broadcast(x, limit) out = zeros(b.shape) out[x>0] = 1 mask = (limit > 0) & (x == 0) out[mask] = 1 mask = (limit == 0) & (x == 0) out[mask] = 0.5 mask = (limit < 0) & (x == 0) out[mask] = 0 return out List Comprehension The following-the-numpy-docs way is to use a list comprehension on the flat iterator of the broadcast object. However, list comprehensions become absolutely unreadable for such complicated functions. def step_comprehension(x, limit=+1): b = broadcast(x, limit) out = empty(b.shape) out.flat = [ ( 1 if x_ > 0 else ( 0 if x_ < 0 else ( 1 if l_ > 0 else ( 0.5 if l_ ==0 else ( 0 ))))) for x_, l_ in b ] return out For Loop And finally, the most naive way is a for loop. It's probably the most readable option. However, Python for-loops are anything but fast. And hence, a really bad idea in numerics. def step_for(x, limit=+1): b = broadcast(x, limit) out = empty(b.shape) for i, (x_, l_) in enumerate(b): if x_ > 0: out[i] = 1 elif x_ < 0: out[i] = 0 elif l_ > 0: out[i] = 1 elif l_ < 0: out[i] = 0 else: out[i] = 0.5 return out Test First of all a brief test to see if the output is correct. >>> x = array([-1, -0.1, 0, 0.1, 1]) >>> step_mask(x, +1) array([ 0., 0., 1., 1., 1.]) >>> step_mask(x, 0) array([ 0. , 0. , 0.5, 1. , 1. ]) >>> step_mask(x, -1) array([ 0., 0., 0., 1., 1.]) It is correct, and the other two functions give the same output. Performance How about efficiency? These are the timings: In [45]: xl = linspace(-2, 2, 500001) In [46]: %timeit step_mask(xl) 10 loops, best of 3: 19.5 ms per loop In [47]: %timeit step_comprehension(xl) 1 loops, best of 3: 1.17 s per loop In [48]: %timeit step_for(xl) 1 loops, best of 3: 1.15 s per loop The masked version performs best as expected. However, I'm surprised that the comprehension is on the same level as the for loop. Zero Rank Arrays But, 0-rank arrays pose a problem. Sometimes you want to use a function scalar input. And preferably not have to worry about wrapping all scalars in at least 1-D arrays. >>> step_mask(1) Traceback (most recent call last): File "<ipython-input-50-91c06aa4487b>", line 1, in <module> step_mask(1) File "script.py", line 22, in step_mask out[x>0] = 1 IndexError: 0-d arrays can't be indexed. >>> step_for(1) Traceback (most recent call last): File "<ipython-input-51-4e0de4fcb197>", line 1, in <module> step_for(1) File "script.py", line 55, in step_for out[i] = 1 IndexError: 0-d arrays can't be indexed. >>> step_comprehension(1) array(1.0) Only the list comprehension can handle 0-rank arrays. The other two versions would need special case handling for 0-rank arrays. Numpy gets a bit messy when you want to use the same code for arrays and scalars. However, I really like to have functions that work on as arbitrary input as possible. Who knows which parameters I'll want to iterate over at some point. Question: What is the best way to implement a function as the one above? Is there a way to avoid if scalar then like special cases? I'm not looking for a built-in Heaviside. It's just a simplified example. In my code the above pattern appears in many places to make parameter iteration as simple as possible without littering the client code with for loops or comprehensions. Furthermore, I'm aware of Cython, or weave & Co., or implementation directly in C. However, the performance of the masked version above is sufficient for the moment. And for the moment I would like to keep things as simple as possible.

    Read the article

  • Using Oracle Zero Date

    - by Noam
    I have an application with existing data, that has Zero in the date column. When I look at it from sqlplus I see: 00-DECEMB when I use the dump function on this column, I Get: Typ=12 Len=7: 100,100,0,0,1,1,1 I need to work with the existing data from .Net (no changes to the data,or the data structure or even existing sql statements) How the hack do I read this value, or write it. The db version varies, from 8 to 11. Help would be appreciated

    Read the article

  • java.util.Random zero argument enquiry

    - by deerb
    I am trying to code a game following instructions contained in an OU TMA document which read: In the constructor, write code to assign a new instance of Random to ran which you should create using the Random class's zero argument constructor Will this code work? Random ran = new Random(0) ; I am a relative newbie to Java, and I don't understand exactly what the instructions mean

    Read the article

  • T-SQL 2005 - Divide by zero error encountered

    - by Grant
    Hi, I am trying to get some percentage data from a stored procedure using code similar to the line below. Obviously this is going to cause a (Divide by zero error encountered) problem when base.[XXX_DataSetB] returns 0 which may happen some of the time. Does anyone know how i can deal with this in the most efficient manner? Note: There would be about 20+ lines looking like the one below... cast((base.[XXX_DataSetB] - base.[XXX_DataSetA]) as decimal) / base.[XXX_DataSetB] as [XXX_Percentage]

    Read the article

  • Newline-separated xargs

    - by porneL
    Is it possible to make xargs use only newline as separator? (in bash on Linux and OS X if that matters) I know -0 can be used, but it's PITA as not every command supports NUL-delimited output.

    Read the article

  • dataset tables row count 'zero'

    - by James123
    I am using dataadapter.Fill() into dataset. But dataset returning tables rows count zero (0). When I ran same sp in sql mgmt. It is returning two tables data. If attributeId = 1 Then spString = "USP_group_1" ElseIf attributeId = 2 Then spString = "USP_group_2" ElseIf attributeId = 3 Then spString = "USP_group_3" End If sqlcmd_q.CommandTimeout = 120 sqlcmd_q.Connection = sqlCnn sqlcmd_q.CommandText = spString sqlcmd_q.CommandType = CommandType.StoredProcedure sqlcmd_q.Parameters.AddWithValue("@client_id", clientId) Try sqlCnn.Open() Dim daGrid As New SqlDataAdapter(sqlcmd_q) daGrid.Fill(dsGrid) daGrid.Dispose() Return dsGrid I don't understand why this happening?

    Read the article

  • Apple Push notifications server - Feedback always returns zero tuples

    - by Franz
    Hi, I am developing an iPhone App that uses Apple Push Notifications. On the iPhone side everything is fine, on the server side I have a problem. Notifications are sent correctly however when I try to query the feedback service to obtain a list of devices from which the App has been uninstalled, I always get zero results. I know that I should obtain one result as the App has been uninstalled from one of my test devices. After 24 hours and more I still have no results from the feedback service.. Any ideas? Does anybody know how long it takes for the feedback service to recognize that my App has been uninstalled from my test device? Could it be due to the sandbox environment?

    Read the article

  • Graphics.FromHwnd(IntPtr.Zero) returns null, why?

    - by Martin Moser
    I'm currently investigating a problem with a 3rd party component (DevExpress) in my application. My issue is quite similar to this one DevExpress KB article. I get the same exception with more less the same stacktrace. So I used .NET Reflector to find out, what may be null in this scenario, and the only object which is a candiate to be null is Graphics. This is created with Graphics.FromHwnd(IntPtr.Zero). Because I don't have a broad knowledge about GDI, I would like to know if somebody can tell me possible scenarios when this may return null... I tried to reproduce it in a scenario where windows is out of GDI handle's, but then I'm getting a "out of handles" - exception at least once, which is not the case in the issue I'm investigating tia, Martin

    Read the article

  • ERRNO: 2 Division by zero error

    - by chupinette
    I am getting this error : ERRNO: 2 TEXT: Division by zero I have the following function in my class Customer public static function GetQuotationDetails($string) { $sql = 'SELECT I.name, I.discounted_price, I.other_name FROM item I WHERE ( I.name LIKE CONCAT( '%', :string, '%' )) AND T.item_name=:string'; $parameters = array(':string' => $string); DB::GetAll($sql,$parameters); } Then, $this->results = Customer::GetQuotationDetails('grinder'); and i echo the results by echo $obj_quotations->results; Can anyone help me?

    Read the article

  • How can I compact the VHD file with Ubuntu?

    - by AmShegar
    I use windows server 2008r2 with role Hyper-V. The guest system is Ubuntu 12.04 LTC. It is situated on the dynamic virtual hard disk. I want to compact this VHD (The real size is 50 GB, 360 GB on the disk). But I can not do this, because the Ubuntu file system is not NTFS. What do I need (gparted, sdelete, ...) for solving this problem? The main problem is that the filesystem is not NTFS, but ext4.

    Read the article

  • Decimal data Type Display scale part as zero

    - by Wael Dalloul
    I have Decimal field in SQLserver 2005 table, Price decimal(18, 4) if I write 12 it will be converted to 12.0000, if I write 12.33 it will be converted into 12.3300. Always it's putting zero to the right of the decimal point in the count of Scale Part(4). I was using these in SQL Server 2000, it was not behaving like this, in SQL Server 2000 if I put 12.5 it will be stored as 12.5 not as 12.5000 what SQLServer2005 do. My Question is how to stop SQL Server 2005 from putting zeros to the right of the decimal point?

    Read the article

  • Desimal data Type Display scale part as zero

    - by Wael Dalloul
    I have Decimal field in SQLserver 2005 table, Price decimal(18, 4) if I write 12 it will be converted to 12.0000, if I write 12.33 it will be converted into 12.3300. Always it's putting zero to the right of the decimal point in the count of Scale Part(4). I was using these in SQL Server 2000, it was not behaving like this, in SQL Server 2000 if I put 12.5 it will be stored as 12.5 not as 12.5000 what SQLServer2005 do. My Question is how to stop SQL Server 2005 from putting zeros to the right of the decimal point?

    Read the article

  • Regex expression with leading zero

    - by user1874087
    I'm rather new to regex expressions and need help with a simple expression. I'm using Pentaho for ETL (Replace in String transformation) and I have column values that I need to add leading zeros to and parse out text as part of the database import. So far I have been unable to add the leading zero. The column is called Region and the values are "region 8", "region 10", "region 11". My regex expression is ['Region'] which will eliminate the region text but produces results = "8", "10", "11". I need values to produce "08", "10", "11". So all the single digit numbers must have leading zeros.

    Read the article

  • MySQL - Join as zero if record Not IN

    - by Zurahn
    To explain by example, take two tables, A and B Table A id foo 1 x 2 y 3 z Table B id aid bar 1 3 50 2 1 100 An example join SELECT foo, bar FROM a, b WHERE a.id = b.aid; Garners a result of foo bar z 50 x 100 What I would like to do is get all values of foo and for any instances where there isn't a corresponding bar value, return 0 for that column. My best guess was something along the lines of SELECT foo, bar AS br FROM a, b WHERE a.id = b.aid OR a.id NOT IN (SELECT aid FROM b); But that returns duplicates and non-zero values for bar. Possible?

    Read the article

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