I don't mean using it anywhere, I use it when it will always be a simple assignment and makes it clearer.
And yes, I cannot spell guage, necassary, or oppisite. I need to sit down and spell them out a hundred times until I get them down pat.
I don't mean using it anywhere, I use it when it will always be a simple assignment and makes it clearer.
And yes, I cannot spell guage, necassary, or oppisite. I need to sit down and spell them out a hundred times until I get them down pat.
Many if-else statements can simply be modified to use the ternary operator, but many programmers are either unfamiliar with it or unwilling to use it. I try to use it where ever possible and I find you can guage a coder's skill based on their using it. But that measurement went out the window the other day:
x = (logic statement) ? true : false;
Multiple times throughout their code, and the occasional:
x = (logic statement) ? false : true;
Yes., I know I screwed up by mentioning my son's name to the school administrative office, but I did it to help out our customer's sales guy; he was worried it was going to screw up his sale. I never in a million years would have guessed it could be interperted as my son (again, SIX years old) hacking.
As for the test data, it was something I entered to A) make sure everything work, and B) have an account I could log into if the customer complained about something being broken. I actually don't see how you cannot have some sort of test data even on a production system, especially one with privacy concerns. We also are not technically allowed access to the student's information. It's just making sure the test data is isolated and fake is the lesson I learned.
The text book web site we wrote for our customer was selling fairly well for them. They were quite pleased with the performance, but more importantly they were really pleased with some of the extra bits we put in to solve customer problems. Their calls had been reduced more than 50% with the new release, and the new tools we gave the customer service people reduced solve times considerably as well. Of course, no system is perfect, and customer service finally got a call they couldn’t solve.
One of their new schools couldn’t use their activation code to access the site. It kept telling them that the school was already a customer. But there was no related data or users according to the customer service representative who contacted us. A quick database check confirmed that. Since the school was but a pilot for city with the possibility of the other schools buying in later, our customer’s sales person (who mainly got paid via commission) asked us to escalate the problem to a high priority level. We were called into the project manager’s office to discuss the problem and delegate. The problem was explained, a few possible explanations were discussed, and eventually a plan put in place to figure out the problem. The project manager sent the school information via email and we hustled back to find out the problem.
Anytime a school designated as “new” was signed up, a special activation code is given to the customer. Once a user is added the school loses its “new” status and only the first user can add additional users. This was done deliberately to avoid multiple purchases of the same product at the same school, and it worked for the most part. Here the problem was that a user already existed for the school, one that the customer service representatives were not allowed to view due to privacy concerns.
As soon as I saw the school in the email, I knew what the problem was. I had entered my son, attached to his real life school, as a test user. Technically, my son was in charge of the entire school’s accounts. Since he was a student, customer service could not see him. I removed my son’s account and the activation code worked fine after that. After a lengthy explanation to the customer, I personally called the school’s district administrative offices and explained the situation to them as well so they would realize they were not using a buggy product.
Of course, schools being overreactive, my wife soon got a call that she needed to come in. She got to the school to find my very scared son in the principal’s office for “hacking.” Of course, the principal was as confused as to exactly why my son was in his office. Especially since my son was SIX at the time. Apparently an administrator at the district’s office had interpreted my explanation into my son hacking into the system, but never bothered to check his age before reporting him. While the principal was trying to figure out why one of his first-graders was being accused of hacking (he actually said to my wife at one point, “Hell, if he broke into the school’s system I’m going to put him in charge of it,”) my wife called me to let me know what was going on, and fortunately it didn’t take long to put the matter to rest after that.
We now use a non-existent school with made up student names for all testing purposes. The entire school district now uses the product. And my son (who is now 9) loves to remind me about the only time he got sent to the principal's office was my fault.
@chrismcb said:
Turns out "_" is an invalid character in a DNS name. So I would recommend NOT using "staging_customername"
I changed the names of all the server just in case my manager actually reads the site. The name actually has a hyphen, not an underscore (staging-customername), but I've been doing a lotof Ruby programming lately and have underscores on my brain when it comes to naming.
Names changed to protect the innocent (and my job.)
There is nothing worse than code that works on one machine and not another. It's even worse when it works in multiple machines but not all of them. In this case it worked everywhere but one place. And of course that was the place where we needed it.
It was one web page, but one the customer desperately needed to work. It worked on the development machines, our qa machine, the customer's qa machines, the staging machine, but not the production machine. Since I was in charge of building and deploying to most of these, the problem fell upon me to fix.
Since the ear was directly copied from the staging to production and the former worked, I doubted anything within the ear was the issue but I used an MD5 hash and check to make sure. Exact match. So it had to be in the configuration. I checked all the differences, even using compare software. Everything was the same where it should be, and different where it should be. I swapped some of the configurations around on the two boxes (such as the database), but staging always worked and production never did. At one point they were completely swapped, and I sat staring at them. The words of Sherlock Holmes came to me, although not exactly as written by Doyle:
"How often have I said to you that when you have eliminated the impossible, whatever remains, however improbable, must be the truth"
It had to be the URL I was using on production as it this point it was the only difference on the two instances. I used the numeric IP address, and sure enough, it worked fine.Why the hell would that happen?
Most of the machines URLs were based off of our company name and the customer's name: staging_customername.ourcompanyname.com\captain
The production machine used the customers web site: captain.customername.com\captain
The word "captain" showing up twice was my first clue. I looked at the code for the page:
<font color="black"><font size="2"><font face="Arial">newPath</font></font></font><font color="black" size="2" face="Arial"> =oldPath.substring(0, oldPath.indexOf("captain")) + "content";</font>
After a nice face palm, I sent an email to the offending developer explaing the problem and asking them to use one of the functions we already had in place to grab the base URL. I realized I could have fixed it myself, but I wanted to make him aware of the built in functionality for such instances since he was relatively new.
This is the code that was checked in:
<font color="black"><font size="2"><font face="Arial">newPath</font></font></font><font color="black" size="2" face="Arial"> =oldPath.substring(0, oldPath.indexOf("/captain")) + "/content";</font>
And there's the second facepalm.
I am responsible for the software maintenance of 12 offsite servers all doing the same thing for redundancy and loads. By offsite, I mean about a thousand miles away from where I work, which is why I am only responsible for the software. Occasionally, the software we use needs to be updated and the machine rebooted. To avoid conflicts with people actually using the servers, I usually do these after hours, but I do it from home instead of waiting in the office.
One night, I began the process of updating all the servers and then rebooting. On one of the machines I accidently shut it down instead of rebooting. I called the call center where our servers were located, and a nice gentleman there had it restarted quickly enough so that the total downtime of the machine was less than 5 minutes. I than decided to create a “restart only” script to use so I wouldn’t do it again.
As luck would have it, all reboots and shutdowns are logged and the logs sent to various people. My manager’s manager being one of those people. And in great Pointy-haired boss fashion, he sent a memo that stated any reboots must be done by TWO persons, his logic being that one person to reboot and one person to watch them to make sure they didn’t accidently shut the machine down. I replied this was no longer necessary since I implemented new scripts that would prevent accidently shutdowns, which in turn got me send to my manager’s office for “not restarting the machine in the proper manner.” My manager is a pretty good guy and fought the issue, but in the end we had to use the “new way.” He said his manager mentioned “Two heads are better than one,” at least four times during their discussion. And did I mention I had to log both people’s names, complete with signatures for each restart? All because I took one machine down (a redundant machine, mind you) for less than five minutes?
A few weeks later, I was notified of a software update that had to be done that night. I was at home that evening, but I managed to get it done anyways, and handed the log sheets to my manager the next day. He looked at the sheet and began to laugh. He looked at me and nodded with his approval, filing the sheet.
The two names, complete with signatures? Mine, followed by my 4 year old son, who can write his own name AND now knows how to read the words “RESTART” and “SHUTDOWN”. The memo only said “two persons”, not “two employees.” My son has been part of the update process ever since.
A new engineer was hired for our team; he managed to get the project running in our IDE in less than a day which immediately told us he had at least half a clue. Asked to get him started, I figured a simple report page we needed for our customer was a good way to introduce him to the system. It was a simple report showing all the teachers in a school and their classrooms. The next day he checked in and let me know it was done. Impressed, I ran the report. It worked beautifully. It ran under different users, took multiple parameters beyond the original scope, and had good error messages when there was a problem. This guy knew what he was doing. I decided to look under the hood. Code was fantastic, well formatted, and even concise informative comments, but he used very truncated variable names, and I realized I had forgotten to mention our coding standards document. I didn’t really care about this since it was such a basic report (it was just a web page with very basic formatting), but then I noticed it. Very subtle because of the case usage on the abbreviation of the second word, but I realized I couldn't pass this code on to our customer:
//Get all teachers
for (Iterator tIt = al.Iterator(); tIt.hasNext();)
{
tchr = (Teacher) tIt.next()
…
//Get the teacher's classrooms
for (Iterator clIt = tchr.getClassrooms().iterator; clIt.hasNext();)
{
clrm = (Classroom) clIt.next();
...
}
}
This was quite some years ago; he is still with us and follows the standards doc to the letter.
I volunteer at our local historical society by maintaining their web site and keeping the computers and Internet connection running at their building. The guy who runs the place, Fred, called me last week because they could no longer connect to the Internet. I got up early Sunday morning and Fred was there to let me in. They use DSL in conjunction with their phone number. I went through the usual checks, making sure everything was connected, the phone had a dial tone, etc. I quickly noticed that the DSL router's Internet light was not lit up, so I figured I would reset it. I waited about a minute, but still no Internet light. I tried resetting it again, still nothing, so I decided the next step would be to call the provider to test the line. Of course we didn't have the number handy, but we managed to use the yellow pages to get the number. I called up, patiently went through all the automated steps and testing before finally being connected with a rep. She verified some information and then told me she was going to test the line. A second later she told me, "Sir, the account is showing as being deactivated." She then very apologetically informed me that she couldn't reactivate it, I would have to call the accounts department during regular business hours.
After hanging up, I said to Fred and said, "That's odd, they said the account was deactivated."
His reply: "Well, we cancelled it because it was costing too much money."
I wonder how many more hours of sleep I would have gotten.