Wow that's bad. But I think the real wft is c, because the code is valid.
How can you have a typed language which implicit cast an int to a pointer. (I had to start gcc just to test if this is really valid c code. It is).
Wow that's bad. But I think the real wft is c, because the code is valid.
How can you have a typed language which implicit cast an int to a pointer. (I had to start gcc just to test if this is really valid c code. It is).
@mott555 said:
GPL is cancer and I will fight to the death anyone who disagrees with me. Many cool features in commercial software I've worked on were canned due to only being possible (quickly) by relying on some obscure poorly-implemented third-party library licensed withcancerGPL, the bosses being unwilling to commit months to implement an in-house version of the library, and everyone involved rightly refusing to re-license and distribute our source.
Now I don't especially like GPL, but that is a terrible argument. You are basicly complaining that you can't use the work of others for free, without giving anything back.
@Snooder said:
@blakeyrat said:
Freedom means "fewer restrictions". Always. To redefine it as, "more restrictions", regardless of the intent of those restrictions is a bullshit move.
So, tell me, is a country where a landholder has an unrestricted right to kill, beat or torture his tenants more or less "free" than a country where serfdom is banned by law?
It is a more free, but not better country :} - Only the most out of touch anarchist would ever argue that more freedom is always better. We need laws to describe and control the interaction between humans, and that does make the country better but less free. (How many laws, and how free is best, is open for debate, but offtopic here :}
But to get back to the issue of gpl. When he defined it as a more free license, I think he compared it to the normal license for commercial software. And compared to that gpl is much more free.
I would argue that MIT/BSD are more free then GPL, but the question of "are they better" depend on how the author want the software to be used and extended.
@Mcoder said:
@mt@ilovefactory.com said:
If you don't want eclipse to cache things from disk, just enable the setting which force eclipse to always check if a file have changed on disk before accessing the cached version.1 - How does that make eclipse stop caching things?
Sorry, it does not make eclipse stop caching things. But it causes eclipse to check if a file have been updated before it uses the cached version.
And yes the true wft is that both Linux and Windows, are really bad at the "Just tell me if a file have changed" thing, thus forcing software to check last update changes on files. -(
@dkf said:
and the way it caches stuff in mysterious ways instead of just loading it off disk when needed is very close to the centre of the WTF. (Either that or maybe the way it screws with the class loader system, which is outright scary.)
If you don't want eclipse to cache things from disk, just enable the setting which force eclipse to always check if a file have changed on disk before accessing the cached version.
It might be because i went to an univercity with focus on theory, but why would the grader need to run the software at all? I meen it's a a data structure course, so in order to do any usefull grading he would need to read the source code. What possible information could you get from running the software?
Oh, And I do think that eclipse+cdt is a better development environment for doing c++ development then Visual studio 2012 but that is for an other flamewar I guess.
@dkf said:
The real problem is that the equality operations on bothInteger
andLong
don't make the values the same. I usually consider any autoboxing to be a bit of a code smell, though there are places where it is totally necessary (e.g., method calls that take a variable number of arguments).
But having equality between Long and Integer would not be enough for the code to work. For this code to work work, it is also require that Long.hashCode() returns the same values as Integer.hashCode() would, when constructed with the same int. (That is: Long(n).hastCode()==Integer(n).hachCode). Which it does for the java implementation I currently use, but that is an implementation detail, not a documented feature you can relay on.
@fire2k said:
Gratulations, you are now security maintainer of a version of java. We hope you handle this gracefully and responsibly.
And now do go celebrate.
But that is no risk. Since the java is not installed(Just copied to the same folder as the program) it don't interact with any browsers or other software. And it is not in the system path, so it can't get run by accident.
@OldCrow said:
A friend of mine says that he ships a version of JRE with all his software.
Not an installer, but bare binary files in a subfolder of the program's installation folder.
It works, he says...
That does work perfectly, and it was what our company did, back when we released Windows programs written in Java(Around jre 1.6.8 i think). Then the user can't fuck up anything by uninstalling/upgrading/downgrading java, and you know your bundled java is not going to fuck up any browser settings. (We also offered a jre free version, but almost all customers prefered the "Install and forget" version with the jre files included in the program directory.
@daveime said:
Anyone relying on a query optimizer is the kind of person who does full table SELECTs over multiple LEFT JOIN tables, and really has no business being anywhere near a database.
You will have to explain that one. What are the alternative to relaying on the query optimizer? Do you expect me to do all my joins in code???
Example: In a query with 4 joins and multiple where clauses, I absolutely depend on the query optimize to do the select and where filtering in an near optimal order, or else the query will be far to slow.
And If I do something like select a.field where a.id in(select otherid from c where c.otherfield=true) I absolutely need the query optimizer to detect that the inner select is independent of the outer select so it only run the "select otherid from c where c.otherfield=true" once, and not once per row. Something the mysql 5.1 optimizer is quite bad at. (Yes this problem have been in the mysql bug database for years, and is supossed to be fixed in 6.0)
And one problem which really bite me with mysql is the inability to optimize select which uses views. I once had to replace a select from a view with a normal select because using the select from the view took 3 minutes, but replacing the view with the exact same same select which generated the view took 0.2. seconds.
It looked to me like if I created a view by doing a select with a where using a field with an index, all queries against the view would use the same index, even if other indexex would give far better performance. Especially a problem because mysql can only use 1 key per table in a query.
@morbiuswilters said:
Oh, and don't get me started on "vacuuming". Did they ever fix that shit or do you still have to take down your entire fucking database for 8 hours a week to do a full vacuum? How is that even an option? It would be like me selling someone a car on the condition that every 15 miles they drive, they have to get out and push it for a mile. The hell??
How long ago is it that you have used PostgreSQL? They fixed that issue over 5 years ago. And using MySql with a different storage engine is not really an option, as long as that stupid query optimizer will kill your performance if you try to do anythig slightly complicated. Unlike the PostgreSQL query optimizer which is really good.
The fact that most other posters got the effect of that line wrong, tell you why you should not write that code. Lets look at it:
(!((_ok) ? true : (Math.random() > 0.1)))
The () around _ok, is confusing so let's remove them. That gives us:
if(!(_ok ? true : (Math.random() > 0.1))) which is easy to parse.
The statement in () is true if either ok is true, or with a random change of 90%
Finally this statement is reversed. So the result is that it log all statements where _ok is false, and 10% of all other statements.
It should have been written as:
if(!_ok || Math.random() > 0.1)
with a comment explaining that the random is to only log 1/10 of non error statements. and the ! is most likely a mistake. Or I should go to bed.
The test would make much more sense if true in the original line was false. Seems like a bug.
The EVERYTHING in "delete EVERYTHING" is the timeframe(How ond things shold be keept).
There should be checkboxes in the requester which allows you to control exactly what to delete. (A really cool feature).
They are not the first company to hire people with autism as product testers.
There is a danish company(Forgot the name) which specialize in hiring people with autism for testing. It does make sense, because many with autism like the repeated task of testing.
btw: You really need the "Css reloader" plugin for firefox. Then you can reload all stylesheets by pressing F9, without reloading the rest of the page. A true time saver, when doing ajax because you don't lose any page state.
If using localhost mean you have a webserver at localhost, then the problem is with your webserver sending wrong cache headers for the request.
Firefox will ask the server if there is a new version of your resource, unless you have configured the server to sent headers which allow the client to use cached version instead of asking if there is a new version.
Try to use firebug to find out if your webserver sends a "No change"answe, or if the problem is that the browser newer request the resource in the first place.
@DrPepper said:
@snoofle said:If you happen to be running the batch for customer X and a client of customer X happens to interactively try to update their own records, and the timing is just right, one or the other will be delayed due to the records being locked.Optimistic locking vs pessimistic locking. Why is the customer record locked while the user is updating it? Optimistic locking allows the user to edit the data offline; locking occurs only when the save button is clicked. A clever program can tell if the underlying data record changed during the edit process; an even cleverer program can tell if only the fields the user edited were changed. If nothing changed, then the save is performed; otherwise the user's edit session is updated and the user can fix/resave.
At least that's how I would do it.
My guess would be that the batch processing changes the records(Because if it don't, you could just run the batch in its own transaction and then there would be no problem at all).
And the single record update will then block until the batch transaction is finished, which is not easy to avoid. You could detect the lock, and then cache the update to later, but that might not be simple, depending on what kind of changes the batch processer does.
Wait a minut. You called SA, and they correctly identified the problem the first time you talked to them? When did you change job???
Pretty sure that the wtf is that it return "false" if getValueOrDefault returns true, and "true" if getValueOrDefault return false.
@mihi said:
TRWTF is that after Bruno changed the license to AGPL, people tended to keep lots of mini forks of the old (MPL/LGPL) version to avoid buying a commercial license, instead of trying to concentrate their bugfixing effort to a single fork (or just buying the commercial license...)
I guess that is what happens when the price goes from 0 to 1.615€ for a single minimum server license.
Image that you have an class. Let's call it Paint*
And it has a method which say:
<font size="-1">
void </font> |
rectangle(float x,
float y,
float w,
float h)
Adds a rectangle to the current path. |
Now paint also have an overloaded version of the rectangle method which take a Rectangle object. But instead of painting the rectangle, it "Adds a border (complete or partially) to the current path.."
What kind of design is that??
*Name have been changed to protect the guilty
@snoofle said:
Java even lets you make a map that is not inherently thread safe into a thread safe map with a wrapper (Collections.synchronizedMap(new HashMap());
But that is not always enough. If you have one thread which modify the HashMap, while an other thread iterate over the map, then you will have trouble, even if you use Collections.synchronizedMap(new HashMap();
Wft is the purpose of this method? Calling Realloc with a null pointer is perfectly safe and defined(it allocates the memmory as requested).
And calling free on the result from malloc/realloc is also always safe even if they return null, so that plsAllocated is not needed at all.(Just check for a null pointer, if you really want to know if your allocation failed).
It might just be me who haven't used low level c allocaters in a while(Got c++ classes to handle that) but I don't se how this leaks memmory. Only leak is if realloc fails, but in that case you have bigger problems.
@Cassidy said:
@mt@ilovefactory.com said:
Nope. Eclipse got its own compiler.Ain't Eclipse written in Java anyway? Very meta.@mt@ilovefactory.com said:
And just as important: The Android plugin for eclipse, know that it's an error to generate code for the java 1.7 formatSo what does Eclipse know that the official docs ("1.6 or newer") doesn't?
What docs would that be? The android emulator and development environment runs on "1.6 or newer" But when generating code for use on android devices, only java up to 1.6 is supported.
@MiffTheFox said:
@bridget99 said:I've never had much trouble getting it to do what I want. Then again, I'm not the sort of person who has to have the latest version of everything, nor do I attempt stubborn, pointless crap like trying to install open source shit under "c:\Program Files." A lot of that stuff doesn't work too well if you're not willing to "go with the flow."Even in c:\misc\android, I get stuff like a blank VM in the emulator having apps like the launcher FC. Not to mention it runs as slow as fuck on a quad core machine with 10 GB ram.
The speed problem is easy to fix: Use the atom android image instead of the arm image when creating the emulator. Then you can boot from "no emulator started", to running app in 13 seconds (Unless you need to test arm native code). Tested on my Intel Core i5-2500K(3.30GHz)
@Cassidy said:
@mt@ilovefactory.com said:
Why are you using javac instead of the eclipse android development environment?Doesn't that - ultimately - invoke javac anyway?
Nope. Eclipse got its own compiler.
And just as important: The Android plugin for eclipse, know that it's an error to generate code for the java 1.7 format, so it will reject doing it even if you try to set the output format explicit.
I just have ask:
Why are you using javac instead of the eclipse android development environment? The ability to auto complete on all properties in .xml files alone are worth it :}
@DaveK said:
@mt@ilovefactory.com said:
Philosophically speaking I can't be sure about anything, even that you exist or are or are not trolling, but I think it's a bloody reasonable inference strongly implied by the OP:@DaveK said:
@mt@ilovefactory.com said:
There is also something called a return value which might be of usage here :}Returning null from that method is the cause of the problem of something that should never have been null being null, not the solution.You can't be sure about that.
@configurator said:
Yet another representative line found while trying to figure out why a value that should never be null, is coming up as null.
I think you misunderstod.The question is: Should "items.TryGetValue" return null instead of throwing an exception if the result was not found. And my argument is that returning null might be the correct thing to do for that method.
You can't in general know if TryGetValue not finding anything(And thus returning null) is a general error. It might be legit for the method not to find what you are searching for when called from other places in the code.
So my fix for this could, would be to have TryGetValue just return the result, instead of using that stupid out thing. And then have the code saying
// should not happen - report.
throw the exception.
@DaveK said:
@mt@ilovefactory.com said:
There is also something called a return value which might be of usage here :}Returning null from that method is the cause of the problem of something that should never have been null being null, not the solution.
You can't be sure about that. items.TryGetValue should not give null in this case, but there may be other cases where TryGetValue could return null without it beeing an error, so it might be the best solution to test the return value and throw an exception in the cases where you know it should find what it is searching for.
But I think the real wtf is that the method returns a boolean and set the value of item, instead of just returning item and then return null(Or throw an exception) if it is not found.
There is also something called a return value which might be of usage here :}
@ekolis said:
@mt@ilovefactory.com said:Wait a minute, so if I call it with setSpecialValue(10) it will construct an Integer object, just to take valueOf it.No, it won't. The int overload just constructs the Integer object and assigns it to the field, without any valueOf silliness.
Oh you are right. There is both a setSpecialTagand then the private _setSpecialTag method. Don't know how I could confuse the to.
Wait a minute, so if I call it with setSpecialValue(10) it will construct an Integer object, just to take valueOf it.
Also like how it does have a special case for null.
I think its an ugly hack which may be needed depending on the rest af the code base. But I think you should use invokeAndWait, instead of invokeLater in order to prevent surprises.
With invokeLater calling getText() after calling setText() may return either the old or the new value depending on timing, which may cause all kinds of trouble later. (Just imagine having to make a unit test for these widgets).
Well thinking about it: If you also wrap getText in an invokeLater call, you would always get the new value, but I still think you should use invokeAndWait just to prevent timing trouble.
@Jonathan said:
@Cassidy said:
@Jonathan said:
Dates as strings are necessary in order for them to be human readable.Then you transform them just as you're about to display them to a human.
For all other operations, it makes sense to leave them as a Date object.
So far we haven't been given any requirements so we don't know if any other operations are needed. The unknown requirements may or may not call for this code.
So the worse than failure here is expecting requirements to be assumed, which is the worst of all worse than failures.
You should newer store or handle dates as strings. The only time you may have a date as a string is when doing input/output, but then the only thing you should do with that string is to convert it to/from a Data object.
This should go on the frontpage. This is so wrong in so many ways I don't even want to enumerate them.
@snoofle said:
Naturally, there was a flurry of emails - before, during and after - to a whole lot of people - all replying-to-all (with the original login and password still visible).
If your email server survived that, you can at least take some comfort in the fact that your email admins know what they are doing :}
@Cbuttius said:
It is still bad practice to do this. memset to 0 is fine for an array of integers or plain pointers. Otherwise just don't do it.
Oh no, memset to 0, is not ok for pointers. It may work depending on your compiler and debug settings but it is not something you want to depend on. Or to be more exact: Using memset to set a pointer to all (int)0 will not always give you a null pointer.
It is worth mentioning if anyone care that stringBuffer.toString() copies the entire string.
@mott555 said:
Our app includes a button that links to our company website. They even included a helpful screenshot so we would know where this button is and remove it.
Been there. Done that. Removed the link again.
Normally they only complain if you sell mobile optimized things on the website. But the accept process undeterministic.
@snoofle said:
Some data and business logic is in stored procedures in Oracle, some is in data and stored procedures in Sybase, and some is in Java that wraps the calls to both databases. The logic goes something like this:
I really think we found the true wft here.
How the hell do you end up with such a system? A database migration from Sybase to Oracle which were stopped at the halfway, or just a new developer which prefer to use Oracle but who don't want to rewrite the existing code which use Sybase.
And I don't even want to think about how you backup this solution. You need to start the backup of both databases at exactly the same time, or you will end up with un-synchronized data when you restore your backup.
@snoofle said:
This particular system was originally written using Sybase. Later, new stuff was added in Oracle. Since it's all the same logical system, naturally, this leads to lots of two-phase commits. Both databases support this, and although it leads to a lot of complex code, it is not the WTF.
What exactly does this mean? That some of the applications data was stored in Sybase, while other data for the same application was stored in Oracle?
I think the important phrase is "Microsoft can check online for a solution to the problem the next time you go online.
It can't check now, because you have no internet connection. So check later should really be "Check next time I get an internet connection"
@blakeyrat said:
@ASheridan said:Avoiding Firefox upgrades doesn't make someone a tech luddite,Since it's my term I can define it however I want, and I say it does.
@ASheridan said:
not bothering to learn anything about the Linux tools one has to use at work though...I know how to use the tools. I just don't like them (and where does this "not bothering to learn anything" shit come from anyway?) Did it ever occur to you that the reason I don't like those technologies is because they're all stuff that was obsolete 25 years ago? I'm not a Tech Luddite, I'm a "Tech Modernist". Which is pretty much the exact opposite.
Look. Microsoft Basic 1.0 on my Mac in 1986 had a GUI debugger with breakpoints, conditional breakpoints, setting breakpoints while executing, an inspector, etc. In 1986. Ruby, in 2012, does not have a debugger that good. This is fucking ridiculous. Fucking. Ridiculous.
The IT industry is going backwards. I do not, and will not, ever support going backwards.
Then why do you still continue to use such inadequate tools? You only have yourself to blame for that. There are plenty of languages and tools with far better debuggers.
@toon said:
$object->__construct($data);
What does that code even do? Does it call the constructor as a normal method, and where is it documentet that you can even write code like that?
@asquithea said:
- it doesn't correctly handle messages split across TCP packets - which is considered a bug, for any reasonably written software
That make no sense at all. TCP is a stream protocol. It does not itself have any concept of packages.
TCP/IP (TCP over IP) which is what I guess you are using does have ip packages, but there is in general no way to control the size and number of ip packes your tcp stack will generate when sending x bytes.
So if they really managed to implement a tcp stack which can only handle 1 ip package per connection in total then that is the true wft. And the fact that you can communicate with their system at all is pure luck (Or rather due to a tcp stack optimization where your tcp stack will try to use as few packages as possible.But some day it will split that 1700 bytes.
Oh my god. That tutorial is scary. Who are the guys writing tutorials about c++ without even understanding the concept of pointers and referances?
@Enterprise Architect said:
How about this "tutorial":@dipshitx said:
Because a pointer by defining is a reference to the address where a variable resides, when a function is defined as returning a pointer, you can also return a reference to the appropriate type. Here is an example:double * GetSalary() { double salary = 26.48;return &salary;
}
But am I supposed to free this memory or not? He didn't call new, so I'm not sure it's managed for me!
Wow that is an impressive number of errors in such a small text. It really looks like the author is confused about the difference between a pointer and a referance.
Wow. Try to run explain on the update with and without the <font color="red">i.GlossID = g.GlossID</font>
Look at the bright side. At least the app is stable since it have been in production for 2 years without needing any code updates og bugfixes. Or nobody gives a shit about the app :}
btw: "They had to give us a completely installed development environment in a VM because they were unable to explain how to install the needed software" is on my list of "Signs you are taking over a doomed project".