It's my first question here so tell me if I did anything wrong :)
So I'm a beginner to python and pygame and I went on to create a simple snake game.
Although I'm still messing around with the movement of the snake there seems to be a little problem when changing directions..
Do you think you ca...
in normal form you shouldn't have the comment Column in your user table.
you need to have a unique identifier in all of your tables
a Foreign Key is what matches another table's Primary Key
you should have a table that looks like this (forgive my blatantly bad syntax)
CREATE TABLE FeedBack
{...
@Donald.McLean - You know, at one point the sci-fi authors wrote about things that came true... now they come true so fast the sci-fi folk can't think far enough ahead:
@rolfl Reminds me about what the TV-series "Person of Interest" is about. After the second season of the show, the whole Snowden-thing started. Person of Interest and the new revealings about the NSA really go hand in hand
(The last half of that video will contain spoilers in case you haven't seen the show)
Since I posted that answer, I read a couple times in CR answers, that recursion is best avoided most of the times (and I agree) - I sort of wonder, is this a valid use of recursion?
Your printAllReports method does almost everything that's possible to do with the Outlook API (ok maybe not), except printing anything. You basically have what we call a monolith, and that's bad because as your program changes, you are tempted to just keep adding and adding and adding, until the ...
Your printAllReports method does almost everything that's possible to do with the Outlook API (ok maybe not), except printing anything. You basically have what we call a monolith, and that's bad because as your program changes, you are tempted to just keep adding and adding and adding, until the ...
@retailcoder I have it open and will take a little bit of time to read it again in a little bit after I post my VBScript, I am still pulling moths out of the computer
@SimonAndréForsberg it's creating a tree of users that report to other users (and that can have people that report to them) - I'm just wondering if it's a good problem to solve with recursion. (don't mean to appear to be sucking up for votes :/)
the Question
it failed the game/contest because of the time constraint, my thoughts are that this is a review for speed. being that I think it is on-topic, any other thoughts?
the Question
it failed the game/contest because of the time constraint, my thoughts are that this is a review for speed. being that I think it is on-topic, any other thoughts?
@Malachi But he is not asking for a code review. Both the question and the answers all contain the word "problems" or "issues". Besides, the code was given to him at an interview, he did not write the code.
Just wondering if there was someone out there that could offer help in optimizing my script.
<?php
/**
* If you don't understand what this does
* you have no hope as a programmer.
*
*/
function usage ( )
{
// Ahhh the marvels of echo, such a wonderful tool
// yet so advanced that a begin...
lp0 on fire (aka Printer on Fire) is a semi-obsolete error message generated on some Unix and Unix-like computer operating systems in response to certain types of printer errors. lp0 is the Unix device handle for the first line printer, but the error can be displayed for any printer attached to a Unix/Linux system. The message does not reliably indicate whether the printer in question is actually aflame.
History
The "on fire" message probably originated in the late 1950s, when high speed computerized printing was still a somewhat experimental field. The first documented fire-starting ...
"Moron", you moron!
/**
* In this function we make sure the end user isn't
* a total moran by checking weather we have access
* to certain hacker libraries.
*
**/
@rolfl real-life comment in the procedure I'm looking at right now: ' I add this because I'm realy tired about the error with this line: '(code) ' People spent a lot of time to try to fix this issue, but I still have this error so...
I am still a PHP beginner. Please review/make better my PHP code and show out the errors, typos and warnings.
<?php
date_default_timezone_set('UTC');
$connection = mysqli_connect("localhost", "root", "private_password", "busi"); //cannot specify password as it's private
function getIP(){
if(!em...
@rolfl @StackExchange must be blind, I can see you right now!
I would have received enthusiast by now if I would have been online at the 4th, but since I won't be able to get fanatic until April anyway, I didn't care so much about being online that day.
FYI, the definition of a Sudoku puzzle includes the constraint that "there must be one and only one solution". If it doesn't meet that, it's not a valid Sudoku puzzle. — John Deters2 mins ago
@retailcoder he's right, but, well, I have seen grids advertised as Sudoku's having ambiguous solutions, and, sometimes it's nice to know it's solvable (after you've been beating your head against it for hours)
@JohnDeters I believe the Sudoku puzzle definition itself doesn't specify whether or not one and only one solution must exist, see Wikipedia article (which says "The puzzle setter provides a partially completed grid, which typically has a unique solution.") and this blog post — Simon André Forsberg55 secs ago
AFAIK, there is no official constraint about the number of solutions for them. Just because nearly all of the ones that are published only have one doesn't mean that it's a requirement.
This is a console app I wrote for an end-of-chapter assignment in "Jumping into C++". The parameters were for it to have a basic password system, and if you had the determintion, a multiple password / username system.
I am going through this book completely on my own free will, it's not through ...
As a prevention against SQL injections, I'm using PDO. I have seen people using both the methods ie: bindValue() and then execute() or just execute(array())
Do both the methods prevent the attack? Since mysql_real_escape_string() is depricated is there anything else I should consider using here?...
Our instructor told us to create a basic Java program using everything we've learned in class thus far (basic prints, selection structures, looping, GUI, arrays, etc) and being a Pokemon fan, I decided to make a basic GUI Pokedex that lets the user search for the details of a particular starter P...
@Malachi Just posted an answer to a question over there, within seconds I had two comments telling me I was wrong, while I was currently working on editing my answer. I ended up with 5 upvotes and 2 downvotes. Seems like that question generated a whole lot of comments.
There is a difference here between HTML and XHTML. XHTML are more strict.
While old regular HTML does not enforce it for all tags, all tags in XHTML must have an ending tag** to validate. Even <br> and <img> is often written as <br /> or <img ... /> to specifically give them ending tags.
XHTML ...
@SimonAndréForsberg You can do all kinds of awesome stuff when using the XML-compatible syntax for HTML. For example: avoiding the tag soup reordering for when you really have to use an <aside>inside a paragraph.
I had a conversation with one of the interns here at work, about a Job interview... I said I had minimum standards for hiring people...... and one of them was whether they used xhtml by default, or HTML.
HTML is used by pwople with unstructured minds ... ;-) Whic is good for certain things, for sure, but not for the stuff most programmers need.
It is not good coding practice to leave out the end tags.
I learned XHTML and if you always write the end tags in
you will never have an issue if you need to change from HTML to XHTML
you will always know where the end of the element is
it's cleaner and easier to read.
all tags have a Begin...
These are all being used as global variables:
string usrnam[] = { "admin", "user", "" };
string pasword[] = { "root", "default", ""};
string temp_pass;
string temp_usr;
bool loggedin;
int n = sizeof(usrnam) / sizeof(string);
This is bad practice because any of these variables can be modifi...
wtf... I just discovered something I really didn't know. This actually compiles fine and throws NullPointerException: (Java, of course) public void shortestNPEever() { throw null; } Did you know this, @rolfl?
would someone so nice and improve this code? Because it looks a little beat heavy for me ;)
http://i-code.co.uk/javascript/decryptingtext.php
Faster on fiddle? Yes!
@SimonAndréForsberg - If I admit it, I will tell you about a story about someone (*cough* monkey *cough*) who had a helper-method to determine the message for an exception, and had the following code:
} catch (Type1Exception t1e) { throw buildException(mycomplexdata, t1e); } catch (Type2Exception t2e) { throw buildException(mycomplexdata, t2e): } ..... and so on ....
but, under some conditions, the buildException(...) method returned null....
It took me hours to figure out where the *brains* the NPE was coming from
As long as you are hard-coding the values, I would go with an enum
public enum Muppets {
Kermit, Gonzo, Fozzie, Animal, Swedish_Chef, Miss_Piggy,
Statler, Waldorf, Beaker, Beauregard, Dr_Benson_Honeydew,
Crazy_Harry, Rowlf, Dr_Teeth, Zoot, Janice, Floyd;
// Sorry, I just thought ...
this is another script that is used as a token to extract information from a 3rd party application, the application does other things in the background that I don't specifically know about.
this code does work inside the parent application and produces the expected output.
Is there a nicer w...
this is another script that is used as a token to extract information from a 3rd party application, the application does other things in the background that I don't specifically know about.
this code does work inside the parent application and produces the expected output.
Is there a nicer w...
We're doing some spring cleaning on Super User, which involves disambiguating tags, merging them, creating synonyms etc.
However, one of the most troublesome things is removing a tag.
Often, it's easy enough to agree that a tag should be burninated completely, possibly even blacklisted. But the...
I am asked to sort an array by implementing a quick sort algorithm. This is my code below, but the problem is that when I call the method in my main class, it shows an error! The error happens in this line no 33: qs.partition(arr, left, right); it says that the varible right, left are not found. ...
Hi Sara (Jabir?), unfortunately (I mean it) I'm afraid we can't help you much here on Code Review - only working code can be reviewed per our Help Center. If you need help with solving a specific error you're getting, you're probably better off posting a narrowed-down version of your code (just what's relevant to the error) on StackOverflow instead, and then come back here with your working code :) - Best of luck! — retailcoder26 secs ago
Can I simplify or erase that vector 'u'?
Or how could I improve this part of the code?
a <- matrix(diag(-1, n2), nrow = n2, ncol = n1*n2)
u<-c(rep(1,n2),rep(0,n1*n2))
p<-c(rep(u,n1-1),rep(1,n2))
B<-rbind(matrix(p,nrow=n1,ncol=n1*n2,byrow=TRUE),a)
@retailcoder If you search for the name given in the corresponding stackoverflow account, you will find a matching G+ page … with a 4.5k word essay in the “motto” field.
The question roughly matches a 2nd year CS curriculum, so it seems to fit
@retailcoder likely not, but I can't find any attribution (and I don't really want to visit the kinds of blogs that use this picture). I guess it was originally stolen from a genuine user profile.
Sentiment analysis (opinion mining)
Sentiment analysis, which is also called opinion mining, involves building a system to collect and examine opinions about some object in blog posts, comments, reviews or tweets.
This challenge will have to be watered down a bit so that people will not be ov...
So let's start at the beginning before we head jump into my code mumblings, Minecraft is a game which also has multiplayer capabilities. You need to have an account (which needs to be verified) for playing on servers. The authentication procedure looks like this:
Authenticate at the Mojang (cre...
The following is used to create a masonry effect with varying height rectangles. How can I simplify and make this more elegant in Unity?
private float startX = 0.0f;
private float startY = 0.0f;
private float posX = 0.0f;
private float posY = 0.0f;
private float prevWidth = 0...