Search Results

Search found 974 results on 39 pages for 'george edison'.

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

  • Weird behaviour with vector::erase and std::remove_if with end range different from vector.end()

    - by Edison Gustavo Muenz
    Hi, I need to remove elements from the middle of a std::vector. So I tried: struct IsEven { bool operator()(int ele) { return ele % 2 == 0; } }; int elements[] = {1, 2, 3, 4, 5, 6}; std::vector<int> ints(elements, elements+6); std::vector<int>::iterator it = std::remove_if(ints.begin() + 2, ints.begin() + 4, IsEven()); ints.erase(it, ints.end()); After this I would expect that the ints vector have: [1, 2, 3, 5, 6]. In the debugger of Visual studio 2008, after the std::remove_if line, the elements of ints are modified, I'm guessing I'm into some sort of undefined behaviour here. So, how do I remove elements from a Range of a vector?

    Read the article

  • How do you center a control in an MXML panel?

    - by George Edison
    Here is what I have: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#ffffff"> <mx:VBox percentHeight="100" percentWidth="100" > <mx:Image source="@Embed('img.png')" percentHeight="100" percentWidth="100" /> </mx:VBox> </mx:Application> How can I center the mx:Image in the mx:Application?

    Read the article

  • How can I get jsonp to play nice with my class?

    - by George Edison
    This whole jsonp thing is quite confusing... Here is what I want to do: I have a class DataRetriever The class has a method GetData GetData makes a jsonp request with the following code: var new_tag = document.createElement('script'); new_tag.type = 'text/javascript'; new_tag.src = 'http://somesite.com/somemethod?somedata'; // Add the element var bodyRef = document.getElementsByTagName("body").item(0); bodyRef.appendChild(new_tag); Now, the jsonp data from the server somesite.com can call a function in my code with the data. The problem is, how does the data get delivered to the instance of DataRetriever that requested it? I'm really stuck here.

    Read the article

  • What features would you like to see added to your favorite programming language?

    - by George Edison
    Are there any features you would like to see added to a programming language? Maybe... A programming construct An extra operator A built-in function you think would be useful I realize questions like this are frowned upon, but I think this one is a genuine programming question that can be answered and the answers will spawn valuable discussion. (And it's community wiki.) Here is one of mine: How come C++ has no exponent operator, like Python's **?

    Read the article

  • What features would you like to see added to C++?

    - by George Edison
    Are there any features you would like to see added to C++? Maybe... A programming construct An extra operator A built-in function you think would be useful I realize questions like this are frowned upon, but I think this one is a genuine programming question that can be answered and the answers will spawn valuable discussion. (And it's community wiki.) Here is one of mine: How come C++ has no exponent operator, like Python's **?

    Read the article

  • How to make std::vector's operator[] compile doing bounds checking in DEBUG but not in RELEASE

    - by Edison Gustavo Muenz
    I'm using Visual Studio 2008. I'm aware that std::vector has bounds checking with the at() function and has undefined behaviour if you try to access something using the operator [] incorrectly (out of range). I'm curious if it's possible to compile my program with the bounds checking. This way the operator[] would use the at() function and throw a std::out_of_range whenever something is out of bounds. The release mode would be compiled without bounds checking for operator[], so the performance doesn't degrade. I came into thinking about this because I'm migrating an app that was written using Borland C++ to Visual Studio and in a small part of the code I have this (with i=0, j=1): v[i][j]; //v is a std::vector<std::vector<int> > The size of the vector 'v' is [0][1] (so element 0 of the vector has only one element). This is undefined behaviour, I know, but Borland is returning 0 here, VS is crashing. I like the crash better than returning 0, so if I can get more 'crashes' by the std::out_of_range exception being thrown, the migration would be completed faster (so it would expose more bugs that Borland was hiding).

    Read the article

  • How come drawing this line at (0,0) doesn't really draw it at (0,0)?

    - by George Edison
    I have this ActionScript code here: package { import flash.display.Sprite; import flash.display.LineScaleMode; import flash.display.CapsStyle; import flash.display.JointStyle; import flash.display.Shape; import flash.events.Event; public class Main extends Sprite { private var lines:Shape; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point lines = new Shape(); addChild(lines); lines.graphics.clear(); lines.graphics.lineStyle(10, 0x000000); lines.graphics.moveTo(0, 0); lines.graphics.lineTo(stage.stageWidth, stage.stageHeight); } } } What I'm expecting this to do is to draw a line from one corner of the screen to the other... but that's not what it does. See here.

    Read the article

  • Is there any way to modify a column before it is ordered in MySQL?

    - by George Edison
    I have a table with a field value which is a varchar(255). The contents of the field can be quite varied: $1.20 $2994 $56 + tax (This one can be ignored or truncated to $56 if necessary) I have a query constructed: SELECT value FROM unnamed_table ORDER BY value However, this of course uses ASCII string comparison to order the results and does not use any numerical type of comparison. Is there a way to truly order by value without changing the field type to DECIMAL or something else? In other words, can the value field be modified ('$' removed, value converted to decimal) on the fly before the results are sorted?

    Read the article

  • Extremely strange glitch in Chrome - parses contents of string!

    - by George Edison
    Okay - this is the dumbest glitch I have seen in a while: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type='text/javascript'> var data = "</script>"; </script> </head> <body> This should break! </body> </html> This causes syntax errors because the JavaScript parser is actually reading the contents of the string. How stupid! How can I put </script> in my code. Is there any way? Is there a valid reason for this behavior?

    Read the article

  • Where can I find a jQuery color animation plugin?

    - by George Edison
    I need an up-to-date jQuery color animation plugin that works in IE 8. I tried using the one at http://plugins.jquery.com/project/color but it causes errors like "Invalid property value." in the following line of code from color.js: fx.elem.style[attr] = "rgb(" + [ Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) ].join(",") + ")"; Where can I get something that works? By the way, I really hate IE, if that helps.

    Read the article

  • Why is this <p> expanding the whole page?

    - by George Edison
    If you visit this page and shrink your browser window, you will see my problem. [If you want to open the page in a new window, just hold down shift when you click the link.] The answers to the question extend beyond the page margin instead of wrapping. I have spent the last half hour working with Chrome's Inspector and Firefox's DOM inspector - all to no avail. I just cannot figure out why it's doing this.

    Read the article

  • How to force a line break in a loooooong word in a DIV?

    - by George Edison
    Okay, this is really confusing me. I have some content inside of a div like so: <div style="background-color: green; width: 200px; height: 300px;"> Thisisatest.Thisisatest.Thisisatest.Thisisatest.Thisisatest.Thisisatest. </div> However, the content overflows the DIV (as expected) because the 'word' is too long. How can I force the browser to 'break' the word where necessary to fit all of the content inside?

    Read the article

  • How do you indent *every* line of a <span> element?

    - by George Edison
    I have the following HTML chunk: <span class='instruction_text'> Line 1<br> Line 2 </span> And the CSS declaration of instruction_text is: .instruction_text { margin-left: 70px; font-style: italic; color: #555; } The first line has a 70px margin as expected, but the next line starts with no indent. How can I make ALL of the lines indented?

    Read the article

  • How to convert List<int> to string[]?

    - by George Edison
    I need an easy way to convert a List<int> to a string array. I have: var the_list = new List<int>(); the_list.Add(1); the_list.Add(2); the_list.Add(3); string[] the_array = new string[the_list.Count]; for(var i = 0 ; i < the_array.Count; ++i) the_array[i] = the_list[i].ToString(); ...which looks to be very ugly to me. Is there an easier way? Note: I'm looking for an easier way - not necessarily a faster way.

    Read the article

  • How to display a status message in the Gnome panel?

    - by George Edison
    I have a Gnome applet I've been working on. It is written in Python and it displays the progress of something in a small label. My question is: what is the best way to display status notifications to the user? On Ubuntu, I notice that whenever I connect to a network or adjust the volume, a black box appears in the upper-right corner. Is there a way to do something like that with Python?

    Read the article

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