|
I actually saw a website on internet security do that!
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
POST is far too complicated. GET is so much easier.
|
|
|
|
|
[Sarcasm start]
Yes, and on the client side especially. Even if you use jQuery.Ajax, POST is soooo much more complicated than GET . You have to type an extra letter, which is much more effort than should be required for anyone. For instance, this is a jQuery GET call:
$.ajax({
type : 'GET',
url : "url.jsp",
data: {
id: client_id,
action_code: 2,
action_data: $('#content').val()
},
success: function(result) {
$('#list-content').html(result);
},
error: function(result) {
alert(result);
},
});
compared to...this abomination:
$.ajax({
type : 'POST',
url : "url.jsp",
data: {
id: client_id,
action_code: 2,
action_data: $('#content').val()
},
success: function(result) {
$('#list-content').html(result);
},
error: function(result) {
alert(result);
},
});
Notice the difference? It's soooooomuch easier to simply GET instead of POST -ing, isn't it?
[/Sarcasm end]
On the other hand, I'm having fun now with LINQ parsing the list of products from suppliers (didn't get to play with LINQ so far, but I'm quite liking it. Heard it's pretty slow compared to the other alternatives, but in my case speed is not that much of an issue)
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
modified 9-Aug-12 5:22am.
|
|
|
|
|
Looking forward to seeing some gems from their XML/XSD files!
|
|
|
|
|
Yeah, it's totally inconsistent. For instance, product data is stored as:
<Product>
<ProductCode>...</ProductCode>
<Vendor>...</Vendor>
<ProductType>...</ProductType>
...
</Product>
whereas product attributes (for instance, product specs) are stored as:
<Product>
<AttrList>
<element Name="Cable Functionality" Value="SCSI External Cable"/>
<element Name="Platform Compability" Value="PC"/>
<element Name="Left Connector Type" Value="HD D-Sub 68-pin"/>
...
</AttrList>
</Product>
Which would make sense up to a point (after all, maybe product attributes should be stored as xml node attributes, who knows? ).
However, there are different types of nodes as well. Images links, for instance, which should be stored in the same way as product attributes are stored, being attributes too after all, right? Wrong!!! They're stored just like general product info:
<Images>
<Image>https://....jpg</Image>
<Image>https://....jpg</Image>
<Image>https://....jpg</Image>
<Image>https://....jpg</Image>
</Images>
And then comes MarketingInfo (product description), which is stored just like the attributes list.
Other than that, I dunno, at least it's structured humanly-readable?
Buuuuuuuuuuut...Thank God for Linq on this one. Parsing came out pretty elegantly
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Andrei Straut wrote: On the other hand, I'm having fun now with LINQ parsing the list of products from suppliers (didn't get to play with LINQ so far, but I'm quite liking it. Heard it's pretty slow compared to the other alternatives, but in my case speed is not that much of an issue)
One thing that can make LINQ slow is not caching query results appropriately. (Not saying it's not slow to begin with; I really don't know!) For instance:
public IEnumerable<FancyBusinessObject> GetLotsOfData() {...}
public void CrashYourServer()
{
var data = GetLotsOfData();
foreach (var item in data)
{
item.DoFancyBusinessOperation();
}
foreach (var item in data)
{
item.DoOtherFancyBusinessOperation();
foreach (var otherItem in data)
{
ComparisonResults.Add(item.CompareTo(otherItem));
}
}
}
public void PlayNice()
{
var data = GetLotsOfData().ToArray();
foreach (var item in data)
{
item.DoFancyBusinessOperation();
}
foreach (var item in data)
{
item.DoOtherFancyBusinessOperation();
foreach (var otherItem in data)
{
ComparisonResults.Add(item.CompareTo(otherItem));
}
}
}
|
|
|
|
|
I have found several sites that do that, and found that at least one uses (used?) admin/admin as the administrator login. I did alert them to the issue.
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
I swear there was not a single code review done on any part of that 'thing'. If there was, the code reviewer is a complete idiot.
Long story short, was trying to figure how to provide my own 'complex' custom properties in a web part. Easy you say? I thought so too.
My first attempt at it was using a TypeConverter applied on the property (yes a plain ol' C# one), but no, that went no where.
Then I discovered, a TypeConverter will only be instantiated if applied to the type and not the property.
The property being a string, caused me to dish out some silly 'computational object' aka class Category { string Value; } .
But alas, that was fruitless as Sharepoint does not bother calling GetStandardValuesSupported even.
All I want is bloody dropdownlist with a few values!
Then I decided to look at what they invent inside the above-mentioned assembly.
WARNING: Do NOT attempt to do the following without your shrink present and/or a fire truck nearby. People have been known to commit suicide and/or spontaneously combust attempting the following. I take no responsibility after this point.
I opened up Reflector, and yes, they indeed re-invented the wheel and poorly as hell. All the extensibility stuff is marked internal. And hardcoded mostly. So unless I work for Microsoft, tough cookies. (BTW I did the same thing as an exercise many many years back, why this is above their skill level is beyond me. See xacc.propertygrid[^].)
While trying to see what could be done, I came across some bad code, but this one stabbed me in the eye. I will only regain vision in a few weeks the doctor says.
string name;
if ((name = obj.Info) != null && name == "Zone") { ... }
Why on earth could they not just use this:
if (obj.Info == "Zone") { ... }
What self-respecting developer would allow such rubbish to pass a code review or even allowed to be written? Did they think they were optimizing the code? Did they even read the manual?
|
|
|
|
|
What are you on about? Please take a breath and add some clarification. If you need a hug (and you seem to) then by all means go get one, even a liquid one.
|
|
|
|
|
Sometimes the code does not get correctly "reflected" by the Reflector, perhaps it is just a Compiler Optimization or so.
|
|
|
|
|
Kevin Drzycimski wrote: Sometimes the code does not get correctly "reflected" by the Reflector, perhaps it is just a Compiler Optimization or so.
I was actually using ILSpy, which normally does not change the IL to be more readable.
The C# compiler will never re-introduce a local, an assignment to that local, and a subsequent null check. If it had some form of CSE, I would expect the former 2, but the null check is completely redundant. On the other hand, the introduced local is also redundant as the value of name in the branch can on be "Zone".
It could be that this was written in VB.NET.
|
|
|
|
|
..with the amount of code coming from Microsoft, it's a wonder that this does not happen more often. I find it amusing that people peek inside their assemblies and are pissed if they do not find near-perfect code.
We don't expect that from other companies, do we?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
They obviously don't realize an 'axe-murderer' is maintaining/using their code
|
|
|
|
|
Lol, I wrote this a few years ago for a school project... I think I wrote it on Monday at lunchtime.
function randomNumber(){
var lunchtimeMondayReturn=0;
while(true){
var lunchtimeMonday=Math.random();
if(!((lunchtimeMonday+'').split('')[2]>3)){
lunchtimeMondayReturn=(lunchtimeMonday+'').split('')[2];
break;
}
}
return lunchtimeMondayReturn;
}
|
|
|
|
|
In a Pascal class in college I used all nonsense words. QUAMPANI, BELABA, DEFALA, TANEKABI, etc.)
|
|
|
|
|
PIEBALDconsult wrote: TANEKABI
That's somewhat close to Tenkaichi.
|
|
|
|
|
I rather like Vegeta[^], although it's a character name rather than a series
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Lol. I've done that before... I'm terrible at naming variables.
|
|
|
|
|
If that were Java, you could put it in a class and use some accessors in a really nice way:
isLunchTimeMonday()
getLunchTimeMonday()
Although properties in .NET make a really nice way too:
var whatTimeIsIt = HungryClass.LunchTimeMonday
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Ano Anony Wrote: Lol, I wrote this a few years ago for a school project...
I hope you are better at naming variables now.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
I know a kid who names his variables x, xx, xxx, xxxx, and so on and so forth. His methods have names like "JDOEHSNFD" (Note all caps). The professor was not very happy when trying to read (and grade) his code. The student also did things like 'String xxx = "879374930";' and then the next line would be 'int xxxx = Integer.parse(xxx).intValue();' The string variable would not be referenced AT ALL after that! Is it any wonder he failed?
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
Here's a little gem I came across a while back.
private bool f(params object[] args) { return 0 != (int)Convert.ToUInt32(args[args.Length - 1]); }
It's employed all over the code module. Here's one place:
byte[][] outBuf = new byte[2][];
outBuf[0] = new byte[256];
outBuf[1] = new byte[256];
for (int i = 0, j = 0; j < outBuf[i].Length || f(j = 0, ++i < 2); j++)
outBuf[i][j] = 0x20;
It would seem that the coder was disapointed that C# wouldn't allow abuse of the comma operator. So he substituted an argument list!
Here's another place where it's used.
public bool Visible
{
get { return f(_RawData[1] & VISIBLE); }
set
{
if(f(_RawData[1] & VISIBLE) != value )
_RawData[1] ^= VISIBLE;
}
}
Well, that explains the name.
Is this clever or a horror?
|
|
|
|
|
From that, it look like a horror.
Did he comment it at all? Or just throw it together and walk away?
'Cause if he didn't, it's probably time he met Mr Ugly Stick...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
That is definately an absolute horror. I hate it when people think they are smart because they write such code. It is totally unmaintainable and unreadable to anyone (including the author of it a couple of weeks after he wrote it!)
|
|
|
|
|
|