Search Results

Search found 6374 results on 255 pages for 'double underscore'.

Page 34/255 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • Why the double.Parse throw error in live server and how to track?

    - by Kovu
    Hi, I build a website, that: reads data from a website by HttpWebRequest Sort all Data Parse values of the data and give out newly On local server it works perfect, but when I push it to my live server, the double.Parse fails with an error. So: - how to track what the double.parse is trying to parse? - how to debug live server? Lang is ASP.Net / C#.net 2.0

    Read the article

  • how to clear the 'double right click ' on google-map-v3..

    - by zjm1126
    this is my code, and I can't remove the mousedown eventlistener : //*********** double right click ********/ var c =0 ; function time(event){ if(event.button == 2){ c++; setTimeout(cc, 600); } if (c >1){ alert('ok i get it') } } //$('#map_canvas')[0].mousedown(time); $('#map_canvas')[0].addEventListener('mousedown', time, false); //$("map_canvas").unbind() //$('map_canvas')[0].onmousedown=function(){};//this can't be clear the event $('map_canvas')[0].removeEventListener('mousedown', time, false); function cc(){ c=0; } //*********** double right click ********/

    Read the article

  • When setting a form's opacity should I use a decimal or double?

    - by Eggs McLaren
    I'm new to C#, and I want to use a track-bar to change a form's opacity. This is my code: decimal trans = trackBar1.Value / 5000 this.Opacity = trans When I try to build it, I get this error: Cannot implicitly convert type 'decimal' to 'double' I tried making trans a double, but then the control doesn't work. This code worked fine for me in VB.NET. What do I need to do differently?

    Read the article

  • how to return NULL for double function with Intel C compiler?

    - by Derek
    I have some code that I am porting from an SGI system using the MIPS compiler. It has functions that are declared to have double return type. If the function can't find the right double, those functions return "NULL" The intel C compiler does not like this, but I was trying to see if there is a compiler option to enable this "feature" so that I can compile without changing code. I checked the man page, and can't seem to find it. Thanks

    Read the article

  • How to make Windows command prompt treat single quote as though it is a double quote?

    - by mark
    My scenario is simple - I am copying script samples from the Mercurial online book (at http://hGBook.red-bean.com) and pasting them in a Windows command prompt. The problem is that the samples in the book use single quoted strings. When a single quoted string is passed on the Windows command prompt, the latter does not recognize that everything between the single quotes belongs to one string. For example, the following command: hg commit -m 'Initial commit' cannot be pasted as is in a command prompt, because the latter treats 'Initial commit' as two strings - 'Initial and commit'. I have to edit the command after paste and it is annoying. Is it possible to instruct the Windows command prompt to treat single quotes similarly to the double one? EDIT Following the reply by JdeBP I have done a little research. Here is the summary: Mercurial entry point looks like so (it is a python program): def run(): "run the command in sys.argv" sys.exit(dispatch(request(sys.argv[1:]))) So, I have created a tiny python program to mimic the command line processing used by mercurial: import sys print sys.argv[1:] Here is the Unix console log: [hg@Quake ~]$ python 1.py "1 2 3" ['1 2 3'] [hg@Quake ~]$ python 1.py '1 2 3' ['1 2 3'] [hg@Quake ~]$ python 1.py 1 2 3 ['1', '2', '3'] [hg@Quake ~]$ And here is the respective Windows console log: C:\Workpython 1.py "1 2 3" ['1 2 3'] C:\Workpython 1.py '1 2 3' ["'1", '2', "3'"] C:\Workpython 1.py 1 2 3 ['1', '2', '3'] C:\Work One can clearly see that Windows does not treat single quotes as double quotes. And this is the essence of my question.

    Read the article

  • Applications: The Mathematics of Movement, Part 2

    - by TechTwaddle
    In part 1 of this series we saw how we can make the marble move towards the click point, with a fixed speed. In this post we’ll see, first, how to get rid of Atan2(), sine() and cosine() in our calculations, and, second, reducing the speed of the marble as it approaches the destination, so it looks like the marble is easing into it’s final position. As I mentioned in one of the previous posts, this is achieved by making the speed of the marble a function of the distance between the marble and the destination point. Getting rid of Atan2(), sine() and cosine() Ok, to be fair we are not exactly getting rid of these trigonometric functions, rather, replacing one form with another. So instead of writing sin(?), we write y/length. You see the point. So instead of using the trig functions as below, double x = destX - marble1.x; double y = destY - marble1.y; //distance between destination and current position, before updating marble position distanceSqrd = x * x + y * y; double angle = Math.Atan2(y, x); //Cos and Sin give us the unit vector, 6 is the value we use to magnify the unit vector along the same direction incrX = speed * Math.Cos(angle); incrY = speed * Math.Sin(angle); marble1.x += incrX; marble1.y += incrY; we use the following, double x = destX - marble1.x; double y = destY - marble1.y; //distance between destination and marble (before updating marble position) lengthSqrd = x * x + y * y; length = Math.Sqrt(lengthSqrd); //unit vector along the same direction as vector(x, y) unitX = x / length; unitY = y / length; //update marble position incrX = speed * unitX; incrY = speed * unitY; marble1.x += incrX; marble1.y += incrY; so we replaced cos(?) with x/length and sin(?) with y/length. The result is the same.   Adding oomph to the way it moves In the last post we had the speed of the marble fixed at 6, double speed = 6; to make the marble decelerate as it moves, we have to keep updating the speed of the marble in every frame such that the speed is calculated as a function of the length. So we may have, speed = length/12; ‘length’ keeps decreasing as the marble moves and so does speed. The Form1_MouseUp() function remains the same as before, here is the UpdatePosition() method, private void UpdatePosition() {     double incrX = 0, incrY = 0;     double lengthSqrd = 0, length = 0, lengthSqrdNew = 0;     double unitX = 0, unitY = 0;     double speed = 0;     double x = destX - marble1.x;     double y = destY - marble1.y;     //distance between destination and marble (before updating marble position)     lengthSqrd = x * x + y * y;     length = Math.Sqrt(lengthSqrd);     //unit vector along the same direction as vector(x, y)     unitX = x / length;     unitY = y / length;     //speed as a function of length     speed = length / 12;     //update marble position     incrX = speed * unitX;     incrY = speed * unitY;     marble1.x += incrX;     marble1.y += incrY;     //check for bounds     if ((int)marble1.x < MinX + marbleWidth / 2)     {         marble1.x = MinX + marbleWidth / 2;     }     else if ((int)marble1.x > (MaxX - marbleWidth / 2))     {         marble1.x = MaxX - marbleWidth / 2;     }     if ((int)marble1.y < MinY + marbleHeight / 2)     {         marble1.y = MinY + marbleHeight / 2;     }     else if ((int)marble1.y > (MaxY - marbleHeight / 2))     {         marble1.y = MaxY - marbleHeight / 2;     }     //distance between destination and marble (after updating marble position)     x = destX - (marble1.x);     y = destY - (marble1.y);     lengthSqrdNew = x * x + y * y;     /*      * End Condition:      * 1. If there is not much difference between lengthSqrd and lengthSqrdNew      * 2. If the marble has moved more than or equal to a distance of totLenToTravel (see Form1_MouseUp)      */     x = startPosX - marble1.x;     y = startPosY - marble1.y;     double totLenTraveledSqrd = x * x + y * y;     if ((int)totLenTraveledSqrd >= (int)totLenToTravelSqrd)     {         System.Console.WriteLine("Stopping because Total Len has been traveled");         timer1.Enabled = false;     }     else if (Math.Abs((int)lengthSqrd - (int)lengthSqrdNew) < 4)     {         System.Console.WriteLine("Stopping because no change in Old and New");         timer1.Enabled = false;     } } A point to note here is that, in this implementation, the marble never stops because it travelled a distance of totLenToTravelSqrd (first if condition). This happens because speed is a function of the length. During the final few frames length becomes very small and so does speed; and so the amount by which the marble shifts is quite small, and the second if condition always hits true first. I’ll end this series with a third post. In part 3 we will cover two things, one, when the user clicks, the marble keeps moving in that direction, rebounding off the screen edges and keeps moving forever. Two, when the user clicks on the screen, the marble moves towards it, with it’s speed reducing by every frame. It doesn’t come to a halt when the destination point is reached, instead, it continues to move, rebounds off the screen edges and slowly comes to halt. The amount of time that the marble keeps moving depends on how far the user clicks from the marble. I had mentioned this second situation here. Finally, here’s a video of this program running,

    Read the article

  • How to make a file load in my program when a user double clicks an associated file.

    - by Edward Boyle
    I assume in this article that file extension association has been setup by the installer. I may address file extension association at a later date, but for the purpose of this article, I address what sometimes eludes new C# programmers. This is sometimes confusing because you just don’t think about it — you have to access a file that you rarely access when making Windows forms applications, “Program.cs” static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } There are so many ways to skin this cat, so you get to see how I skinned my last cat. static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 mainf = new Form1(); if (args.Length > 0) { try { if (System.IO.File.Exists(args[0])) { mainf.LoadFile= args[0]; } } catch { MessageBox.Show("Could not open file.", "Could not open file.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } Application.Run(mainf); } } It may be easy to miss, but don’t forget to add the string array for the command line arguments: static void Main(string[] args) this is not a part of the default program.cs You will notice the mainf.LoadFile property. In the main form of my program I have a property for public string LoadFile ... and the field private string loadFile = String.Empty; in the forms load event I check the value of this field. private void Form1_Load(object sender, EventArgs e) { if(loadFile != String.Empty){ // The only way this field is NOT String.empty is if we set it in // static void Main() of program.cs // LOAD it however it is needed OpenFile, SetDatabase, whatever you use. } }

    Read the article

  • Does double-shifting as a PM affect your developer-productivity?

    - by Roopesh Shenoy
    Has it ever happened to you that you are a good developer but suddenly you need to lead a team or are responsible for some PM activities as well? Did you find that it affected your productivity? How did you handle it? I love my job, but I sometimes feel I was much happier as a programmer and the additional burden of being a Project Manager is currently affecting my productivity as a developer. What do you guys suggest as remedies to this? I do not have an alternative currently to quit from my job - basically because Im working for a startup that I co-founded.

    Read the article

  • how to use double buffering in awt? [on hold]

    - by Ishanth
    import java.awt.event.*; import java.awt.*; class circle1 extends Frame implements KeyListener { public int a=300; public int b=70; public int pacx=360; public int pacy=270; public circle1() { setTitle("circle"); addKeyListener(this); repaint(); } public void paint(Graphics g) { g.fillArc (a, b, 60, 60,pacx,pacy); } public void keyPressed(KeyEvent e) { int key=e.getKeyCode(); System.out.println(key); if(key==38) { b=b-5; //move pacman up pacx=135;pacy=270; //packman mouth upside if(b==75&&a>=20||b==75&&a<=945) { b=b+5; } else { repaint(); } } else if(key==40) { b=b+5; //move pacman downside pacx=315; pacy=270; //packman mouth down if(b==645&&a>=20||b==645&&a<=940) { b=b-5; } else{ repaint(); } } else if(key==37) { a=a-5; //move pacman leftside pacx=227; pacy=270; //packman mouth left if(a==15&&b>=75||a==15&&b<=640) { a=a+5; } else { repaint(); } } else if(key==39) { a=a+5; //move pacman rightside pacx=42;pacy=270; //packman mouth right if(a==945&&a>=80||a==945&&b<=640) { a=a-5; } else { repaint(); } } } public void keyReleased(KeyEvent e){} public void keyTyped(KeyEvent e){} public static void main(String args[]) { circle1 c=new circle1(); c.setVisible(true); c.setSize(400,400); } }

    Read the article

  • How to force c# binary int division to return a double?

    - by Wayne
    How to force double x = 3 / 2; to return 1.5 in x without the D suffix or casting? Is there any kind of operator overload that can be done? Or some compiler option? Amazingly, it's not so simple to add the casting or suffix for the following reason: Business users need to write and debug their own formulas. Presently C# is getting used like a DSL (domain specific language) in that these users aren't computer science engineers. So all they know is how to edit and create a few types of classes to hold their "business rules" which are generally just math formulas. But they always assume that double x = 3 / 2; will return x = 1.5 however in C# that returns 1. A. they always forget this, waste time debugging, call me for support and we fix it. B. they think it's very ugly and hurts the readability of their business rules. As you know, DSL's need to be more like natural language. Yes. We are planning to move to Boo and build a DSL based on it but that's down the road. Is there a simple solution to make double x = 3 / 2; return 1.5 by something external to the class so it's invisible to the users? Thanks! Wayne

    Read the article

  • How to force c# binary int division to return a double?

    - by Wayne
    How to force double x = 3 / 2; to return 1.5 in x without the D suffix or casting? Is there any kind of operator overload that can be done? Or some compiler option? Amazingly, it's not so simple to add the casting or suffix for the following reason: Business users need to write and debug their own formulas. Presently C# is getting used like a DSL (domain specific language) in that these users aren't computer science engineers. So all they know is how to edit and create a few types of classes to hold their "business rules" which are generally just math formulas. But they always assume that double x = 3 / 2; will return x = 1.5 however in C# that returns 1. A. they always forget this, waste time debugging, call me for support and we fix it. B. they think it's very ugly and hurts the readability of their business rules. As you know, DSL's need to be more like natural language. Yes. We are planning to move to Boo and build a DSL based on it but that's down the road. Is there a simple solution to make double x = 3 / 2; return 1.5 by something external to the class so it's invisible to the users? Thanks! Wayne

    Read the article

  • How is conversion of float/double to int handled in printf?

    - by Sandip
    Consider this program int main() { float f = 11.22; double d = 44.55; int i,j; i = f; //cast float to int j = d; //cast double to int printf("i = %d, j = %d, f = %d, d = %d", i,j,f,d); //This prints the following: // i = 11, j = 44, f = -536870912, d = 1076261027 return 0; } Can someone explain why the casting from double/float to int works correctly in the first case, and does not work when done in printf? This program was compiled on gcc-4.1.2 on 32-bit linux machine. EDIT: Zach's answer seems logical, i.e. use of format specifiers to figure out what to pop off the stack. However then consider this follow up question: int main() { char c = 'd'; // sizeof c is 1, however sizeof character literal // 'd' is equal to sizeof(int) in ANSI C printf("lit = %c, lit = %d , c = %c, c = %d", 'd', 'd', c, c); //this prints: lit = d, lit = 100 , c = d, c = 100 //how does printf here pop off the right number of bytes even when //the size represented by format specifiers doesn't actually match //the size of the passed arguments(char(1 byte) & char_literal(4 bytes)) return 0; } How does this work?

    Read the article

  • Conventions for the behavior of double or triple "click to select text" features?

    - by John Sullivan
    Almost any mature program that involves text implements "double click to select the word" and, in some cases, "triple click to select additional stuff like an entire line" as a feature. I find these features useful but they are often inconsistent between programs. Example - some programs' double clicks do not select the ending space after a word, but most do. Some recognize the - character as the end of a word, others do not. SO likes to select the entire paragraph as I write this post when I triple click it, VS web developer 2005 has no triple click support, and ultra-edit 32 will select one line upon triple clicking. We could come up with innumerable inconsistencies about how double and triple click pattern matching is implemented across programs. I am concerned about how to implement this behavior in my program if nobody else has achieved a convention about how the pattern matching should work. My question is, does a convention (conventions? maybe an MS or Linux convention?) exist that dictates how these features are supposed to behave to the end user? What, if any, are they?

    Read the article

  • How to convert System.Object that's really an int32[] to a double[] ?

    - by fs_tech
    Hello- I get data from a 3rd party API that just gives me back a System.Object, which I know to be a double[] under the covers. And to deal with that return type, I have found the code below to work wonderfully. However, I also get back some int[] arrays that are also masquerading as System.Object, specifically dates in the form YYYYMMDD (e.g. 20100310). The conversion to float fails, and it just says that the specified cast is not valid. Does anyone out there know how to make this work for integers? let oIsNull (obj : System.Object) = obj = null let oIsArray (obj : System.Object) = obj.GetType().IsArray let o2f (obj : System.Object) = let mutable arr = [|Double.NaN|] if (oIsNull obj = false) && (oIsArray obj = true) then let objArr = obj :?> obj[] let u = objArr.GetUpperBound(0) let floatArr : float[] = Array.zeroCreate (u + 1); for i in 0..u do if objArr.[i] = null then floatArr.[i] <- Double.NaN else let t = objArr.[i].GetType() floatArr.[i] <- objArr.[i] :?> float //else floatArr.[i] <- float objArr.[i] arr <- floatArr arr

    Read the article

  • Installing SQL Server Compact 3.5 SP2 *after* installing SQL 2012 RC0 - machine.config path include double slashes?

    - by Sigmund
    I'm trying to install SQL Compact 3.5 SP2 after I've installed SQL 2012 RC0, on a x64 Windows 7. The x86 installer goes through fine. The x64 installer fails, with the error: "Error 25543.Failed to save changes to XML file c:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\machine.config, system error: -2147024864" Note the \CONFIG (double backslash) where there should be a single backslash... any ideas why this is happening and how to solve it?

    Read the article

  • Search text in list of files. Double search. Search files within a files

    - by wormhit
    I'm trying to execute double search within files and return file names. I'm using find ./ -iname '*txt' | xargs grep "searchtext" -sl to find file names with 'searchtext' in them. Command is returning a list of files. How can I find "othersearchtext" in those already found files and show them in the same fashion? #### EDITED Answer: grep -l "othersearchtext" $(find ./ -iname '*txt' | xargs grep "searchtext" -sl)

    Read the article

  • Can I combine two LANs into one to get double speed?

    - by Salaam
    Hey guys, I have 2 LANs in my own PC & 2 Routers (TP-Link WR941N each) with 2 internet accounts (512Kbps each) connected to the same ISP signal & company using NanoStation 5 from ubnt. As you know the connections work separately by default! (I use Windows 7 64bit) Can I merge them to get double speed (download/upload simultaneously) using regedit or special software or any other method? I'd be much appreciated if u could help me doing that Best Regards, Salaam

    Read the article

  • Initializing a property in c#

    - by Shonna
    I have a constructor I am trying to build with the header public KsuPoint(double x0, double y0) now i also have properties in the class as shown below private double x; public double X { get { return x; } } private double y; public double Y { get { return y; } } This constructor is suppose to initialize the properties X and Y ... is this correct? or am i off? public KsuPoint(double x0, double y0) { new KsuPoint(x0, y0); }

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >