Search Results

Search found 2525 results on 101 pages for 'jared green'.

Page 20/101 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Loop colours from variables for graphics.py [Python 3.2]

    - by user1056548
    I am creating a graphics program that draws 100 x 100 squares next to each other depending on the user-specified grid size. The user also inputs 4 colours for the squares to be coloured (e.g. if they enter red,green,blue,yellow the squares will be coloured in that order, repeating the colours). Is it possible to loop the colours from the variables the user has given? Here is what I have so far: def main(): print ("Please enter four comma seperated colours e.g.: 'red,green,blue,yellow'\n\ Allowed colours are: red, green, blue, yellow and cyan") col1, col2, col3, col4 = input("Enter your four colours: ").split(',') win = GraphWin ("Squares", 500, 500) colours = [col1, col2, col3, col4] drawSquare (win, col1, col2, col3, col4, colours) win.getMouse() win.close() def drawSquare(win, col1, col2, col3, col4, colours): for i in range (4): for j in range (len(colours)): colour = colours[j] x = 50 + (i * 50) circle = Circle (Point (x,50), 20) circle.setFill(colour) circle.draw(win) I think I should be using a list in some way, but can't work out exactly how to do it. Can anybody help?

    Read the article

  • C/C++ enum and char * array

    - by Eric M
    Ran accross the following code in an article and didn't think it was standard C/C++ syntax for the char* array. As a test, both Visual C++ (visual studio 2005) and C++ Builder Rad XE both reject the 2nd line. Without using #defines, anyone have any tricks/tips for keeping enums and a string array sort of in sync without resorting to STL ? More of a curiosity question. enum TCOLOR { RED, GREEN, BLUE }; char *TNCOLOR[] = { [RED]="Red", [GREEN]="Green", [BLUE]="Blue" }; as an aside, the article this came from is quite old and I believe this might work under GCC but have not tested.

    Read the article

  • Color blindness: Are you aware of it? Do you design for it?

    - by User
    I'm curious whether many of us who do design or take design decisions have ever heard of this problem. I'm aware there are dangerous color combinations, like green + red. This is probably one of the most popular cases of color blindness. If you have green text on a red background and vice versa some people won't see anything. I've also seen in practice that green text on a blue background was not seen by one guy. What other color compositions should be avoided, and how often these cases are to be expected? Let us make some ranging by encounter probability who has the numbers. Addition: I've just remembered one very bad example that causes problems to just about everyone - blue text on a black background. It's unreadable for all intents and purposes. Never could understand what could possibly compel a web master to use this color combination...

    Read the article

  • Can I create a new project based on GNU GPL v2?

    - by Jared Pearson
    I've found a SourceForge project with a solid core that I would like to improve. The project hasn't been updated since 2007 so I assume it is "dead". I sent an e-mail asking to become a contributor to the listed project manager last week but still haven't received a response. The project is licensed under the GNU GPL v2. I would like to contribute to the current project but that doesn't appear to be possible. Can I modify the current source version of the project and release this modified project? I would keep the same license on the modified project.

    Read the article

  • What is there so useful in the Decorator Pattern? My example doesn't work

    - by Green
    The book says: The decorator pattern can be used to extend (decorate) the functionality of a certain object I have a rabbit animal. And I want my rabbit to have, for example, reptile skin. Just want to decorate a common rabbit with reptile skin. I have the code. First I have abstract class Animal with everythig that is common to any animal: abstract class Animal { abstract public function setSleep($hours); abstract public function setEat($food); abstract public function getSkinType(); /* and more methods which for sure will be implemented in any concrete animal */ } I create class for my rabbit: class Rabbit extends Animal { private $rest; private $stomach; private $skinType = "hair"; public function setSleep($hours) { $this->rest = $hours; } public function setFood($food) { $this->stomach = $food; } public function getSkinType() { return $this->$skinType; } } Up to now everything is OK. Then I create abstract AnimalDecorator class which extends Animal: abstract class AnimalDecorator extends Animal { protected $animal; public function __construct(Animal $animal) { $this->animal = $animal; } } And here the problem comes. Pay attention that AnimalDecorator also gets all the abstract methods from the Animal class (in this example just two but in real can have many more). Then I create concrete ReptileSkinDecorator class which extends AnimalDecorator. It also has those the same two abstract methods from Animal: class ReptileSkinDecorator extends AnimalDecorator { public function getSkinColor() { $skin = $this->animal->getSkinType(); $skin = "reptile"; return $skin; } } And finaly I want to decorate my rabbit with reptile skin: $reptileSkinRabbit = ReptileSkinDecorator(new Rabbit()); But I can't do this because I have two abstract methods in ReptileSkinDecorator class. They are: abstract public function setSleep($hours); abstract public function setEat($food); So, instead of just re-decorating only skin I also have to re-decorate setSleep() and setEat(); methods. But I don't need to. In all the book examples there is always ONLY ONE abstract method in Animal class. And of course it works then. But here I just made very simple real life example and tried to use the Decorator pattern and it doesn't work without implementing those abstract methods in ReptileSkinDecorator class. It means that if I want to use my example I have to create a brand new rabbit and implement for it its own setSleep() and setEat() methods. OK, let it be. But then this brand new rabbit has the instance of commont Rabbit I passed to ReptileSkinDecorator: $reptileSkinRabbit = ReptileSkinDecorator(new Rabbit()); I have one common rabbit instance with its own methods in the reptileSkinRabbit instance which in its turn has its own reptileSkinRabbit methods. I have rabbit in rabbit. But I think I don't have to have such possibility. I don't understand the Decarator pattern right way. Kindly ask you to point on any mistakes in my example, in my understanding of this pattern. Thank you.

    Read the article

  • By-name repeated parameters

    - by Green Hyena
    How to pass by-name repeated parameters in Scala? The following code fails to work: scala> def foo(s: (=> String)*) = { <console>:1: error: no by-name parameter type allowed here def foo(s: (=> String)*) = { ^ Is there any other way I could pass a variable number of by name parameters to the method?

    Read the article

  • Teaching a mainframe COBOL programmer Java?

    - by Jared
    I’m trying to help someone learn Java who’s only programming experience is COBOL on the mainframe. I was wondering if anyone knew any good resources for object oriented concepts. I learned how to program with C++ so just understand the theory behind basic OOP. I’m more concerned about a way to get the basic concepts across, such as encapsulation and inheritance rather then Java syntax. I think it’d be better to teach the concepts of OOP then a language rather then trying to cram both a new language and paradigm in at the same time. Does anyone have any resources or ideas that could help this person learn OOP followed by Java?

    Read the article

  • What are some Maven project naming conventions for web application module?

    - by Jared Pearson
    When creating a project with the webapp archetype in Maven, they subtly advise not putting any Java source in the webapp project by not including the "src/main/java" folder. What do you name your Maven projects? project-webapp for the project that contains the JSP, CSS, Images, etc. project for the project that contains domain specific entities ? for the project that contains the web application files like Servlets, Listeners, etc. My first inclination would be to use "webapp" for the project containing the web application files (Servlets/Listeners), however the archetype uses "webapp" to convey the JSP/CSS/Images project and would cause confusion to other developers.

    Read the article

  • Float over two elements

    - by eWolf
    My problem is rather complex to explain, so I'll show you an example: http://ewolf.bplaced.de/misc/float.htm I want to have a floated element (the blue box) to be be placed over two other elements (red and green) and I want the whole thing to be fixed-width and centered (done by the box with the black border) while the background of the red and green box should fill the whole width. I'm actually not quite sure if the way I've done it now is XHTML/CSS valid, but it works - at least in Firefox. In IE6, the green box expands to fit the whole blue box - how can I fix this in IE6 or find another solution to show it correctly in all browsers?

    Read the article

  • Where can I get free real-time stock data?

    - by Jared
    Does anyone know of a way to obtain free real-time stock data or near real-time stock data? I'd like to do this since I'm interested in the financial market, not for use in investment applications which is why I'm looking for something free. I've tried the Perl module Finance::YahooQuote but some of the fields such as last trade time appear to be broken. I've looked at the historical data but it doesn't fit my needs since I'd like to monitor the movements of the markets and stocks during the trading day not just open and close. I've also looked at http://www.opentick.com but they aren’t accepting new accounts and I can't find a timeline for when their network upgrade will be complete.

    Read the article

  • MySQL: Count occurrences of known (or enumerated) distinct values

    - by Eilidh
    After looking at how to count the occurrences of distinct values in a field, I am wondering how to count the occurrences of each distinct value if the distinct values are known (or enumerated). For example, if I have a simple table - TrafficLight Colour ------------ ------ 1 Red 2 Amber 3 Red 4 Red 5 Green 6 Green where one column (in this case Colour) has known (or enumerated) distinct values, how could I return the count for each colour as a separate value, rather than as an array, as in the linked example. To return an array with a count of each colour (using the same method as in the linked example), the query would be something like SELECT Colour COUNT(*) AS ColourCount FROM TrafficLights GROUP BY Colour, and return an array - Colour ColourCount ------ ----------- Red 3 Amber 1 Green 2 What I would like to do is to return the count for each Colour AS a separate total (e.g. RedCount). How can I do this?

    Read the article

  • apc_delete() not working in background script

    - by Jared
    I have a shell background convertor on my video website and I can't seem to get APC to delete a key as a file is uploaded and its visibility is updated. The script is structured like so: if(file_exists($output_file)) { $conn->query("UPDATE `foo` SET `bar` = 1 WHERE `id` = ".$id." LIMIT 1"); apc_delete('feed:'.$id); } Everything works fine except for the APC and this is the only script on the site that has had this problem. I'm stumped.

    Read the article

  • How to call another class's method from my app delegate

    - by Jared
    I have an application that utilizes UILocalNotifications to pop-up UIAlertViews. When the notification fires, the user chooses to go into the app, and this method is called from my app delegate: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {...} Where I can handle it and where I also prompt another alertview for more information. So when the app launches, it is displaying view A, and then the alertview pops up and prompts for input. This alertview, however, is originating from my app delegate. I need to be able to reload view A when the user hits Yes/No on the alertview. How can I do that from within my app delegate? Any help is appreciated!!

    Read the article

  • Can I create a new project based on an abandoned one licenced under GNU GPL v2?

    - by Jared Pearson
    I've found a SourceForge project with a solid core that I would like to improve. The project hasn't been updated since 2007 so I assume it is "dead". I sent an e-mail asking to become a contributor to the listed project manager last week but still haven't received a response. The project is licensed under the GNU GPL v2. I would like to contribute to the current project but that doesn't appear to be possible. Can I modify the current source version of the project and release this modified project? I would keep the same license on the modified project.

    Read the article

  • 'Auto' option missing for TreeView subclass

    - by Jared
    I've created a custom control that subclasses TreeView. Right now it's completely empty, doesn't override anything. However when I place an instance in the designer the 'Auto' value for the Width and Height fields is no longer available as it is with the default TreeView. What am I missing?

    Read the article

  • How can a web developer learn to develop for the iPhone?

    - by Jared Christensen
    I'm a web developer and I'm getting envious of all the cool iPhone apps. I know nothing about C or what ever language they use to make iPhone apps. I really have no idea where to start. What do I need to do? Should I take a class, buy a book? I have a pretty good grasp on programing, I do tons of HTML, CSS and Javascript development and some PHP and Action Scripting. I'm not very good with Object Oriented Programing but I think I could pick it up if I used it more. I love video tutorials like lynda.com or net.tutsplus.com. I learn best buy jumping in and getting my hands dirty.

    Read the article

  • How do I load only a single wordpress post via the url?

    - by Jared
    Hello, We are currently undergoing some reworking of our website - in the meantime, I am looking for a quick a dirty fix. We have wordpress setup, so that no-so-tech-savvy employees can add events, news, etc. However, there are currently sections on our site dedicated to what would be tags in Wordpress. For instance, we have posts in WP with the tag "events." It's easy enough to display all posts with that tag, but I need to do a PHP include on our old site, and only show JUST THE POST. I can use a rss2html tool, but it strips out somethings like necessary tables. So how do Display only a single WP post, without anything else (no menus, settings, no Wp interface) via a URL? I could use a theme that is stripped down (by using something like theme switcher), but I need it to only load that theme once, not be the default theme....

    Read the article

  • Separating an Array into a comma seperated string with quotes

    - by user548744
    I'm manually building an SQL query where I'm using an Array in the params hash for an SQL IN statement, like: ("WHERE my_field IN('blue','green','red')"). So I need to take the contents of the array and output them into a string where each element is single quoted and comma seperated (and with no ending comma). So if the array was: my_array = ['blue','green','red'] I'd need a string that looked like: "'blue','green','red'" I'm pretty new to Ruby/Rails but came up with something that worked: if !params[:colors].nil? @categories_array = params[:colors][:categories] @categories_string ="" for x in @categories_array @categories_string += "'" + x + "'," end @categories_string.chop! #remove the last comma end So, I'm good but curious as to what a proper and more consise way of doing this would look like? Thanks

    Read the article

  • I'm confused, how do I control cache so my clients can see website edits.

    - by Jared Christensen
    I host about 10 websites for clients. Every so often a client will ask for an update to their website. It may be a simple image change, new PDF or a simple text change. I make the change and then send them a link to the web page with the update. About an hour later I will get an email back from the client telling me they still see the old page. I will then explaining to them how to empty their browsers cache. What I'm trying to figure out is if there is a way I can tell their browser that I made an update to the website and that it should reload the page and update the cache. I thought about trying a meta tag but I read that they are not very reliable. Also I would still like the page to cache I just want to be able to clear it when I make an update. Is this possible? I'm an advanced front end web developer (HTML, CSS, Javascript) and know some PHP. Cache is just one of those things I don't really understand that well.

    Read the article

  • How to change the icon in the title bar in R?

    - by Jared
    I just installed R 2.11.0-x64 onto my Windows 7 Professional machine. With my previous installations of R (2.10.1 32 bit was the most recent) the little icon that appeared in the title bar and in the taskbar at the bottom of windows was the R "R." Now however, the icon almost looks like a small windows Task Manager. I know this isn't a code issue, but it affects me as I flip between windows. Is there a way to put the "R" icon back in there? Would it be an R setting or a Windows setting?

    Read the article

  • How to index and search .doc files

    - by Jared
    I have an application that needs to have .doc files uploaded to it. These documents should then be index and the whole collection of documents should be searchable. This will run on a Windows Server, without Word installed, using IIS and SqlServer, but I'd rather not be tied to SqlServer's full text indexing. I was thinking of using Lucene.Net for the indexing part and was wondering what the best way to get the text out of the .doc files would be. I could probably extract the text by reading in the whole stream and then using a regEx to pull out any regular characters, but that seems hefty and prone to error. I saw an article on using iFilters that sounds promising, but I thought I'd put this out there since it's not something I'm familiar with. P.S. If it matters, these .doc files will have mail-merge fields in them and there's no other current alternative for the .doc format.

    Read the article

  • Can any Texter users answer this question?

    - by Jared
    I have recently started using the excellent Texter. I wanted to set up a shortcut for creating html comments. However that it seems that the exclamation character (!) has special significance in the program, and so does not come out in script mode. This character is of course required for...<!-- html comment here --> Here is the code I tried to create the shortcut... {HOME}<!-- {END}{BS} --> Just wondering if there is a way of getting around this problem?? Cheers

    Read the article

  • Accessing an EJB deployed on websphere community server using Open EJB?

    - by Jared
    How can I access an EJB deployed on websphere community server using Open EJB? I'm trying to use code like the following but am not sure what to use for a URL. Note I've tried port 2809 and 1099 with ejb: and IIOP URL prefixes. Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory"); props.put(Context.PROVIDER_URL,"IIOP://127.0.0.1:2809"); Context ctx = new InitialContext(props); Object ref = ctx.lookup("CalculatorRemote "); CalculatorImpl h = (CalculatorImpl )PortableRemoteObject.narrow(ref,CalculatorImpl.class);

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >