« first day (599 days earlier)      last day (4335 days later) » 

4:00 PM
oh what the fuck
Java at its finest
1
Q: Is my Scala Option conversion to Java correct?

chaotic3quilibriumSummary: I've implemented what I think is a complete Java implementation of the Scala Option class. Could you please review and let me know if I have correctly and completely implemented it? And if not, could you please indicate where I have security, multi-threading, persistence, etc. defects? T...

 
Well, I rebooted, and now am stuck on the splash screen, and can't ctrl alt f1
Give me a sec
 
@KonradRudolph What about it?
 
@RMartinhoFernandes It’s shit code, and the reason it’s shit is that it’s written in Java, following all the Java rules
it’s cargo cult code, but the cult is ingrained in Java culture
 
Option instance factory
Lol.
 
singleton factory factory
 
4:03 PM
it follows all the motions, and the result is one big pile of crap
 
@CatPlusPlus Wait, there's a factory?
 
@CatPlusPlus The C tutorial on the Site du Zéro ends with SDL. That might explain why so many noob C progammers use SDL.
 
Oh, it's just a couple of convenience methods.
 
@awoodland file not found?
 
4:05 PM
@Drise sorry should have been Xorg.0.log I think then
 
T get();
 
I can never remember if XOrg has capitals in specific places or not
 
So, he just replaced NullPointerException with OptionEmptyException or something.
So safe.
 
It doesn't really work in Java anyway.
 
throw new UnsupportedOperationException("Invalid to attempt to use get() on None"); xD
 
4:07 PM
void f(Option<T> o);
f(null); // compiles fine
 
@awoodland failed to load module nvidia
 
@CatPlusPlus Ironically, the std::optional C++ proposal we discussed earlier does the same bullshit
It replaced one UB with another …
 
boost::optional has a bool coercion, this one doesn't?
 
@awoodland let me get my drivers running again, one sec
 
Also, it doesn't try to be Maybe monad, just to add pointer semantics to values and references
 
4:08 PM
@CatPlusPlus So?
 
@Drise - want to take this into another room since it's probably going to go way OT?
 
It's a rather different goal.
 
@CatPlusPlus Which is (almost) utterly useless. Just use a unique_ptr if that’s what you want.
 
@CatPlusPlus Not terribly helpful without syntax anyway.
 
@KonradRudolph The point is nullable values.
 
4:09 PM
@CatPlusPlus That is provided by (smart) pointers.
 
@KonradRudolph Not copyable.
 
unique_ptr is unrelated.
 
@RMartinhoFernandes Then use a different smart pointer
 
No, optional<T> is not the same as unique_ptr<T>.
 
@awood sure, just not now. On a tablet currently. Let me get my drivers working again first.
 
4:09 PM
Or shared_ptr, or any other smart pointer.
 
No, admittedly, optional does serve a point here
but in my opinion, not providing a typesafe way of accessing it is still stupid
because we can provide such a way
 
Send it again?
 
Ranged-for is awesomez.
 
Primary reason for optional is optional arguments. Hence the name.
 
@RMartinhoFernandes I agree, but it doesn’t even have to be ranged-for, just any way would do.
 
4:11 PM
C++ type system is poor.
 
@CatPlusPlus What? no!
 
except for the C compatibility crap C++’ type system is pretty awesome
 
Lacks typeclasses => poor.
 
@CatPlusPlus why do you say that?
 
4:11 PM
it allows incredibly strong type safety
 
Implicit conversions => poor type system.
Ha ha, strong. No.
 
@CatPlusPlus Don’t use them, then.
 
I can't not use them.
 
@KonradRudolph double->int
 
They happen automagically.
 
4:12 PM
@CatPlusPlus You can, absolutely
in fact, in the extreme case you could use wrappers for all native types which do use unsafe conversions
 
Haskell type system is strong. C++ is weak and poor.
 
@KonradRudolph no, Cat is saying for types where someone else has an implicit conversion, you have to wrap things to make them safe, which is silly
 
I’m not sure that’s generally a good idea but it’s worth contemplating
I agree that it’s not complete but it comes damn near
 
@KonradRudolph Just because a problem has a complex workaround does not mean it's not a problem
 
@MooingDuck Silly, maybe. Not so sure.
 
4:13 PM
@MooingDuck Use {} everywhere!
 
Just for the record, I agree that all built-in types in C++ suck. C legacy.
 
Also no monads. QED.
 
What C++ has a set of rules which allows us to express very strong type guarantees, and enforces them
the mere fact that we can make these rules enforceable shows that C++ has, in principle, a strong type system
@CatPlusPlus That’s a different point. What C++ lacks here is the syntax
 
No, there's no place for implicit conversions in strong type system. Barring actually useful ones like bool coercion in conditional context.
 
and yes, compared to Haskell everything is crap.
3
 
4:15 PM
Implicit conversions is what differentiates weak typing from strong typing.
 
Starbait at its best.
 
@CatPlusPlus I disagree. I actually think that employed carefully, implicit conversions can be very nice – but once again: C++ permits you not to use them in your own type hierarchies
ok, gotta go
see you
 
Ell
hmm 11 miles in an hour cylcing - thats not too bad right?
 
Except 90% of the code operates on built-in types, even to make those fancy uncastable types.
 
room topic changed to Lounge<C++>: Sorry, we're all out of fireworks. [c++] [c++11] [c++-faq]
 
4:17 PM
@CatPlusPlus Yes. I agree that for practical purposes C++ is irredeemably destroyed by its C legacy
 
Sure, you can create workarounds for most of the language. But at this point, I'd just switch to another language
 
If the puppy were here, he'd be screaming "Wide" all over.
 
@CatPlusPlus Most languages don’t offer this though, which is precisely my point. Haskell being the odd duck again.
 
What, strong typing? Many languages offer strong typing.
 
(is it dog or duck?)
 
4:19 PM
@KonradRudolph for that turn of phrase, usually duck.
 
Dupe votes please:
1
Q: is the name of an array an rvalue?

ologn#include <stdlib.h> int main(int argc, const char *argv[]) { char *b=(char*)malloc(sizeof(char)*50); b=(char*)"hello world"; // works char a[50]; a=(char*)"hello world"; //doesn't work. why? I thought array names are just pointers that point //to the first eleme...

 
I need to figure out FRP, finish Springbok, make Haskell bindings and then I'm done with C++.
 
> Remember that the consumer secret must not be shared.
Oh how awesome, I'm writing an open source app.
 
For APIs, you usually leave keys to be configured, not hardcoded.
 
OAuth is an invention of shit.
 
4:22 PM
It's fine.
 
Never commit configuration.
 
@RadekdaknokSlupik Edward S. Shit was an awful scientist.
 
@Neil The inventor of OAuth was that too.
HTTP basic authentication ftw.
 
4:24 PM
Fuck this stupid Android crap. I'm going back to the tuple_cat madness.
 
If you require user to provide a password for app auth, you fail.
 
Meh I'll just wait till Apple releases Mountain Lion, which includes a decent Twitter framework. I'm too lazy to design an authentication window.
 
And if you try to use API keys with Basic, then you're just reinventing OAuth, badly.
I still can't see what the problem is.
 
Funny how the first pioneered attempts at such technologies are usually the ones which establish the standard
 
@Neil well that comes from the fact that late-comers only copy to get competitive quick
 
4:34 PM
> I had an issue of circular references (i.e. A.h and B.h #including each other) and some people advised me to use #pragma once to prevent that.
o\
 
(deleted: stupid)
 
No, it doesn't.
 
Is there an equivalent to touch on Windows?
 
touch on PowerShell.
 
I have touch.
It's a tool, dammit. You can install it with no problem.
It touches a file. Even POSIX developers can't screw that one up.
 
Ell
4:41 PM
what does touch do? create a file?
 
Touches a file.
 
Duh. It's obvious.
 
If it doesn't exist, creates a new one, otherwise updates the stamp.
 
Ell
kk
 
Fancy version can set any date as the stamp.
 
sbi
4:42 PM
@CatPlusPlus Not inappropriately, mind you.
 
@CatPlusPlus For faking evidence!
 
Well. I'm debugging, and my process dies when I step over a specific line.
 
> Why would you have the processor whirring away? If you have C++11... [snip]. – R. Martinho Fernandes 17 mins ago
> its a pure c++. – Kamil Krzyszczuk 10 mins ago
 
Not even an exception message.
 
gold
 
4:45 PM
@EtiennedeMartel I've had that happen before. Usually a memory/pointer error.
GDB I'm assuming?
 
I'm in C#. With VS.
 
@EtiennedeMartel Try C++
What are you trying to do?
 
When WPF gets ported to C++, sure.
 
user784668
@MooingDuck lol, source?
 
Link to comments!
 
4:46 PM
@EtiennedeMartel There's always C++/CLI!
 
@EtiennedeMartel I've seen C++ do that when that line steps into a DLL which causes the process to crash, but can't "step in" because of lack of symbols and such. or something
1
Q: Cross platform Sleep function for C++

Kamil KrzyszczukIs it possible with macros make cross platform Sleep code? For example #ifdef LINUX #include <header_for_linux_sleep_function.h> #endif #ifdef WINDOWS #include <header_for_windows_sleep_function.h> #endif ... Sleep(miliseconds); ...

 
@EtiennedeMartel Could be an error in the CLI
Or are you calling native code?
 
ya, that would be great, but usleep doesnt stop consuming CPU. — Kamil Krzyszczuk 25 secs ago
Lol.
 
Wait, what?
 
When someone (including myself) posts something that's oneboxed, it's faster for me to reload the page than wait for the fool thing to load :/
 
4:47 PM
"foul"
 
@IDWMaster No. I'm just calling an ordinary method that I use at a bunch of other places in my code. It's just that at this specific point, it fucks the debugger quite deep.
 
@EtiennedeMartel Hmm. I'd have to see the code, or at least know what you're doing with it. Does this crash happen after a transition from a COM method by any chance (stack corruption perhaps?)?
Could you post a code sample?
 
I could post a few thousand lines of code, yes.
 
Debugger won't read all that.
 
Does the crash happen when you update a UIElement?
 
4:50 PM
No.
 
What's it doing at the time of the crash?
 
Ell
Does this crash happen when you are standing on one leg? How about doing a handstand? That ought to fix things
2
 
I'm handling a file change event from a FileSystemWatcher.
 
@Ell Standing on your hands is quite painful if you wear shoes.
 
Oh... So there is some native code involved, and you're in a callback indirectly from native code.
What are you doing in your handler, when it crashes?
 
4:52 PM
Is that thing running on a different thread?
 
Dancing.
 
@EtiennedeMartel I believe it depends on the COM context of your application. I believe it may call back from a different thread.
 
-3
Q: how is auto pilot flight software written

clifgrayI am interested in writing some software to help guide a small plane while the pilot is not paying attention. Does anyone know any information about flight software and what kind of languages auto-pilot programs are generally written in? I am hoping I could do it in something like python and ha...

 
Well, shit. It does run on a different thread.
I got a thread static cache somewhere, and it crashes when it tries to use it.
NullReferenceException.
 
4:53 PM
Haha, awesome.
Gotta love those.
 
What have you tried, and how many planes have you destroyed so far? — Don Roby 1 min ago
lol
 
@EtiennedeMartel Ahh. That would make sense.
 
I think I'm just going to marshall the stuff on the main thread.
 
> I am hoping I could do it in something like Python and have a number of sensors onboard that let me take in information such as GPS, video, weather conditions, and others so that it can have general object avoidance and can give weather warnings.
 
@EtiennedeMartel Good idea. Dispatcher.Invoke
 
4:55 PM
Writing real-time systems in Python is a very good idea!
 
@RadekdaknokSlupik Laugh out loud (rolls on floor laughing) (watches plane crash, wonders why?)
 
Depends on implementation. There are real-time systems in Java.
 
I'm going to embed a web server on my app just so I can play a video from a memory buffer.
 
And RPython is statically compilable.
With complete type inference.
 
Hmm. That's interesting!
Is it like Google's JavaScript compiler?
 
4:56 PM
PyPy is written in RPython which is then compiled to C by itself.
Metameta.
 
I'm still unsure if it's a good idea to use Python for systems that make people die if they fail.
 
Repeat again: a Python implementation written in Python that can compile itself into C.
 
That's irrelevant.
 
It's a very safe language.
Safer than C, anyway. "Oh, oops, UB caused the patient to die."
 
Ell
I don't understand what is meant by "safe"? If C crashes and doesn't know what to do, python can't magically fix itsself either?
 
4:59 PM
@CatPlusPlus Does it throw an exception when the patient dies? Or is it COM-based and returns some HRESULT for it?
 
NullPatientException.
 
Null pointers suck.
 
@Ell Python VM only crashes when there's a bug in VM. With little effort you can make long-running system that never dies.
 
Ell
Patient.onDeath = function { system("rm -r /") }
 
This is crap, I have to cast my lambda to Action to pass it to BeginInvoke.
 

« first day (599 days earlier)      last day (4335 days later) »