as I recall, in lisp and other functional languages (f a) calls f with a as the parameter, and (f (a)) calls a and passes its result to f (though that's more akin to f(a) vs. f(a()) in more sane languages, or you could take the difference between (f a) and ((f a)) which is akin to f(a) vs. f(a)())
Posts made by airdrik
-
RE: Representative Line
-
RE: Eclipse Add-ons Dialog
What kinds of details did you expect? When installing a plugin all it does is fetch the plugin (determine the url where the plugin resids and download it), and install the plugin (possibly unpack it and move the contents to the appropriate plugin directories in your eclipse install/workspace).
I suppose the wtf could be that it told you it was fetching the plugin (or that it told you the (collapsed) url) in the condensed view, rather than reserving that information for the details view, but meh, whatever. Or I suppose the wtf could be that they don't report the progress in terms of MB downloaded, MB to go, current download rate, expected completion time; but nobody pays attention to those details anyway.
-
RE: Interview pro-tip
@Lorne Kates said:
@PJH said:
@Xyro said:
Just for fun, are you able to share the code you used?
+1Should be 1+. Prefixing the incriment is for COBOL greybeards!
Don't you mean COBOL whitebeards?
-
RE: Database Design Party
So can an address and a customer have the same PARTY_ID, or are they globally unique? Or is it the other way around that everything with the same PARTY_ID is part of the same entity (party?)?
If they are globally unique, I'd like to know why since there that would be a WTF in its own right (though in this case they should be using auto-increment, and not using it is another WTF).
If multiple other tables can have the same PARTY_ID, but that doesn't mean correlation then there's no reason to have the PARTY table with its PARTY_IDs and each table would have its own unique identifier.
If anything with the same PARTY_ID is part of the same entity it at least makes sense - a party refering to an entity with all of its constituent parts (though you lose the ability to use the PARTY_ID as a unique key if you need to introduce any kind of -to-many relationships). Of course even then each table should have its own ID and foreign keys properly identified and established accordingly (so that while a customer has an address and a vendor has an address a customer can't be associated with a vendor unless such a relation is explicitly established)
-
RE: Making sure a value is assigned
@snoofle said:
boolean mostlyTrue = Math.ceil(Math.random()) > 0;
That is evil! So wonderfully evil! Throw that deep into some inconspicuous code before you leave...
-
RE: It's probably not flat.
@Mr. DOS said:
Filed under: write-once-run-nowhere
Or more likely: write everywhere, right nowhere?
-
RE: Initech Lives!
I personally appreciated the banner on the uk one which advertised: "don't put all your eggs in one basket? with an initech solution..... you can!"
Because of course you can trust initech with all of your eggs. While they're at it, they can count the chickens before they hatch and store all of their eggs in that same basket as well (should be easy with a little extra xml, some wooden tables,...)
-
RE: Bit flagging right?
You might grok the code base for usages of LOG_ALL to see if it is being (mis)used anywhere. Who knows but that you might learn something "useful" (if not for personal enlightenment, for the entertainment of your fellows in these parts).
@Severity One said:
So how would you do
setLogging( QLoggingLevel )
?You don't call setLogging(QLoggingLevel), you call setLogging(int), and you pass in the combination of logging levels or'd together. Of course that should only be done on app startup by the log configurator after reading in the logging configuration from file. Similarly the log level check should be wrapped within the corresponding log.error/log.warn/log.info/etc. method call to make things simple for the people who are using this framework (and to make it easy to switch to a more standard logging framework when they find out that that's all they're rewriting anyway).
-
RE: AT&T Has randomly decided to disable the most-used feature of my phone.
@BoringJames said:
WTF #1: "Steady decline in instant messaging on non-smartphones". Yeah, I'd like to see the numbers here, because otherwise this doesn't mean anything to me except "more smartphones exist now". I'm betting that the only declining numbers involved are sales figures.
Probably also because people who use alternate IM clients (e.g. AIM, YM, MSN, etc) are either switching to smartphones or just not using them from their non-smartphones anymore (relying more and more on basic text messaging instead, which gets the job done just as well especially now as everyone has a phone and texting is practically universal).
@BoringJames said:
WTF #2: Just the phrase "non-smartphones". Okay, so what exactly is a smartphone? My Pantech Link is a budget phone, yes, but it has apps, an internet browser, an IM client, an E-mail client, calendar, camera, and a friggin GPS. The only other differences I can think of between my phone and a "smartphone" is that a "smartphone" costs a lot of money. Oh, and perhaps most smartphones have a touchscreen too... except most models of Blackberry, which is AT&T's top-line smartphone series. Yeah, I'm betting it's money.
Smartphone generally refers to a device with more advanced features, usually requiring a constant data connection. Currently the OSs considered to be Smartphone OS are iOS (iPhone), Android, Blackberry and Windows Phone 7 (all of which are comparable to your typical desktop OS in terms of power and capabilities). Admitedly the line between what constitutes a smartphone vs. a non-smartphone/budget phone/featurephone is very blurry, especially considering that your typical non-smartphone today would have been considered a smartphone 3 years ago (btw, my previous phone - a non-smartphone - had a touchscreen, as does my wife's current non-smartphone, so even that isn't a differentiator. Alternatively I got my current ( admittedly lower-end) Android smartphone for free (subsidized by the data plan * 2 year contract)).
-
RE: Elevator fail
@Renan said:
I then realized what happened. There was some guy waiting for an elevator car in the last floor with us. He was standing in front of one of the pairs of sliding doors. I figure that as the car we were in started closing its doors, the button's light would turn off. The confused dude must have thought that that meant his car wouldn't be coming, so he pressed the button, which in turn reopened the doors of the car that was present. A couple seconds later the car would start shutting its doors and the cycle would begin again. And again. And again.
Another WTF is elevators that reopen the doors if someone hits a call button while the doors are closing. I thought that it was standard that if the doors are closing the only ways to reopen them was to block them or hit the open door button from inside the elevator (or if the emergency system has another mechanism), and that hitting the call button would call the next available elevator. Or if I am completely off my rocker and it is commonplace for the doors to reopen if someone hits a call button while the doors are closing, then TRWTF is the light on the call button turning off before the doors have closed and the elevator starts moving (i.e. if the light turns off that should mean that hitting it again will call the next available elevator).
-
RE: I may have just dodged a bullet
@KattMan said:
@airdrik said:
Isn't that what integration tests are for - to make sure that changes to different systems don't interfere with each other?
This is where a tool like opengrok comes in handy - the tool indexes all code in the codebase (including the application code, whatever sql/database scripts/files you store in VCS, etc.) so you can just ask it what is using the DeleteMe column on the XYNotSoImportantStuff table and it will spit back all of the files that reference it, like ApplicationCoreDAO.java in the centralCriticalLibrary project.
Of course having the tool doesn't guarantee that a given moron will look at it or submit the change request to the other applications/libraries that use the DeleteMe column before dropping it.
I have a hard time believing that a tool will find everything. It can only look at things that you tell it to look at. Otherwise it is searching your entire system for something that may not exist.
It certainly doesn't find everything, but it does find most things - it is designed to index the all of the (static) text in the entire codebase (on a regular basis to keep up-to-date with changes) so that when you do a search it can provide you quickly with e.g. all references in the entire codebase where "foobar" is mentioned. You still have to go wading through the references to determine what is relevant, and it certainly doesn't do quite as good a job as your IDE will with the entire code-base checked out (of course even your IDE won't find references obfuscated by eval-ing concatenated strings, though if you are doing that in your code then you guarantee that nothing short of running the code will detect all of the hidden references). But the point of having the tool is that it will assist you in finding such integration points without having to have all of the code checked out.
-
RE: I may have just dodged a bullet
Isn't that what integration tests are for - to make sure that changes to different systems don't interfere with each other?
This is where a tool like opengrok comes in handy - the tool indexes all code in the codebase (including the application code, whatever sql/database scripts/files you store in VCS, etc.) so you can just ask it what is using the DeleteMe column on the XYNotSoImportantStuff table and it will spit back all of the files that reference it, like ApplicationCoreDAO.java in the centralCriticalLibrary project.
Of course having the tool doesn't guarantee that a given moron will look at it or submit the change request to the other applications/libraries that use the DeleteMe column before dropping it.
-
RE: Zero value invoice
@toon said:
@Quango said:
The sites have what I call "Bill to parent" which shows totals up their own charges, but transfers the value to the parent so it gets invoiced there.
There's your "absurd logic", right there. You've got a bunch of branches, you need to bill their charges to a central account, so what do you do? Why, instead of simply billing the charges to a central account, you transfer the charges to the parent, of course. I guess that's why you work on accounting software and I don't. Having said that, the company I work for built, and maintains, a billing application among other things. It's a pile of WTFs and no mistake. So I suppose I should put a sock in it and knock on wood, lest I am tasked with maintaining that...
Accountants aren't so concerned for simplifying processes and having 100% correct data so much as ensuring that everything is properly accounted for. The parent account wasn't the account which generated the charge or the credit so it would be wrong to apply the charges and credits directly there. Similarly if a value comes in wrong, they don't want you to fix the value as if it was never wrong (especially if they've already booked that value, declaring it "the gospel truth" as far as they're concerned), they want you to find out what made it wrong and provide an adjustment which fixes the value (you don't fix "the gospel truth", but you can provide patches to it when declaring new "gospel truth" - booking next months numbers). That way they know where everything came from, and they don't have to go back and rebook numbers.
-
RE: The unconditional checkfile exception condition idiom
@Thuktun said:
@TheRider said:
That's not as much of a WTF as you suggest. If that's the logging framework you're stuck with using and you really need it to log a stack trace, then that's how you'd need to do it.WTF 3: Creating an exception for the purpose of logging it, not throwing it. Well, the Logger doesn't have an error-method without an exception-parameter. Therefore, one must be created, obviously!
Except that there is no stack trace because the exception didn't get thrown up the stack (or the stack trace only has one item which is the point where the exception was created which is no more helpful than the logged error message). The only reason for creating the exception is because log.error only has one override and that is the version that takes a String (the message) and an exception (and considering everything else here will probably throw an NPE if you try to just pass null for the exception)
-
RE: The unconditional checkfile exception condition idiom
#6 is not a WTF - the checkFileOnServer flag enables logging into the remote server just to see if the file exists, and disabling it implies a built-in assumption that the file will exist when requested (which leads to #10 if it doesn't. I can see disabling it in production for performance if you can ensure that the file exists when this application runs)
#8 is a very small WTF - if you have no control over the sftp library (which if you do, why aren't you using one of the existing free ones) then you get what you get; and considering how often you expect an sftp library to change, there is no impetus to go back and change it just to use the new java collections. You can just gloss over that implementation detail and use: Collection files = sftp..., since you only care for the size (and actually you only care to know if the result is empty or not - you could simplify that block to: return sftpChannel.ls(remoteFileName).isEmpty(); )
#11 - where does it log that the file exists when in that scenario checkFile(...) returns false? It logs that the file does NOT exist (with a worthless exception) and runs right into the NPE.
#7 and 12 are probably because loggers throw exceptions, so we won't bother logging if we just get exceptions when trying to log. Fix #13 and then go back and put in proper logging.
-
RE: What's the big deal if the data isn't consistent?
Of course this doesn't fix problems when different db tables end up using different IDs for the same item resulting in requiring extra joins with the itemids table in order to join the two tables together.
Of course as the lady said, who cares about consistency. While we're at it we'll just start using whatever item ids we want even if the id in the itemids table doesn't match the item that we are really dealing with - we'll just use item id 8329 to mean item6021 (and add hard-coded rules in code to specify which items really are in the itemids table and which ones have "special" mappings).
Besides, consistency is so overrated. There are lots of companies which get away with not having consistent data because it means they can process data that much faster (no global locks across a cluster of DBs, of course they need some sophistocated conflict management when they do push updates to the other DBs). If we just do away with consistency entirely just think of how much faster we can process the data? It doesn't matter if the applications keep pushing around out-of-date, inconsistent data, leading to more and more inconsistency. What matters is that we do it faster/cheaper, right?
-
RE: Reply/All
@morbiuswilters said:
@PedanticCurmudgeon said:
The real answer is to have the original post put the list in the bcc, and some of my more enlightened co-workers actually do this.
What are they putting as the To address, then? And this doesn't work if people actually do need to reply to the list.
You don't put anything in the To field (or if it is required you could just put your own e-mail there, I suppose; then just have a message filter that auto-deletes anything sent from you to yourself). If there is a list of people that recipients are expected to reply back to then include them as Cc recipients (I couldn't imagine a situation where you are e-mailing 100 people whose replies need to be seen by all 99 other people on the list, but if such is the case then use Cc; or better yet use some other intermediary like a forum or discussion site).
-
RE: Who needs disjunctions anyway?
So is this something where you can use language-native constructs to put together the query - all of those clauses are native function calls which take strings and do their whatevers to construct the execution plan, or is this the string that you construct in whichever language you are using to pass to the DQL engine? If the former then this isn't terrible, and seems a reasonable approach to a nosql api (so long as the strings/objects that you pass in make sense/don't require rediculous work-arounds to do basic things like override precedense); the more native language constructs it uses over string building the better (table.Foo.query(lambda row: 'columns', 'by', 'name', 'maybe', 'with', 'dynamicly * created - columns').where(lambda row: (X(row) or Y(row)) and Z(row)).sortBy('column').execute(), or sorted((row.col1, row.col2, row.col1+row.col2) for row in table.Foo if (X(row) or Y(row)) and Z(row), lambda r1, r2: cmp(r1.bar, r2.bar)), to provide a couple of pythonic examples). If the latter then there is only one thing which should be done with it and that is to burn it along with the wooden table it was written on.
-
RE: Too many cooks...
Quick! Hurry! We have an emergency here! We've run out of resources and I may need to use some sometime, eventually, over the next day or two or week or month or never; but we need to make sure that the resources are made available immediately just because we are out! (and by run out of resources, I mean I used the last page of my notepad and I forgot where we keep the extras, because this is the notepad that I've been using since I got here 4 years ago and have never had cause to get a new one yet)
-
RE: Stop me if you've heard this before...
@zelmak said:
private boolean booleanValue = false;private String booleanvalue = null;
//Check to see if booleanValue is set to true or false
public boolean isBooleanValue() {
return booleanValue;
}//Set booleanValue to new value
public void setValue(boolean booleanValue) {
this.booleanValue = booleanValue;
}//Return "T" if booleanValue is not false, otherwise does exactly what you would expect
public String getValueAsString() {
if (booleanValue != false ) {
booleanvalue = "T";
}
return booleanvalue;
}//Set booleanvalue to new value
public void setValue(String booleanvalue) {
this.booleanvalue = booleanvalue;
if ( booleanvalue != null ) {
if ( booleanvalue.trim().toUpperCase().equals("T") ) {
this.booleanValue = true;
} else {
this.booleanValue = false;
}
}
}
FTFY -
RE: The API
@Sutherlands said:
@swayde said:
@Tachyon said:
Just pretend it's something like this:...Wall of text...
Please clarify...They have C# which calls a C++ libary which calls a SOAP WS which calls a .Net remoting component which does something.
Close enough, anyway.
More like C++ -> SOAP -> Web Service -> .Net remoting -> middle-man service -> .Net remoting -> various other services which do real work (-> .Net remoting? -> DAL -> db)
i.e. the WTF that the OP is trying to expose is why have the middle-man/men when you could just connect the c++ library or the Web Service directly to the various services.
-
RE: The DB can't keep up
So how many awards have these DBAs received for just being awesome? After all they are the experts in their field and know everything there is to know about databases and scalability and resource allocations, and production vs. development environments, etc.
What kind of bozos are these that fail at basic understanding of the difference in load between development and production? While there are many services where the load in development will be very similar to the load in production, there are also many services (i.e. anything which is externally-facing, or even internally-facing if you have a large organization and the service is to be used by a large portion of the organization as part of their regular duties) where the load in production is many times (orders of magnitude?) bigger than in development.
Maybe you need to simulate more users in development (automated user processes?) to emulate the production load and start complaining about needing more resources for both (and maybe even win extra resources in the process because of the extra resources required to run the automated users)? -
RE: We have 10,000 test cases!
The insistance on using getters/setters stems from the OO principal of data abstraction, interpreted thus: Don't let anybody see our data (instance variables) directly; instead make all members private and only allow access through getters and setters. This allows us to change the implementation without having to change the contract (if we want to move some instance variables to some sub-container then we only need to change the getters and setters in one place rather than going through, finding and replacing all of the places where those fields are referenced directly - of course how often do we ever refactor the structure of the data after it has been well-established, aside from expected things like introducing new fields or deprecating old ones).
Granted this makes things really obnoxious - a data class which doesn't contain any real logic takes 4-8 times as many lines with private fields and getters and setters than if it were just implemented with public (final) fields, and then instead of accessing foo.bar, you have to call foo.getBar() (which as I understand it, the JVM optimizes trivial getters and setters to direct accesses, so at least there's no performance penalty when running the code). But then IDE's make it trivially easy to add all of the getters and setters, write the constructors, etc. and that's why most alternate JVM languages map a failed access of foo.bar to foo.getBar()/setBar(...).
Of course there's no reason why you couldn't have the main data class have all of the getters and setters, but use (private) local sub-containers with all "public" fields accessed directly by the main class's getters/setters, or even go as far as to restrict the namespace visibility (package private?) of the main data class and use direct access within that namespace and only expose publicly the higher-level functionality of the whole package.
As for Unit testing, I see no point in unit testing a trivial getter or setter; however as soon as it is changed in any way it then any variations in behavior should be unit tested. Of course this means testing each getter and setter in the main data class.