How to learn to program 20 questions?
Anyone have any advice for learning to program a 20 questions game? Something that could learn in the future but doesn't necessarily need to learn right away. ...
Anyone have any advice for learning to program a 20 questions game? Something that could learn in the future but doesn't necessarily need to learn right away. ...
Hi, I've never understood why using a do while loops is necessary. I understand what they do, Which is to execute the code that the while loop contains without checking if the condition is true first. But isn't the below code: do{ document.write("ok"); } while(x == "10"); The exact same as: document.write("ok"); while(x == "10"...
I want to .... create a html-email containing several images (company header, etc). The images shall be displayed as email content, not as an attachement. So how is the best way to do this? I'm aware of two possibilities: embedded images send as attachment (<IMG src="cid:321353119@02062010-119E">) images are placed on the server (...
I have an interface named PropertyFilter which used to take a Propertyand decide if accepts it or not. And the world was good. But now the interface changed, so that implementations may choose to add additional Propertys. For example a Customer property might get expanded into Name and Address properties. I think it is obvious this is...
I have a few programming articles I would like to write, but I do not have a site of my own - yet ;). Is there a site that is specifically geared toward technical / programming topics, with great functionality and style? Or will I have to go with things like wordpress or blogspot? I would like a site that can track number of views and ...
Hey there, As I was writing another switch in Eclipse, I once again came across a rather weird (to me, at least) default indentation, which is applied to 'switch' statements: switch (i) { case 1: ... case n: ... } I tend to prefer another way: switch (i) { case 1: ... case n: ... } Which way is more...
Both Wikipedia and this site describe a similar step in the Simulated Annealing algorithm, which I've picked out here: Wikipedia: if P(e, enew, temp(k/kmax)) > random() then // Should we move to it? s ← snew; e ← enew // Yes, change state. Yuval Baror, regarding the Eight Queens puzzle: If moving t...
According to the Law of Demeter, can you call methods on returned objects? E.g. <?php class O { public function m($http) { $response = $http->get('http://www.google.com'); return $response->getBody(); // violation? } } ?> $http->get() returns an object. Does this count as an object created/instantiated wit...
Should my multithreaded application with read only properties require locking? Since nothing is being written I assume there is no need for locks, but I would like to make sure. Would the answer to this question be language agnostic? Without Lock: Private Const m_strFoo as String = "Foo" Public ReadOnly Property Foo() As String Get...
Someone recently asked a question about the Ghost Design Pattern - I have not seen this before. What is the Ghost Design Pattern and how is it implemented? I can only find snippets on the web in reference to it. ...
Here's briefly what I'm trying to do. The user supplies me with a link to a photo from one of several photo-sharing websites (such as Flickr, Zooomr, et. al). I then do some processing on the photo using their respective APIs. Right now, I'm only implementing one service, but I will most likely add more in the near future. I don't wan...
For TDD you have to Create a test that fail Do the simplest thing that could possible work to pass the test Add more variants of the test and repeat Refactor when a pattern emerge With this approach you're supposing to cover all the cases ( that comes to my mind at least) but I'm wonder if am I being too strict here and if it is p...
I am looking for good recommendations for scalable and/or parallel large graph analysis libraries in various languages. The problems I am working on involve significant computational analysis of graphs/networks with 1-100 million nodes and 10 million to 1+ billion edges. The largest SMP computer I am using has 256 GB memory, but I also...
Challenge: Without using the modulus divide operator provided already by your language, write a program that will take two integer inputs from a user and then displays the result of the first number modulus divided number by the second number. Assume all input is positive. Example: Input of first number:2 Input of second numbe...
hello. Simple question, is it possible to simplify (or replace division or modulo by less-expensive operation) (k/m)%n where variables are integers and operators are C style division and modulo operators. let me rephrase question slightly, except for case where variables are base2, under what conditions (e.g. some variable may be co...
To help support and anyone who may use one of my applications I tend to log a few things during the application startup. Currently I log: Start Time App Name App Author App Version App Classpath Current working directory Java vendor Java version Max heap size Taking into consideration this application may be used / supported by a wh...
It's the same syntax in a way too many languages: switch (someValue) { case OPTION_ONE: case OPTION_LIKE_ONE: case OPTION_ONE_SIMILAR: doSomeStuff1(); break; // EXIT the switch case OPTION_TWO_WITH_PRE_ACTION: doPreActionStuff2(); // the default is to CONTINUE to next case case OPTION_TWO: doSomeStuff2()...
I've a daunting task of getting familiair and possibly re-architecting large pieces of old source code. I was hoping there would be a nice tool to convert php (in my case), but let's make it more general: any language to PDF, for offline browsing on a Kindle or Ipad Would be ideal if it would create indexes / hyperlinks automatically. ...
How does undo work? Does it copy all the managed objects every time any of the values change? Or does it only copy the actual changes together with an information which objects were affected? Is that heavy or lightweight? ...
What are the basic and simpliest steganography algorithms and methods? I mean the steganography applied to images. How does simple program that hides data to images work? What are the main techniques used? How does the program recognize the encrypted message in image without the source image? ...