Search Results

Search found 175 results on 7 pages for 'edison'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • How come this image won't resize to fit the sprite?

    - by George Edison
    I have this snippet of ActionScript code that is supposed to resize an image to fit the sprite: package { import flash.display.Sprite; import flash.display.Bitmap; import flash.events.Event; public class Main extends Sprite { [Embed(source = 'img.png')] private var TheImage:Class; public static const TheImageWidth:Number = 1300; public static const TheImageHeight:Number = 1300; 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 var image:Bitmap = new TheImage(); addChild(image); image.scaleX = width / TheImageWidth; image.scaleY = height / TheImageHeight; } } } Why isn't it working?

    Read the article

  • How to get QWebKit to display image?

    - by George Edison
    Okay, I have a Qt executable in the same directory as a file logo.png. I call the following: QString msg("<html><body><img src='logo.png' /></body></html>"); webView->setHtml(msg); where webview is the QWebKit pointer However, when I execute the program, the image does not display. I am executing the program from the directory that the image is in... why won't it display?

    Read the article

  • How to write JavaScript to a separate window?

    - by George Edison
    I have opened a new window with JavaScript: var newwin = window.open('','preview','width=600,height=500'); Now I want to write some JavaScript to the window: newwin.document.write("<script type='text/javascript'>alert('Hi!');<" + "/script>"); newwin.document.close(); However, the script never gets executed. Am I doing something wrong?

    Read the article

  • How can I make one Code::Blocks project dependent on another?

    - by George Edison
    I have a workspace with two projects in it. One is a static library (we'll call it Project A). The other is a console app that links with the static library (we'll call it Project B). I went to Project B's properties and checked off Project A as a dependency of Project B. So I make a change to a file in Project A and rebuild Project B. It correctly discovers the changes to the file in Project A and rebuilds Project A. However, when it gets to Project B it says: Target is up to date. Nothing to be done. How can I tell it to run the linker everytime Project A is changed?

    Read the article

  • Why are $_POST variables getting escaped in PHP?

    - by George Edison
    When my PHP script receives data from an AJAX POST request, the $_POST variables are escaped. The really strange thing is that this only happens on my production server (running PHP 5.2.12 on Linux) and not on my local server (running PHP 5.3.1 on Windows). Here is the AJAX code: var pageRequest = false; if(window.XMLHttpRequest) pageRequest = new XMLHttpRequest(); else if(window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP"); pageRequest.onreadystatechange = function() { } var q_str = 'data=' + " ' "; pageRequest.open('POST','unnamed_page.php',true); pageRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); pageRequest.setRequestHeader("Content-length", q_str.length); pageRequest.setRequestHeader("Connection", "close"); pageRequest.send(q_str); Is there any reason this is happening? And how should I fix this so that it works on both servers?

    Read the article

  • Is there a glitch with opendir/readdir?

    - by George Edison
    Here is my PHP code: <?php // Enumerate the directories in styles $styles_dir = 'styles/'; if($handle = opendir($styles_dir)) { while(FALSE !== ($file = readdir($handle))) { echo $file . '(' . is_dir($file) . ')<br>'; } } ?> Here are the directories in styles: And here is the output: .(1) ..(1) forest() industrial() Why aren't forest and industrial directories?

    Read the article

  • How come checkbox state is not always passed along to PHP script?

    - by George Edison
    I have an HTML form: <form action='process.php' method='post'> <input type='checkbox' name='check_box_1' /> Check me!<br> </form> Here is a section from the PHP script process.php: echo (isset($_POST['check_box_1']))?'Set':'Not set'; The output of the script when the checkbox is set is Set But when the checkbox is not set, the output is: Not set Why is this? This seems like a very poor design because my PHP script checks a number of $_POST variables to make sure they were passed along to the script. When the $_POST['check_box_1'] value is not set, then how do I know whether the script failed to pass along the value or the checkbox was just not set?

    Read the article

  • How to set a local image in pynotify?

    - by George Edison
    If I run the following in python in Ubuntu 10.04: >>> import pynotify >>> p = pynotify.Notification ("Notice","","/home/george/Pictures/test.png") >>> p.show() true The message displays as expected, except the image does not appear in the OSD. How can I display a local image? In fact, for what I need, it would be better if I could display a remote image. (via HTTP) How can I do that?

    Read the article

  • 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 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 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 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

< Previous Page | 1 2 3 4 5 6 7  | Next Page >