Search Results

Search found 11153 results on 447 pages for 'count zero'.

Page 12/447 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Doing a count over a filter query efficiently in django

    - by apple_pie
    Hello, Django newbie here, I need to do a count over a certain filter in a django model. If I do it like so: my_model.objects.filter(...).count() I'm guessing it does the SQL query that retrieves all the rows and only afterwards does the count. To my knowledge it's much more efficient to do the count without retrieving those rows like so "SELECT COUNT(*) FROM ...". Is there a way to do so in django?

    Read the article

  • Why is address zero used for null pointer?

    - by Joel
    In C (or C++ for that matter), pointers are special if they have the value zero: I am adviced to set pointers to zero after freeing their memory, because it means freeing the pointer again isn't dangerous; when I call malloc it returns a pointer with the value zero if it can't get me memory; I use if (p != 0) all the time to make sure passed pointers are valid etc. But since memory addressing starts at 0, isn't 0 just as a valid address as any other? How can 0 be used for handling null pointers if that is the case? Why isn't a negative number null instead?

    Read the article

  • if non zero elements in same column count only once

    - by George
    I want to check the elements above the main diagonal and if I found non zero values , count one. If the non zero values are found in the same column ,then count just one ,not the number of the non zero values. For example , it should be count = 2 and not 3 in this example because 12 and 6 are in the same column. A= 1 11 12 4 5 6 0 7 0 #include <stdio.h> #include <stdlib.h> #include <math.h> int main( int argc, const char* argv[] ){ int Rows = 3 , Cols = 3; float *A = (float *) malloc ( Rows * Cols * sizeof (float) ); A[0] = 1.0; A[1] = 11.0; A[2] = 12.0; A[3] = 4.0; A[4] = 5.0; A[5] = 6.0; A[6] = 0.0; A[7] = 7.0; A[8] = 0.0; // print input matrix printf("\n Input matrix \n\n"); for ( int i = 0; i < Rows; i++ ) for ( int j = 0; j < Cols; j++ ) { printf("%f\t",A[ i * Cols + j ]); if( j == Cols-1 ) printf("\n"); } printf("\n"); int count = 0; for ( int j = 0 ; j < Cols; j++ ) { for ( int i = ( Rows - 1 ); i >= 0; i-- ) { // check the diagonal elements above the main diagonal if ( j > i ) { if ( ( A[ i * Cols + j ] != 0 ) ) { printf("\n Above nonzero Elmts = %f\n",( A[i * Cols + j] ) ); count++; } } } } printf("\ncount = %d\n",count ); return 0; }

    Read the article

  • MYSQL: COUNT with GROUP BY, LEFT JOIN and WHERE clause doesn't return zero values

    - by Paul Norman
    Hi guys, thanks in advance for any help on this topic! I'm sure this has a very simply answer, but I can't seem to find it (not sure what to search on!). A standard count / group by query may look like this: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` GROUP BY `t1`.`any_col` and this works as expected, returning 0 if no rows are found. So does: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` WHERE `t1`.`another_column` = 123 However: SELECT COUNT(`t2`.`name`) FROM `table_1` `t1` LEFT JOIN `table_2` `t2` ON `t1`.`key_id` = `t2`.`key_id` WHERE `t1`.`another_column` = 123 GROUP BY `t1`.`any_col` only works if there is at least one row in table_1 and fails miserably returning an empty result set if there are zero rows. I would really like this to return 0! Anyone enlighten me on this? Beer can be provided in exchange if you are in London ;-)

    Read the article

  • Do image backlinks count as backlinks?

    - by sam
    If i have lots of images appearing tumblr blogs, the sort of tumblogs with very little text just reams and reams of images for people to browse through (example - http://whereisthecool.com/). If my image is embeded in their site like this : <a href="http://mysite.com" target="blank"> <img src="cutecatblog.com/cat.jpg" alt="cute cat"/> </a> so the image was a link back to my site. Although there is no anchor text to speak of does google take into account the alt text of the image ? Would this still count in googles eyes as a backlink ?

    Read the article

  • USB file transfer preparing to copy, but file count climbs indefinitely

    - by Alex
    I have downloaded Ubuntu 12.04 to back up my Windows machine that won't boot and am running Ubuntu from the CD. I copied and pasted a volume of about 160GB to my external HDD. The transfer has been stuck in the "preparing to copy" stage for several hours and is displaying a file/GB count about twice as high as the volume of data actually being copied! The number is now larger than the entire partition that's being copied from! However I know it's doing something because occasionally it pops up with a minor I/O error on this or that file which I then have to click through. I've not had this problem before so I can only assume it's a Linux/Ubuntu thing. More importantly what I want to know is is there any other way to copy it across that will actually work?

    Read the article

  • Number of Classes in a Namespace - Code Smell?

    - by Tim Claason
    I have a C# library that's used by several executables. There's only a couple namespaces in the library, and I just noticed that one of the namespaces has quite a few classes in it. I've always avoided having too many classes in a single namespace because of categorization, and because subconsciously, I think it looks "prettier" to have a deeper hierarchy of namespaces. My question is: does anyone else consider it a "code smell" when a namespace has many classes - even if the classes relate to each other? Would you put in a lot of effort to find nuances in the classes that allows for subcategorization?

    Read the article

  • How to get multiple counts with one SQL query?

    - by Crobzilla
    I am wondering how to write this query. I know this actual syntax is bogus, but it will help you understand what I am wanting. I need it in this format, because it is part of a much bigger query. SELECT distributor_id, COUNT(*) AS TOTAL, COUNT(*) WHERE level = 'exec', COUNT(*) WHERE level = 'personal' I need this all returned in one query. Also, it need to be in one row, so the following won't work: 'SELECT distributor_id, COUNT(*) GROUP BY distributor_id'

    Read the article

  • TCP Zero Window with no corresponding Window Update

    - by Gandalf
    I am trying to debug a network issue and am using Wireshark and tcpdump to grab packets from my server. I have one client application that is grabbing all my available connections and then holding them, trying to send A LOT of data and essentially causing an unintentional DOS attack. While debugging I notice that I see my server sending "Window Closed" and "Zero Window" TCP packets - but never sending any "Window Update" packets. I am guessing this is why the client never lets go of the connections (it still has more data to send and is waiting). Has anyone ever seen this type of behavior before? Let's not get into the reasons why I haven't set up an iptables rule to limit concurrent connections (yeah I know). I also recently changed the MTU from 1500 to 9000 - could this have such a negative effect? (Linux) Thanks.

    Read the article

  • Data Recovery needed with a Sector Zero problem on a HDD

    - by Jay Robins
    Left my computer (running XP) copying files to an external drive. Came back a few hours later, and the laptop was pretty hot and had frozen (Ironic aint it). Forced a reboot, and the laptop HDD hasnt worked since. Set it up in an external enclosure, but XP cant mount the HDD to a drive letter, but is able to recognize the manufacturer and drive size (Hitachi-320GB). No noise or rattling when the drive is spinning, but I cant get anything off of it, since i cant mount it, or see much of anything. Computer repair shop ran some software tests and says it came back with a "Zero Sector bad" message, and need to send it to a professional data recovery service. Any other options or ideas, before I have to spend thousands of dollars to recover my data? Any help would be GREATLY appreciated!!! I'm desperate and a poor student! Thanks in Advance, -Jay

    Read the article

  • Need leading zero for batch script using %time% variable

    - by Ira
    Hi, I came across a bug in my DOS script that uses date and time data for file naming. The problem was I ended up with a gap because the time variable didn't automatically provide leading zero for hour < 10. So running echo %time% gives back: ' 9:29:17.88'. Does anyone know of a way to conditionally pad leading zeros to fix this? More info: My filename set command is: set logfile=C:\Temp\robolog_%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.log which ends up being: C:\Temp\robolog_20100602_ 93208.log (for 9:23 in the morning). This question is related to this one. Thanks

    Read the article

  • Convert RAID-0 to RAID-1 on HP ML350G6 with P410i zero memory

    - by JLe
    I have an HP ML350 G6 with a P410i zero memory RAID controller. As far as I can understand that means I can't expand a current single drive "RAID-0" configuration to a RAID-1 using the HP Offline ACU without installing memory and BBWC. Is that correct? What makes me think about this is the fact that expanding RAID-0 to RAID-1 should be pretty similar to replacing a failed drive in an already existing RAID-1? So then why can't I expand without memory and BBWC? Is my best option otherwise to (i) use Ghost to capture the disk, create a new RAID-1 with the existing drive and a new one or (ii) buy memory+BBWC and do it online? Thanks

    Read the article

  • mysql thread count

    - by Ryan M.
    We have a web application that uses apache and mysql. Generally (according to Munin) our MySQL thread count sits between 2 and 4 at all times. The other day, our server almost came to a halt. HTTP requests were slow or wouldn't go through at all, SSH would work, but would take 30+ seconds to register keystrokes, etc.. So we pull up Munin and the only thing that's out of normal boundaries is the Mysql thread count. CPU usage was under 1%, load was under 1.0, plenty of available RAM. As mentioned before, the thread count floats around 2 to 4. At the time of our slow downs it had spiked to 14. So I start poking around the Internet and I see that in most cases, you'll start to see a higher thread count when you start running into slow queries. If I understand it correctly, the request comes in that takes a while to process, in the mean time other requests are coming in, so a new thread will be created to work on the request (yes?). But at the time of the slow down, we had 0 slow queries. My question is: What else can cause mysql to create additional threads. And would this sudden spike in threads possibly cause the server to slow down? To fix the issue, we restarted apache and everything went back to it's beautiful, normal self. Considering the the Server Vitals (CPU, RAM, Network, etc) were all ideal, and the thread count was the only thing out of place, this seems like the most logical thing to pursue as the possible cause. If it matters, we're on Mysql 5.1.40. Server is FreeBSD 7.2 and the server in question is inside a jail.

    Read the article

  • Windows XP volume control spontaneously slides to zero

    - by Paul Dixon
    Was listening to a podcast in iTunes at my desk, left my desk briefly and as I sat down, the volume faded. If I scrolled the volume back up, using my keyboard or the volume tray icon, it would smoothly scroll back down again. I rebooted, same thing occurred. Figuring maybe I had a stuck keyboard or hitherto undiscovered mouse function, I unplugged each in turn. Volume still wanted to go to zero! Anyone know what might cause this? It's driving me nuts!

    Read the article

  • Using VLC to Unicast High Definition Webcam over local gigabit LAN with low/zero delay

    - by Robin Day
    We're setting up a webcam "window" between two offices in the same buildilng. The two PC's are connected to the same gigabit switch. We're using VLC to stream the webcam over HTTP using the following commands. vlc dshow:// :dshow-caching="0" :dshow-size="640x480" :sout=#transcode{vcodec=h264,vb=0,scale=0}:http{mux=ffmpeg{mux=flv},dst=:8080/} :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep vlc http://192.168.0.1:8080 :http-caching="0" Even with the caching set to zero, the delay in the image is a good 2-3 seconds. The CPU usage of each pc is also maxed. I'm guessing it's the transcoding that's causing much of the delay. Can anyone give me some changes to these command lines that will reduce the transcoding power, or send the webcam over a different protocol, or anything that will reduce the delay of the cameras? Bandwidth is not an issue at all as the pc's can be connected to a dedicated switch/vlan if required.

    Read the article

  • DB time always showing as zero in Rails development log timings

    - by Olly
    I've noticed that the Rails log correctly displays the time taken to execute an action in the logs, and that the View: part of that is also rendered correctly. However, the DB: value is always zero: Aug 11 13:00:22 [2326] INFO: Completed in 2072ms (View: 94, DB: 0) | 200 OK In fact, all my DB timings are being logged as zero. I'm logging at DEBUG level, in development mode, running Rails 2.3.2. Apologies in advance if the answer is blatantly obvious.

    Read the article

  • display unsigned zerofill autoincrement value without leading zero

    - by I Like PHP
    my primay key is user_id which is auto incremant UNSIGNED ZERO FILL, i want to display user_id on a page without leading Zero( means 1 instead of 0000000001 ).. how can we do that in php or in mysql one more question... if i delete last record( let user_id=21) wwhich have highest id of that table then can we adjust auto increment value to 21 instead of 22 of that table.

    Read the article

  • Separating positive values from 'zero' values in an XSLT for-each statement

    - by danielle
    I am traversing an XML file (that contains multiple tables) using XSLT. Part of the job of the page is to get the title of each table, and present that title with along with the number of items that table contains (i.e. "Problems (5)"). I am able to get the number of items, but I now need to separate the sections with 0 (zero) items in them, and put them at the bottom of the list of table titles. I'm having trouble with this because the other items with positive numbers need to be left in their original order/not sorted. Here is the code for the list of titles: <ul> <xsl:for-each select="n1:component/n1:structuredBody/n1:component/n1:section/n1:title"> <li style="list-style-type:none;"> <div style = "padding:3px"><a href="#{generate-id(.)}"> <xsl:variable name ="count" select ="count(../n1:entry)"/> <xsl:choose> <xsl:when test = "$count != 0"> <xsl:value-of select="."/> (<xsl:value-of select="$count"/>) </xsl:when> <xsl:otherwise> <div id = "zero"><xsl:value-of select="."/> (<xsl:value-of select="$count"/>)</div> </xsl:otherwise> </xsl:choose> </a> </div> </li> </xsl:for-each> </ul> Right now, the "zero" div just marks each link as gray. Any help regarding how to place the "zero" divs at the bottom of the list would be greatly appreciated. Thank you!

    Read the article

  • what does it mean to be "terminated by a zero"

    - by numerical25
    I am getting into C/C++ and alot of terms are popping up unfamiliar to me. one of them is a varible or pointer that is terminated by a zero. What does it mean for a space in memory to be terminated by a zero. I am not sure if I am saying it correctly, if not then please correct me. Thanks!

    Read the article

  • javascript search and replace prefix zero

    - by Bharanikumar
    Hi , i have few numbers like 0011,0101,0123,1234,5245,0052,3265,0047,0124 How replace prefix zero only, like no number should start with zero , exactly like 0011 should be 11 , 0101 should be 101 , 0123 should be 123 How to do this ? Is ther any javascript function there , Thanks

    Read the article

  • stack panel width and height to zero in .cs

    - by prince23
    hi , have an stack panel defined in my design page <StackPanel Width="973" x:Name="spmarks" > </StackPanel> now in .cs page i need to set the width and height of the stack panel to zero spmarks.ActualWidth ="0"; spmarks.ActualWidth ="0"; here i am getting error. how can i set width and height to zero now any solution on this would be great thank you

    Read the article

  • Python PLY zero or more occurrences of a parsing item

    - by None
    I am using Python with PLY to parse LISP-like S-Expressions and when parsing a function call there can be zero or more arguments. How can I put this into the yacc code. This is my function so far: def p_EXPR(p): '''EXPR : NUMBER | STRING | LPAREN funcname [EXPR] RPAREN''' if len(p) == 2: p[0] = p[1] else: p[0] = ("Call", p[2], p[3:-1]) I need to replace "[EXPR]" with something that allows zero or more EXPR's. How can I do this?

    Read the article

  • Count query with 3 coloumn iin SQL

    - by asher baig
    I have one database Library with table named called Medien. Having multiple columns named as Fname,Mname,Lname and ISBN. I want to calculate database records with ISBN and without ISBN? I have execute following command Select COUNT(ISBN) as Verf1 FROM library.MEDIEN where verf1 = isbn; Select COUNT(ISBN) as Verf2 FROM library.MEDIEN where verf2 = isbn; Select COUNT(ISBN) as Verf3 FROM library.MEDIEN where verf3 = isbn; Select COUNT(ISBN) as Ntverf1 FROM library.MEDIENwhere verf1 != isbn; Select COUNT(ISBN) as Ntverf2 FROM library.MEDIENwhere verf2 != isbn; Select COUNT(ISBN) as Ntverf3 FROM library.MEDIENwhere verf3 != isbn; I am not sure i execute correct command or not. Because some ISBN records have Fname,Mname or Fname,Lname or Mname,Lname or Fname , Lname,Mname only respectively. Please kindly help me solving this query

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >