Search Results

Search found 3905 results on 157 pages for 'ed zero'.

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

  • Programming tutorials for people with zero experience

    - by www.aegisub.net
    A friend of mine is interested in learning how to program computers, but she knows nothing about programming. I suggested that Python might be a good language to start with, but after some googling, I couldn't find any tutorials that covered both programming and Python in an adequate way. I don't want her to go through the tiresome "learn algorithms in pseudocode first" routine. Instead, I'd like a tutorial that will explain the basic ideas while working towards a real goal, e.g. a very simple console game. Does anyone know of any such tutorials? Do you think that I'm mistaken in how I'm handling this? Is Python a bad choice? I know that something like C, C++ or Java won't work - too many details will be very counterproductive. On the other hand, I think that Lisp might be too mathematical and abstract. Python, on the other hand, will let her even do something like coding primitive graphical games in a short period of time.

    Read the article

  • Cannot compute equation, always gives zero

    - by user1738391
    Did i miss something? The variable percentage_ always equals 0. I've checked nTimes and winnings, they give the correct values as what is being input. Even when I test out a simple equation like, percentage_=1+1, percentage_ will give 0. Can someone help? #pragma once #include <iostream> #include <string> #include <cstdlib> #include <iomanip> using namespace std; class GuessMachine { private: int nTimes; int winnings; string nM[6]; public: GuessMachine(); void displayPrizes(); void displayMenu(); int getInput(); void checkNumber(); void checkPrize(); }; void GuessMachine::checkPrize() { MagicNumber mn; int prize_=mn.generateNumber(); float percentage_; percentage_ = float (winnings/nTimes*100); //<--On this line percentage is always 0 no matter what winnings and nTimes are cout<<"Percentage is "<<percentage_<<endl; if(percentage_ >= 50) { cout<<"You have scored "<<percentage_<<"% and won "<<nM[prize_]; } else { cout<<"You have scored "<<percentage_<<"%. You lose!!"; } cin.ignore(); cin.ignore(); }

    Read the article

  • LINQ2SQL: How to let a column accept null values as zero (0) in Self-Relation table

    - by Remon
    As described in the img, I got a parent-Children relation and since the ParentID not accepting null values (and I can't change to nullabel due to some restriction in the UI I have), how can I remove an existence relation between ReportDataSources in order to change the parent for them (here i want to set the parentId for one of them = 0) how could i do that since i cant change the ParentID directly and setting Parent = null is not valid public void SetReportDataSourceAsMaster(ReportDataSource reportDataSource) { //Some logic - not necessarily for this scenario //Reset Master this.ReportDataSources.ToList().ForEach(rds => rds.IsMaster = false); //Set Master reportDataSource.IsMaster = true; //Set Parent ID for the rest of the Reports data sources this.ReportDataSources.Where(rds => rds.ID != reportDataSource.ID).ToList().ForEach(rds => { //Change Parent ID rds.Parent = reportDataSource; //Remove filttering data rds.FilteringDataMembers.Clear(); //Remove Grouping Data rds.GroupingDataMembers.Clear(); }); //Delete parent HERE THE EXCEPTION THROWN AFTER CALLING SUBMITCHANGES() reportDataSource.Parent = null; //Other logic } Exception thrown after calling submitChanges An attempt was made to remove a relationship between a ReportDataSource and a ReportDataSource. However, one of the relationship's foreign keys (ReportDataSource.ParentID) cannot be set to null.

    Read the article

  • The sign of zero with float2

    - by JackOLantern
    Consider the following code performing operations on complex numbers with C/C++'s float: float real_part = log(3.f); float imag_part = 0.f; float real_part2 = (imag_part)*(imag_part)-(real_part*real_part); float imag_part2 = (imag_part)*(real_part)+(real_part*imag_part); The result will be real_part2= -1.20695 imag_part2= 0 angle= 3.14159 where angle is the phase of the complex number and, in this case, is pi. Now consider the following code: float real_part = log(3.f); float imag_part = 0.f; float real_part2 = (-imag_part)*(-imag_part)-(real_part)*(real_part); float imag_part2 = (-imag_part)*(real_part)+(real_part)*(-imag_part); The result will be real_part2= -1.20695 imag_part2= 0 angle= -3.14159 The imaginary part of the result is -0 which makes the phase of the result be -pi. Although still accomplishing with the principal argument of a complex number and with the signed property of floating point's 0, this changes is a problem when one is defining functions of complex numbers. For example, if one is defining sqrt of a complex number by the de Moivre formula, this will change the sign of the imaginary part of the result to a wrong value. How to deal with this effect?

    Read the article

  • Replacing emty csv column values with a zero

    - by homerjay
    Hey, So I'm dealing with a csv file that has missing values. What I want my script to is: #!/usr/bin/python import csv import sys #1. Place each record of a file in a list. #2. Iterate thru each element of the list and get its length. #3. If the length is less than one replace with value x. reader = csv.reader(open(sys.argv[1], "rb")) for row in reader: for x in row[:]: if len(x)< 1: x = 0 print x print row Here is an example of data, I trying it on, ideally it should work on any column lenghth Before: actnum,col2,col4 xxxxx , , xxxxx , 845 , xxxxx , ,545 After actnum,col2,col4 xxxxx , 0 , 0 xxxxx , 845, 0 xxxxx , 0 ,545 Any guidance would be appreciated

    Read the article

  • Centering Divisions Around Zero

    - by Mark
    I'm trying to create something that sort of resembles a histogram. I'm trying to create buckets from an array. Suppose I have a random array doubles between -10 and 10; this is very simplified. I then want to specify a center point, in this case 0 and the number of buckets. If I want 4 buckets the division would be -10 to -5, -5 to 0, 0 to 5 and 5 to 10. Not that complicated right. Now if I change the min and max to -12 and -9 and as for 4 divisions its more complicated. I either want a division at -3 and 3; it is centered around 0 ; or one at -6 to 0 and 0 to 6. Its not that hard to find the division size = Math.Ceiling((Abs(Max) + Abs(Min)) / Divisions) Then you would basically have an if statement to determine whether you want it centered on 0 or on an edge. You then iterate out from either 0 or DivisionSize/2 depending on the situation. You may not ALWAYS end up with the specified number of divisions but it will be close. Then you iterate through the array and increment the bin count. Does this seem like a good way to go about this? This method would surely work but it does not seem to be the most elegant. I'm curious as to whether the creation of the bins and the counting from the list could be done in a clever class with linq in a more elegant way? Something like creating the bins and then having each bin be a property {get;} that returns list.Count(x=> x >= Lower && x < Upper).

    Read the article

  • Array length is zero in jQuery.

    - by James123
    I wrote like this. After submit click loop is not excuting. But I saw value are there, But array lenght is showing '0'. (Please see picture). Why it is not going into loop? and $('#myVisibleRows').val(idsString); becoming 'empty'. $(document).ready(function() { $('tr[@class^=RegText]').hide().children('td'); var list_Visible_Ids = []; var idsString, idsArray; alert($('#myVisibleRows').val()); idsString = $('#myVisibleRows').val(); idsArray = idsString.split(','); $.each(idsArray, function() { if (this != "") { $('#' + this).siblings(('.RegText').toggle(true)); window['list_Visible_Ids'][this] = 1; } }); $('tr.subCategory1') .css("cursor", "pointer") .attr("title", "Click to expand/collapse") .click(function() { //this = $(this); $(this).siblings('.RegText').toggle(); list_Visible_Ids[$(this).attr('id')] = $(this).css('display') != 'none' ? 1 : null; alert(list_Visible_Ids[$(this).attr('id')]) }); $('#form1').submit(function() { idsString = ''; $.each(list_Visible_Ids, function(key, val) { alert(val); if (val) { idsString += (idsString != '' ? ',' : '') + key; } }); $('#myVisibleRows').val(idsString); form.submit(); }); });

    Read the article

  • Symfony: there is a "0" (zero) in a sfWidgetFormChoice

    - by user248959
    Hi, i want to show a select which options are the character '-' and a range of integers. I have this: $years = range(14,130); new sfWidgetFormChoice(array('choices' => array_merge(array('' => '-',array_combine($years,$years))); The problem: between the '-' and the range of integers there is a "0" (bold and italic). Any help? Regards Javi

    Read the article

  • SQL Azure Roadmap gets a little clearer &ndash; announcements from Tech Ed

    - by Eric Nelson
    On Monday at Tech?Ed 2010 we announced new stuff (I like new stuff) that “showcases our continued commitment to deliver value, flexibility and control of data through data cloud services to our customers”. Ok, that does sound like marketing speak (and it is) but the good news is there is some meat behind it. We have some decent new features coming and we also have some clarity on when we will be able to get our hands on those features. SQL Azure Business Edition Extends to 50 GB – June 28th SQL Azure Business Edition database is now extending from 10GB to 50GB The new 50GB database size will be available worldwide starting June 28th SQL Azure Business Edition Subscription Offer – August 1st Starting August 1st, we will have a new discounted SQL Azure promotional offer (SQL Azure Development Accelerator Core) More information is available at http://www.microsoft.com/windowsazure/offers/. Public Preview of the Data Sync Service  - CTP now Data Sync Service for SQL Azure allows for more flexible control over data by deciding which data components should be distributed across multiple datacenters in different geographic locations, based on your internal policies and business needs.  Available as a community technology preview after registering at http://www.sqlazurelabs.com SQL Server Web Manager for SQL Azure - CTP this Summer SQL Server Web Manager (SSWM) is a lightweight and easy to use database management tool for SQL Azure databases, to be offered this summer. Access 10 Support for SQL Azure – available now Yey – at last! Microsoft Office 2010 will natively support data connectivity to SQL Azure – we can now start developing those “departmental apps” with the confidence of a highly available SQL store provisioned in seconds. NB: I don’t believe we will support any previous versions of Access talking to SQL Azure. The Pre-announced Spatial Data Support to Become Live – Live now* At MIX in March we announced spatial was coming and apparently it is now here - although I need to check. Related Links UK based? Sign up at http://ukazure.ning.com SQL Azure Team Blog http://blogs.msdn.com/b/sqlazure/

    Read the article

  • Des failles zero-day découvertes dans MySQL, pouvant entraîner un crash du SGBD ou bloquer l'accès aux utilisateurs

    Des failles zero-day découvertes dans MySQL pouvant entraîner un crash du SGBD ou bloquer l'accès aux utilisateurs Des chercheurs en sécurité viennent de découvrir plusieurs vulnérabilités critiques zero-day dans le gestionnaire de bases de données MySQL. Identifiées au nombre de cinq initialement, c'est finalement trois failles qui se sont avérées être importantes. Les vulnérabilités peuvent être exploitées par des pirates pour bloquer l'accès au SGBD à des utilisateurs et dans une certaine mesure, entrainer même un crash de MySQL. Les failles de sécurité répertoriées sous les références allant de CVE-2012-5611 à 5615, sont décrites comme pouvant entrainer des dépas...

    Read the article

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

    - by Karl
    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. Where TypeID can be 1,2 or 3 and Gender can be M or F. So what I want is the following: TypeID Gender SUM(Count) 1 M 10 1 F 9 2 M 0 2 F 0 3 M 19 3 F 0 I can think of a few ways to potentially do this, but none of them seem particularly elegant to me. Any suggestions would be greatly appreciated! Karl

    Read the article

  • C++ double division by 0.0 versus DBL_MIN

    - by wonsungi
    When finding the inverse square root of a double, is it better to clamp invalid non-positive inputs at 0.0 or MIN_DBL? (In my example below double b may end up being negative due to floating point rounding errors and because the laws of physics are slightly slightly fudged in the game.) Both division by 0.0 and MIN_DBL produce the same outcome in the game because 1/0.0 and 1/DBL_MIN are effectively infinity. My intuition says MIN_DBL is the better choice, but would there be any case for using 0.0? Like perhaps sqrt(0.0), 1/0.0 and multiplication by 1.#INF000000000000 execute faster because they are special cases. double b = 1 - v.length_squared()/(c*c); #ifdef CLAMP_BY_0 if (b < 0.0) b = 0.0; #endif #ifdef CLAMP_BY_DBL_MIN if (b <= 0.0) b = DBL_MIN; #endif double lorentz_factor = 1/sqrt(b); double division in MSVC: 1/0.0 = 1.#INF000000000000 1/DBL_MIN = 4.4942328371557898e+307

    Read the article

  • PayPal $0 Dollar Transaction?

    - by Alex
    Hi. I have a client who wants a paypal shopping cart. All of the services have "Buy Now" buttons, all with different prices. However, there is one service, which is a FREE 0 dollar service. The client wants the "Buy Now" button to remain there, to be consistent with the rest of the site. Does anyone know how I can do a $0 dollar transaction with paypal? I can't find any insight on this being possible. Thanks.

    Read the article

  • Prevent printing -0

    - by fishinear
    If I do the following in Objective-C: NSString *result = [NSString stringWithFormat:@"%1.1f", -0.01]; It will give result @"-0.0" Does anybody know how I can force a result @"0.0" (without the "-") in this case? EDIT: I tried using NSNumberFormatter, but it has the same issue. The following also produces @"-0.0": double value = -0.01; NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; [numberFormatter setMaximumFractionDigits:1]; [numberFormatter setMinimumFractionDigits:1]; NSString *result = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:value]];

    Read the article

  • Excel - Variable number of leading zeros in variable length numbers?

    - by daltec
    The format of our member numbers has changed several times over the years, such that 00008, 9538, 746, 0746, 00746, 100125, and various other permutations are valid, unique and need to be retained. Exporting from our database into the custom Excel template needed for a mass update strips the leading zeros, such that 00746 and 0746 are all truncated to 746. Inserting the apostrophe trick, or formatting as text, does not work in our case, since the data seems to be already altered by the time we open it in Excel. Formatting as zip won't work since we have valid numbers less than five digits in length that cannot have zeros added to them. And I am not having any luck with "custom" formatting as that seems to require either adding the same number of leading zeros to a number, or adding enough zeros to every number to make them all the same length. Any clues? I wish there was some way to set Excel to just take what it's given and leave it alone, but that does not seem to be the case! I would appreciate any suggestions or advice. Thank you all very much in advance!

    Read the article

  • PHP: Check if 0?

    - by tarnfeld
    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 values in a cell are 0. The class returns me a number 0 so it's nothing to do with the class, I think it's the way I am looping through the rows and then assigning them to the array... I want to carry through the 0 value because I am creating graphs with the data afterwards, here is the code I have. // Get Rainfall $rainfall = array(); for($i=1;$i<=$count;$i++) { if($data->val($i,2) != 'Rainfall') // Check if not the column title { $rainfall[] = $data->val($i,2); } } For your info $data is the excel spreadsheet object and the method $data->val(row,col) is what returns me the value. In this case I am getting data from column 2. Screenshot of spreadsheet http://cl.ly/1Dmy Thanks! All help is very much appreciated!

    Read the article

  • How to account for non-prime numbers 0 and 1 in java?

    - by shady
    I'm not sure if this is the right place to be asking this, but I've been searching for a solution for this on my own for quite some time, so hopefully I've come to the right place. When calculating prime numbers, the starting number that each number has to be divisible by is 2 to be a non-prime number. In my java program, I want to include all the non-prime numbers in the range from 0 to a certain number, so how do I include 0 and 1? Should I just have separate if and else-if statements for 0 and 1 that state that they are not prime numbers? I think that maybe 0 and 1 should be included in the java for loop, but I don't know how to go about doing that. for (int i = 2; i < num; i++){ if (num % i == 0){ System.out.println(i + " is not a prime number. "); } else{ System.out.println(i + " is a prime number. "); } }

    Read the article

  • Is learning ed worth it to boost my speed in VIM?

    - by Ksiresh
    I've learned the basic/intermediate levels of VIM ( it's to vast to list ). I often find that I slip back to my old ways and start using the mouse, holding down keys to get somewhere, and doing other stupid things that could be spead up. Would it be worth spending time to learn ed to break the habits learned from years in Windoze? Does using ed cultivate the right type of thinking that will transfer to VIM???

    Read the article

  • Symantec publie son bilan 2010 et ses prévisions pour 2011, plus d'exploits de failles zero-day et d'attaques sensibles

    Symantec fait son bilan 2010 et donne ses perspectives pour 2011 : plus d'attaques contre les infrastructures vitales et d'exploits de failles zero-day Symantec publie aujourd'hui ses perspectives en termes de sécurité informatique pour 2011, grâce à l'observation des phénomènes apparus ou s'étant développés en 2010, et s'appuyant sur son réseau de plus de 240.000 capteurs dans le monde entier. Première tendance lourde : « L'hactivisme » - La fréquence des attaques contre les infrastructures vitales va augmenter et les fournisseurs de services vont réagir, mais les gouvernements risquent d'être plus lents Les pirates ont certainement été attentifs aux effets produits par la menace Stuxnet sur les secteurs d'...

    Read the article

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