Search Results

Search found 13401 results on 537 pages for 'double checked'.

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

  • return an address of a double

    - by bks
    i'm having an issue understanding why the following works: void doubleAddr(double* source, double** dest) { *dest = source; } i get a pointer to a double and want to change the double that dest points to: //usage: int main() { double* num; double* dest; doubleAddr(num, &dest); return 0; } thanks in advance

    Read the article

  • Double Click to open Office docs is slow, File -> Open is fast.

    - by Keith
    I have 2 unique networks. They both share similar architecture: Windows 2003 SBS SP2 Running Symantec Endpoint Running Symantec Information Foundation Shared drives off a data partition Clients running Office 2003 or 2007 Connect to file server through mapped drives When users try to open a file from their local PC by double clicking, it will take 30-60 seconds to open. When they do File - Open, those same documents open up almost immediately. So far I've tried the following - CCleaner to parse the registry of outdated mapped drives - Disabled "using DDE" - Disabled A/V - Reboot Any ideas beyond that? Figured this question belongs here instead of SU since its the same issue on different networks.

    Read the article

  • Problem in List<double[,]>

    - by Newbie
    What is wrong with this (in C# 3.0): List<double> x = new List<double> { 0.0330, -0.6463, 0.1226, -0.3304, 0.4764, -0.4159, 0.4209, -0.4070, -0.2090, -0.2718, -0.2240, -0.1275, -0.0810, 0.0349, -0.5067, 0.0094, -0.4404, -0.1212 }; List<double> y = new List<double> { 0.4807, -3.7070, -4.5582, -11.2126, -0.7733, 3.7269, 2.7672, 8.3333, 4.7023,0,0,0,0,0,0,0,0,0 }; List<double[,]> z = new List<double[,]>{x,y}; // this line The error produced is: Error: Argument '1': cannot convert from 'System.Collections.Generic.List<double>' to 'double[*,*]' Help needed.

    Read the article

  • Convert list to double[][] in C#3.0

    - by Newbie
    Given List<double> x1 = new List<double> { -0.2718, -0.2240, -0.1275, -0.0810, 0.0349, -0.5067, 0.0094, -0.4404, -0.1212 }; List<double> x2 = new List<double> { 0.0330, -0.6463, 0.1226, -0.3304, 0.4764, -0.4159, 0.4209, -0.4070, -0.2090 }; How can I make as double[][] X at runtime(programatically). I mean to say if the output I get if I run double[][] X = { new double[] { -0.2718, -0.2240, -0.1275, -0.0810, 0.0349, -0.5067, 0.0094, -0.4404, -0.1212 }, new double[] { 0.0330, -0.6463, 0.1226, -0.3304, 0.4764, -0.4159, 0.4209, -0.4070, -0.2090 } }; Using C#3.0 Thanks

    Read the article

  • The perils of double-dash comments [T-SQL]

    - by jamiet
    I was checking my Twitter feed on my way in to work this morning and was alerted to an interesting blog post by Valentino Vranken that highlights a problem regarding the OLE DB Source in SSIS. In short, using double-dash comments in SQL statements within the OLE DB Source can cause unexpected results. It really is quite an important read if you’re developing SSIS packages so head over to SSIS OLE DB Source, Parameters And Comments: A Dangerous Mix! and be educated. Note that the problem is solved in SSIS2012 and Valentino explains exactly why. If reading Valentino’s post has switched your brain into “learn mode” perhaps also check out my post SSIS: SELECT *... or select from a dropdown in an OLE DB Source component? which highlights another issue to be aware of when using the OLE DB Source. As I was reading Valentino’s post I was reminded of a slidedeck by Chris Adkin entitled T-SQL Coding Guidelines where he recommends never using double-dash comments: That’s good advice! @Jamiet

    Read the article

  • Double-click instead of single-click in Ubuntu 12.04

    - by evfwcqcg
    When I do a single click, my computer (with Ubuntu 12.04) acts like it was double click. I think it happens in ~50% of cases. It happens with all the program I use: browsers, file manager, terminal and so on. I'm not sure when exactly it started, maybe a week ago, and I don't remember if it started to happen after system-update or after the installation of some packages. What I tried: change mouse change mouse settings like Double-Click Timeout None of those helped me. Any ideas? Thanks.

    Read the article

  • Extending jQuery Form Validation Script for new form fields

    - by user982124
    I have a simple HTML form that originally was a series of Questions (A1 to A5 and B1 to B3) with yes/no radio buttons like this: <tr> <td width="88%" valign="top" class="field_name_left">A1</td> <td width="12%" valign="top" class="field_data"> <input type="radio" name="CriteriaA1" value="Yes">Yes<input type="radio" name="CriteriaA1" value="No">No</td> </tr> The user could only answer either the A series of questions OR either the B series of questions, but not both. Also they must complete all questions in either the A or B series. I now have an additional series of questions - C1 to C6 - and need to extend my validation scripts to ensure the user enters either A, B or C and answers all questions within each series. My original script for just the A and B looks like this: $(function() { $("#editRecord").submit(function(){ // is anything checked? if(!checkEmpty()){ $("#error").html("Please check something before submitting"); //alert("nothing Checked"); return false; } // Only A _OR_ B if(isAorB()){ $("#error").html("Please complete A or B, not both"); //alert("please complete A or B, not both"); return false; }; // all A's or all B's if(allAorBChecked()){ $("#error").html("It appears you have not completed all questions"); //alert("missing data"); return false; }; if(haveNo()){ // we're going on, but sending "type = C" } //alert("all OK"); return true; }); }); function checkEmpty(){ var OK = false; $(":radio").each(function(){ if (this.checked){ OK = true; } }); return OK; } function isAorB(){ var OK = false; var Achecked = false; var Bchecked = false; $(":radio").each(function(){ var theChar=this.name.charAt(8); // if we have an A checked remember it if(theChar == "A" && this.checked && !Achecked){ Achecked = true; } if(Achecked && theChar == "B" && !Bchecked){ if(this.checked){ Bchecked = true; } } if (Achecked && Bchecked){ OK = true; } }); return OK; } function allAorBChecked(){ var notOK = false; var Achecked = false; $(":radio").each(function(){ // skip through to see if we're doing A's or B's var theChar=this.name.charAt(8); // check the A's if(theChar == "A" && this.checked && !Achecked){ Achecked = true; } }); if(Achecked){ // set the input to A $("#type").val("A"); // check _all_ a's are checked var thisName; var thisChecked = false; $(":radio").each(function(){ var theChar=this.name.charAt(8); var checked = this.checked; if (theChar == "A"){ if (this.name == thisName && !thisChecked){ // Yes wasn't checked - is No? if(!checked){ notOK = true; } } thisChecked = checked; thisName = this.name; } }); }else{ // set the input to B $("#type").val("B"); // check _all_ b's are checked var thisName; var thisChecked = false; $(":radio").each(function(){ var theChar=this.name.charAt(8); var checked = this.checked; if (theChar == "B"){ if (this.name == thisName && !thisChecked){ // A wasn't checked - is B? if(!checked){ notOK = true; } } thisChecked = checked; thisName = this.name; } }); } return notOK; } function haveNo(){ var thisName; var notOK = false; $(":radio").each(function(){ var checked = this.checked; if (this.name == thisName){ //Is this checked if(checked){ notOK = true; $("#type").val("C"); } } thisName = this.name; }); return notOK; } This worked well but I'm completely stuck at extending it to include the C series. I now have to check that the user hasn't answered any A and B, A and C and B and C questions. Everything I've tried fails to validate. Here's where I'm at right now with my new script: $(function() { $("#editRecord").submit(function(){ // is anything checked? if(!checkEmpty()){ $("#error").html("Please check something before submitting"); //alert("nothing Checked"); return false; } // Only A or B or C if(isAorBorC()){ $("#error").html("Please complete A or B or C, not both"); //alert("please complete A or B, not both"); return false; }; // all A's or all B's or all C's if(allAorBorCChecked()){ $("#error").html("It appears you have not completed all questions"); //alert("missing data"); return false; }; if(haveNo()){ // we're going on, but sending "type = C" } //alert("all OK"); return true; }); }); function checkEmpty(){ var OK = false; $(":radio").each(function(){ if (this.checked){ OK = true; } }); return OK; } function isAorBorC(){ var OK = false; var Achecked = false; var Bchecked = false; var Cchecked = false; $(":radio").each(function(){ var theChar=this.name.charAt(8); // if we have an A checked remember it if(theChar == "A" && this.checked && !Achecked){ Achecked = true; } if(theChar == "B" && this.checked && !Achecked){ Bchecked = true; } if(theChar == "C" && this.checked && !Achecked){ Cchecked = true; } if(Achecked && theChar == "B" && !Bchecked){ if(this.checked){ Bchecked = true; } } if(Achecked && theChar == "C" && !Cchecked){ if(this.checked){ Cchecked = true; } } if(Bchecked && theChar == "C" && !Cchecked){ if(this.checked){ Cchecked = true; } } if (Achecked && Bchecked){ OK = true; } if (Achecked && CBchecked){ OK = true; } if (Bchecked && Cchecked){ OK = true; } }); return OK; } function allAorBorCChecked(){ var notOK = false; var Achecked = false; $(":radio").each(function(){ // skip through to see if we're doing A's or B's var theChar=this.name.charAt(8); // check the A's if(theChar == "A" && this.checked && !Achecked){ Achecked = true; } }); if(Achecked){ // set the input to A $("#type").val("A"); // check _all_ a's are checked var thisName; var thisChecked = false; $(":radio").each(function(){ var theChar=this.name.charAt(8); var checked = this.checked; if (theChar == "A"){ if (this.name == thisName && !thisChecked){ // Yes wasn't checked - is No? if(!checked){ notOK = true; } } thisChecked = checked; thisName = this.name; } }); }elseif{ // set the input to B $("#type").val("B"); // check _all_ b's are checked var thisName; var thisChecked = false; $(":radio").each(function(){ var theChar=this.name.charAt(8); var checked = this.checked; if (theChar == "B"){ if (this.name == thisName && !thisChecked){ // A wasn't checked - is B? if(!checked){ notOK = true; } } thisChecked = checked; thisName = this.name; } }); } return notOK; } }else{ // set the input to C $("#type").val("C"); // check _all_ c's are checked var thisName; var thisChecked = false; $(":radio").each(function(){ var theChar=this.name.charAt(8); var checked = this.checked; if (theChar == "C"){ if (this.name == thisName && !thisChecked){ // A wasn't checked - is B? if(!checked){ notOK = true; } } thisChecked = checked; thisName = this.name; } }); } return notOK; } function haveNo(){ var thisName; var notOK = false; $(":radio").each(function(){ var checked = this.checked; if (this.name == thisName){ //Is this checked if(checked){ notOK = true; $("#type").val("C"); } } thisName = this.name; }); return notOK; } Anyone see what I'm doing wrong?

    Read the article

  • Creating a C++ DLL and then using it in C#

    - by Major
    Ok I'm trying to make a C++ DLL that I can then call and reference in a c# App. I've already made a simple dll using the numberous guides out there, however when I try to reference it in the C# app I get the error Unable to load DLL 'SDES.dll': The specified module could not be found. The code for the program is as follows (bear with me I'm going to include all the files) //These are the DLL Files. ifndef TestDLL_H define TestDLL_H extern "C" { // Returns a + b __declspec(dllexport) double Add(double a, double b); // Returns a - b __declspec(dllexport) double Subtract(double a, double b); // Returns a * b __declspec(dllexport) double Multiply(double a, double b); // Returns a / b // Throws DivideByZeroException if b is 0 __declspec(dllexport) double Divide(double a, double b); } endif //.cpp include "test.h" include using namespace std; extern double __cdecl Add(double a, double b) { return a + b; } extern double __cdecl Subtract(double a, double b) { return a - b; } extern double __cdecl Multiply(double a, double b) { return a * b; } extern double __cdecl Divide(double a, double b) { if (b == 0) { throw new invalid_argument("b cannot be zero!"); } return a / b; } //C# Program using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace ConsoleApplication1 { class Program { [DllImport("SDES.dll")] public static extern void SimulateGameDLL(int a, int b); static void Main(string[] args) { SimulateGameDLL(1, 2); //Error here... } } } Anyone have any idea's what I may be missing in my program? Let me know if I missed some code or if you have any questions.

    Read the article

  • How can I convert a byte array into a double and back?

    - by user350005
    For converting a byte array to a double I found this: //convert 8 byte array to double int start=0;//??? int i = 0; int len = 8; int cnt = 0; byte[] tmp = new byte[len]; for (i = start; i < (start + len); i++) { tmp[cnt] = arr[i]; //System.out.println(java.lang.Byte.toString(arr[i]) + " " + i); cnt++; } long accum = 0; i = 0; for ( int shiftBy = 0; shiftBy < 64; shiftBy += 8 ) { accum |= ( (long)( tmp[i] & 0xff ) ) << shiftBy; i++; } return Double.longBitsToDouble(accum); But I could not find anything which would convert a double into a byte array.

    Read the article

  • Apache Jmeter + Random Double

    - by Filipe Batista
    Is it possible to generate random double numbers in JMeter? I tried to use the Random in the config element where i have defined the Minimum value: 47.9999 (RND1) Maximum value: 30.9999 (RND2) Then in the selected Prepared Selected Statement i placed this values: Parameter values:${RND1},${RND1},${RND2} Parameter types:DOUBLE,DOUBLE,DOUBLE But it seems not work, because i receive an error: Response message: java.sql.SQLException: Cannot convert class java.lang.String to SQL type requested due to java.lang.NumberFormatException - For input string: "${RND1}"

    Read the article

  • How many double numbers are there between 0.0 and 1.0?

    - by polygenelubricants
    This is something that's been on my mind for years, but I never took the time to ask before. Many (pseudo) random number generators generate a random number between 0.0 and 1.0. Mathematically there are infinite numbers in this range, but double is a floating point number, and therefore has a finite precision. So the questions are: Just how many double numbers are there between 0.0 and 1.0? Are there just as many numbers between 1 and 2? Between 100 and 101? Between 10^100 and 10^100+1? Note: if it makes a difference, I'm interested in Java's definition of double in particular.

    Read the article

  • asp.net checkbox in gridview - checked property is missing

    - by Peter PitLock
    In this asp.net gridview control, the checked property is always missing. I need to access the checked property via jquery Gridview source: <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="chkSelected" runat="server" class="chkSummarySelection" /> </ItemTemplate> </asp:TemplateField> </Columns> Renders as : <input type="checkbox" name="ctl00$ContentPlaceHolder1$gv$ctl02$SelectedCheckBox" id="ctl00_ContentPlaceHolder1_gv_ctl02_SelectedCheckBox"> There is no checked property to access. I have tried $(".chkSummarySelection").click(function () { var chk; chk = $(this).prop("checked"); chk = $(this).attr("checked"); chk = $(this).is(":checked"); chk = $(this).attr("value"); chk = $(this).val(); chk = jQuery(this).is(':checked'); }); but nothing is working

    Read the article

  • Why doesn't $("#RadioButtons:checked").val() work in IE?

    - by Randy Heaps
    Why doesn't $("#RadioButtons:checked").val() - id selector - work in Internet Explorer but $("input:radio[name='RadioButtons']:checked").val() - name selector - does? <input name="RadioButtons" id="RadioButtons" type="radio" value="1" checked> <input name="RadioButtons" id="RadioButtons" type="radio" value="2"> <script> alert($("#RadioButtons:checked").val()); alert($("input:radio[name='RadioButtons']:checked").val()); </script>

    Read the article

  • For what purpose does java have a float primitive type?

    - by Roman
    I heard plenty times different claims about float type in java. The most popular issues typicaly regard to converting float value to double and vice versa. I read (rather long time ago and not sure that it's actual now with new JVM) that float gives much worse performance then double. And it's also not recommended to use float in scientific applications which should have certain accuracy. I also remember that when I worked with AWT and Swing I had some problems with using float or double (like using Point2D.Float or Point2D.Double). So, I see only 2 advantages of float over double: it needs only 4 bytes while double needs 8 bytes JMM garantees that assignment operation is atomic with float variables while it's not atomic with double's. Are there any other cases where float is better then double? Do you use float's in your applications? It seems to me that the only valuable reason java has float is backward compatibility.

    Read the article

  • Preoblem with Precision floating point operation in C

    - by Microkernel
    Hi Guys, For one of my course project I started implementing "Naive Bayesian classifier" in C. My project is to implement a document classifier application (especially Spam) using huge training data. Now I have problem implementing the algorithm because of the limitations in the C's datatype. ( Algorithm I am using is given here, http://en.wikipedia.org/wiki/Bayesian_spam_filtering ) PROBLEM STATEMENT: The algorithm involves taking each word in a document and calculating probability of it being spam word. If p1, p2 p3 .... pn are probabilities of word-1, 2, 3 ... n. The probability of doc being spam or not is calculated using Here, probability value can be very easily around 0.01. So even if I use datatype "double" my calculation will go for a toss. To confirm this I wrote a sample code given below. #define PROBABILITY_OF_UNLIKELY_SPAM_WORD (0.01) #define PROBABILITY_OF_MOSTLY_SPAM_WORD (0.99) int main() { int index; long double numerator = 1.0; long double denom1 = 1.0, denom2 = 1.0; long double doc_spam_prob; /* Simulating FEW unlikely spam words */ for(index = 0; index < 162; index++) { numerator = numerator*(long double)PROBABILITY_OF_UNLIKELY_SPAM_WORD; denom2 = denom2*(long double)PROBABILITY_OF_UNLIKELY_SPAM_WORD; denom1 = denom1*(long double)(1 - PROBABILITY_OF_UNLIKELY_SPAM_WORD); } /* Simulating lot of mostly definite spam words */ for (index = 0; index < 1000; index++) { numerator = numerator*(long double)PROBABILITY_OF_MOSTLY_SPAM_WORD; denom2 = denom2*(long double)PROBABILITY_OF_MOSTLY_SPAM_WORD; denom1 = denom1*(long double)(1- PROBABILITY_OF_MOSTLY_SPAM_WORD); } doc_spam_prob= (numerator/(denom1+denom2)); return 0; } I tried Float, double and even long double datatypes but still same problem. Hence, say in a 100K words document I am analyzing, if just 162 words are having 1% spam probability and remaining 99838 are conspicuously spam words, then still my app will say it as Not Spam doc because of Precision error (as numerator easily goes to ZERO)!!!. This is the first time I am hitting such issue. So how exactly should this problem be tackled?

    Read the article

  • Problem with Precision floating point operation in C

    - by Microkernel
    Hi Guys, For one of my course project I started implementing "Naive Bayesian classifier" in C. My project is to implement a document classifier application (especially Spam) using huge training data. Now I have problem implementing the algorithm because of the limitations in the C's datatype. ( Algorithm I am using is given here, http://en.wikipedia.org/wiki/Bayesian_spam_filtering ) PROBLEM STATEMENT: The algorithm involves taking each word in a document and calculating probability of it being spam word. If p1, p2 p3 .... pn are probabilities of word-1, 2, 3 ... n. The probability of doc being spam or not is calculated using Here, probability value can be very easily around 0.01. So even if I use datatype "double" my calculation will go for a toss. To confirm this I wrote a sample code given below. #define PROBABILITY_OF_UNLIKELY_SPAM_WORD (0.01) #define PROBABILITY_OF_MOSTLY_SPAM_WORD (0.99) int main() { int index; long double numerator = 1.0; long double denom1 = 1.0, denom2 = 1.0; long double doc_spam_prob; /* Simulating FEW unlikely spam words */ for(index = 0; index < 162; index++) { numerator = numerator*(long double)PROBABILITY_OF_UNLIKELY_SPAM_WORD; denom2 = denom2*(long double)PROBABILITY_OF_UNLIKELY_SPAM_WORD; denom1 = denom1*(long double)(1 - PROBABILITY_OF_UNLIKELY_SPAM_WORD); } /* Simulating lot of mostly definite spam words */ for (index = 0; index < 1000; index++) { numerator = numerator*(long double)PROBABILITY_OF_MOSTLY_SPAM_WORD; denom2 = denom2*(long double)PROBABILITY_OF_MOSTLY_SPAM_WORD; denom1 = denom1*(long double)(1- PROBABILITY_OF_MOSTLY_SPAM_WORD); } doc_spam_prob= (numerator/(denom1+denom2)); return 0; } I tried Float, double and even long double datatypes but still same problem. Hence, say in a 100K words document I am analyzing, if just 162 words are having 1% spam probability and remaining 99838 are conspicuously spam words, then still my app will say it as Not Spam doc because of Precision error (as numerator easily goes to ZERO)!!!. This is the first time I am hitting such issue. So how exactly should this problem be tackled?

    Read the article

  • Array loading with doubles in C

    - by user2892120
    I am trying to load a 3x8 array of doubles but my code keeps outputting 0.00 for all of the values. The code should be outputting the array (same as the input) under the Read#1 Read#2 Read#3 lines, with the average under average. Here is my code: #include <stdio.h> double getAvg(double num1, double num2, double num3); int main() { int numJ,month,day,year,i,j; double arr[3][8]; scanf("%d %d %d %d",&numJ,&month,&day,&year); for (i = 0; i < 8; i++) { scanf("%f %f %f",&arr[i][0], &arr[i][1], &arr[i][2]); } printf("\nJob %d Date: %d/%d/%d",numJ,month,day,year); printf("\n\nLocation Read#1 Read#2 Read#3 Average"); for (j = 0; j < 8; j++) { printf("\n %d %.2f %.2f %.2f %.2f",j+1,arr[j][0],arr[j] [1],arr[j][2],getAvg(arr[j][0],arr[j][1],arr[j][2])); } return 0; } double getAvg(double num1, double num2, double num3) { double avg = (num1 + num2 + num3) / 3; return avg; } Input example: 157932 09 01 2013 0.00 0.00 0.00 0.36 0.27 0.23 0.18 0.16 0.26 0.27 0.00 0.34 0.24 0.00 0.31 0.16 0.33 0.36 0.29 0.36 0.00 0.21 0.36 0.00

    Read the article

  • Check checkbox checked property using jQuery

    - by Prasad
    I need to check the checked property of a checkbox and perform an action based on the checked property using jQuery. For example, if the age checkbox is checked, then I need to show a textbox to enter age, else hide the textbox. But the following code returns false by default: if($('#isAgeSelected').attr('checked')) { $("#txtAge").show(); } else { $("#txtAge").hide(); } How do I successfully query the checked property?

    Read the article

  • Which of these design patterns is superior?

    - by durron597
    I find I tend to design class structures where several subclasses have nearly identical functionality, but one piece of it is different. So I write nearly all the code in the abstract class, and then create several subclasses to do the one different thing. Does this pattern have a name? Is this the best way for this sort of scenario? Option 1: public interface TaxCalc { String calcTaxes(); } public abstract class AbstractTaxCalc implements TaxCalc { // most constructors and fields are here public double calcTaxes(UserFinancials data) { // code double diffNumber = getNumber(data); // more code } abstract protected double getNumber(UserFinancials data); protected double initialTaxes(double grossIncome) { // code return initialNumber; } } public class SimpleTaxCalc extends AbstractCalc { protected double getNumber(UserFinancials data) { double temp = intialCalc(data.getGrossIncome()); // do other stuff return temp; } } public class FancyTaxCalc extends AbstractTaxCalc { protected double getNumber(UserFinancials data) { int temp = initialCalc(data.getGrossIncome()); // Do fancier math return temp; } } Option 2: This version is more like the Strategy pattern, and should be able to do essentially the same sorts of tasks. public class TaxCalcImpl implements TaxCalc { private final TaxMath worker; public DummyImpl(TaxMath worker) { this.worker = worker; } public double calcTaxes(UserFinancials data) { // code double analyzedDouble = initialNumber; int diffNumber = worker.getNumber(data, initialNumber); // more code } protected int initialTaxes(double grossIncome) { // code return initialNumber; } } public interface TaxMath { double getNumber(UserFinancials data, double initial); } Then I could do: TaxCalc dum = new TaxCalcImpl(new TaxMath() { @Override public double getNumber(UserFinancials data, double initial) { double temp = data.getGrossIncome(); // do math return temp; }); And I could make specific implementations of TaxMath for things I use a lot, or I could make a stateless singleton for certain kinds of workers I use a lot. So the question I'm asking is: Which of these patterns is superior, when, and why? Or, alternately, is there an even better third option?

    Read the article

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