|
Haha... Never thought like that . But true ! I can write a script and have it do it for me ! In the end, the prefix will only apply to my script: ABCDPrefixRemover.bat
Ashish Kaila
|
|
|
|
|
I had the reserve.
Wenn seeing my initials (PH) in an id i wen "What the... ? Why would I put my initials here? Was I drunk on imagined importance that day? I am soooo ashamed of myself!"
Only the next day I figured, it means "Post History". As the comment above it said.
(And no, "Post History" is not "the Present" in this context).
|
|
|
|
|
There was a guy at my last job who did that. And every one of my coworkers insisted I mark each change I made to a stored procedure with a comment containing my name so they know who made the change (so they could go to that programmer and ask him/her about it). They thought that was a better idea than version control. Even though the code was littered with names of old programmers who no longer worked there.
|
|
|
|
|
If it doesn't breach your development teams coding standards, then it's valid. You do have coding standards, yeah?
Microsoft's standards recommend TLA's should be title case ie: Dsrs not DSRS unless the TLA is only 2 letters in which case it should be all caps ie: System.IO.
The upside is that developers have there own approach to solving problems and tell-tale signatures like this will help you debug their code. Recognising individual programming styles is a good thing.
BTW it is crap but this sort of thing isn't uncommon. A better solution would be to extend the namespace to include Dsrs
|
|
|
|
|
Robert Croll wrote: Microsoft's standards recommend TLA's should be title case ie: Dsrs not DSRS unless the TLA is only 2 letters in which case it should be all caps ie: System.IO.
Robert Croll wrote: BTW it is crap but this sort of thing isn't uncommon. A better solution would be to extend the namespace to include Dsrs
Gotcha!
Greetings - Jacek
|
|
|
|
|
Robert Croll wrote: Microsoft's standards
Robert Croll wrote: is crap
'Nuff said.
I kid (mostly), but I never do anything "just because Microsoft says so".
|
|
|
|
|
|
Worse I had to deal with was single letters that weren't related.
for example
Table names A_EmployeeInformation, B_EmployeePay, A_EmployeeSpouseInfo, C_PayHistory
I asked the database guy um why the letters, he said it grouped them by function and I should know that being a DBA for 5 years, and then questioned if I knew anything about Database design. It was at that moment I had fears over the database, and I was right, cause then we started seeing AA, and BB for tables that were reference tables, and my favorites were the ABC tables reference table used by A, B, C tables.
Was so glad when I was removed from that program for a bigger profile one.
|
|
|
|
|
Well, then use you another prefix for your classes: "WTFisDSRS". If he asks you to remove that prefix, just answer: Yes, I will.. when you remove yours.
|
|
|
|
|
Being an old-timer, I have made a practice of prefixing a variable name with its type. For example, an integer for tracking the number of actions taken might be named intActions and a money variable (logical subclass of decimal) might be mnyCashIn . Even now, with much smarter compilers, I still do it. This makes my code consistent, whether old or new, compiled or script. It also simplifies porting between weakly typed languages and strongly typed languages.
|
|
|
|
|
It's called Hungarian Notation[^].
- S
50 cups of coffee and you know it's on!
Code, follow, or get out of the way.
|
|
|
|
|
.. and it was highly recommended for use in VB6.
|
|
|
|
|
Hey Bob,
I think it depends on the platform being used. If I am using a not so type safe platform where at coding time type cannot be inferred, then a prefix for denoting object type is perfectly valid. I am not so sure about type safe languages such as C#. Also the problem I described was prefixing of classes which again should be avoided in my opinion regardless of platform. Anyhow happy friday and happy coding !
Ashish
Ashish Kaila
|
|
|
|
|
WTF?
while (e) { Coyote(); }
|
|
|
|
|
"I hate TLAs." You may quote me.
|
|
|
|
|
In this software users have virtual money (so called 'coins'). You donate (real money) to get coins or you are very active on the platform, and for these coins you can buy extra features.
Recently the CEO asked me, why some users have millons of 'coins' on there account. So I looked at the code and I found this:
<p>This will cost you 9.99 of your coins.
Please acknowledge the transaction by clicking
on "Pay"</p>
<form method="post" action="">
(more stuff)
<input type="hidden" name="amount" value="9.99">
<input type="button" value="Pay">
</form>
And the PHP looked like this:
$query = "SELECT * FROM user WHERE id = $id";
$res = mysql_query($query);
while($row = mysql_fetch_array($res))
{
$amount = $row["amount"];
}
$amount = $amount - $_POST[amount];
$query = "UPDATE user SET amount = $amount WHERE id = $id";
I will not talk about all the other errors and flaws here, I'm just asking you: How is the math for:
4.55 -
-1,000,000 ?
|
|
|
|
|
I almost feel like asking where the web app is to mess around with it myself
|
|
|
|
|
i mean it!
The glorious "How-Not-To Programming", or "The 99 Don'ts of Web Development"
|
|
|
|
|
ok, so looks like you've got a job then - better get onto it and rewrite the app. If the CEO has written it without any programming skills, and he's attracted a bunch of keen users, and he's already got funding to employ you, then I'd say he's not doing too bad...
|
|
|
|
|
upon seeing all these code, I just want to poke my eyes out.
|
|
|
|
|
Is there any chance you could get him a job with Paypal? Please?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
I'm sorry, but I found the next one: There is a file that shows some statistics. It is called via ajax from the index page once per second (so it produces already a lot of traffic anyway).
This is a part of the code inside this file:
$query = mysql_query("SELECT * FROM " . $table . "");
$data = mysql_num_rows($query);
$query2 = mysql_query("SELECT * FROM " . $table . " WHERE status = 'Online'");
$data2 = mysql_num_rows($query2);
$query3 = mysql_query("SELECT * FROM articels");
$data3 = mysql_num_rows($query3);
$query4 = mysql_query("SELECT * FROM user");
$data4 = mysql_num_rows($query4);
$query5 = mysql_query("SELECT * FROM posts");
$data5 = mysql_num_rows($query5);
$query6 = mysql_query("SELECT * FROM url where url !=''");
$data6 = mysql_num_rows($query6);
I totally lost my faith.
|
|
|
|
|
Obviously, this is a test to see how well your infrastructure holds up to DDoS attacks. No horror in that!
|
|
|
|
|
Yes, and a test of my patience when he asks me again: 'Why is the serverload over 90?'
|
|
|
|
|
1. You are 100% correct..
2. It has even a more basic flaw than that.. it is very very fragile.. using 'Select *' is a surefire guarantee to invoke all kinds of downstream issues when the DB design changes.
As a fail, it is admirably complete.
|
|
|
|