|
code:
|
| # ? Mar 16, 2011 03:09 |
|
|
| # ? May 21, 2013 10:13 |
|
I don't think this is really a horror but it's horribly ugly to me so whatever I'm converting the subtitles of TED Talks, which is in this JSON structure: http://www.ted.com/talks/subtitles/id/1032/lang/eng Using Google Gson to deserialize that: code:
|
| # ? Mar 16, 2011 10:39 |
|
Aleksei Vasiliev posted:Type type = new TypeToken<Map<String, List<Map<String, String>>>>(){}.getType(); code:
|
| # ? Mar 16, 2011 10:56 |
|
Just got tripped up by this fun little gem in a module that's supposed to send commands (which the part of the program I'm developing/debugging right now is supposed to generate and then dispatch by use of this module) to a direct drive motor controller over ProfiBus:code:code:Now looking at the implementation of pbusRead it turns out that the output parameter count is never actually written to so just changing the parameter from being passed by reference to being passed by value should probably suffice to clear this up, but still ...
|
| # ? Mar 16, 2011 15:15 |
|
loving code! Why does C++ automatically convert into to bool? I had one of these happen: Original signature: code:code:code:Bjarne more like Bjarse.
|
| # ? Mar 23, 2011 04:50 |
|
Nevermind, 'explicit' only applies to single-argument constructors. MutantBlue fucked around with this message at Mar 23, 2011 around 05:27 |
| # ? Mar 23, 2011 05:21 |
|
Wait why does that compile?
|
| # ? Mar 23, 2011 05:21 |
|
pokeyman posted:Wait why does that compile? Because implicit conversion always sounds like such a good idea at the time.
|
| # ? Mar 23, 2011 05:37 |
|
pokeyman posted:Wait why does that compile? some_id implicitly gets converted into bool.
|
| # ? Mar 23, 2011 06:24 |
|
yaoi prophet posted:some_id implicitly gets converted into bool. Oh, now I get it. Thanks!
|
| # ? Mar 23, 2011 06:27 |
|
yaoi prophet posted:some_id implicitly gets converted into bool. Implicit type conversion, or how you get to laugh at someone when they tell you C++ is strongly typed.
|
| # ? Mar 23, 2011 13:40 |
|
code:
|
| # ? Mar 23, 2011 15:12 |
|
HFX posted:Implicit type conversion, or how you get to laugh at someone when they tell you C++ is strongly typed. code:
|
| # ? Mar 23, 2011 15:27 |
|
Did you deliberately choose the name safe_bool and not implement the safe bool idiom to point out the other problems with bool in C++, or was that a happy coincidence?
|
| # ? Mar 23, 2011 19:26 |
|
It's just intended to be a more_typesafe_bool. I'd like to hear about those other problems with bool in C++.
|
| # ? Mar 23, 2011 23:16 |
|
HFX posted:Implicit type conversion, or how you get to laugh at someone when they tell you C++ is strongly typed. Do people actually claim this?
|
| # ? Mar 24, 2011 00:51 |
|
nielsm posted:It's just intended to be a more_typesafe_bool. I'd like to hear about those other problems with bool in C++. Consider what happens when e.g. a smart pointer template class implements operator bool and you compare two different instantiations of that template for equality. pseudorandom name fucked around with this message at Mar 24, 2011 around 01:27 |
| # ? Mar 24, 2011 01:24 |
|
pseudorandom name posted:Consider what happens when e.g. a smart pointer template class implements operator bool and you compare two different instantiations of that template for equality. I guess that can be a problem, yes. You mean like this? code:code:
|
| # ? Mar 24, 2011 01:57 |
|
I stumbled upon an interesting file today written by one of our old-timers today. It was last modified in 2001 and it both terrifies and amazes me.message_writer.c posted:__asm {
|
| # ? Mar 24, 2011 21:08 |
|
Hah I remember doing this back in the day. It was when I was just learning and didn't know anything about compiler operation. I was teaching myself C and I had some module that had to be 'super fast' so I thought 'well what's faster than asm?'. Ended up being problematic to debug and modify when I came back to it a few years later for some reason...
|
| # ? Mar 24, 2011 23:07 |
|
Thankfully inline assembler is no longer supported with Win64.
|
| # ? Mar 25, 2011 04:04 |
|
code:
|
| # ? Mar 25, 2011 12:38 |
|
Well it might do something if data changes, which could happen if it's volatile. What are data and _data?
|
| # ? Mar 25, 2011 13:40 |
|
Edison was a dick posted:Well it might do something if data changes, which could happen if it's volatile. It's not. data is passed into the method and _data is the passed in data but global. Later on the method _data = data; anyway based some some other criteria.
|
| # ? Mar 25, 2011 15:27 |
|
MrMoo posted:Thankfully inline assembler is no longer supported with Win64. Wait what?!
|
| # ? Mar 25, 2011 17:35 |
|
MSVC for 64 bit doesn't allow inline assembly. You can still have assembly source files and call functions written entirely in assembly.
|
| # ? Mar 25, 2011 17:51 |
|
Bad naming usually pisses me off, but this was a good laugh.code:
|
| # ? Mar 25, 2011 18:34 |
|
Shame about the typo.
|
| # ? Mar 25, 2011 18:50 |
|
I spend all my time in an academic research environment, and this type of stuff is rampant. Question: How do I speed this up? code:
|
| # ? Mar 25, 2011 19:05 |
|
Modern Pragmatist posted:I spend all my time in an academic research environment, and this type of stuff is rampant. code:
|
| # ? Mar 25, 2011 21:37 |
|
Bozart posted:Hey Matlab buddy ( I think? ) the biggest problem is the Combinations_16SSPCs script. Without vectorizing it, we'll probably be slow. Try running the profiler. Yes. Unfortunately I'm forced to work with matlab. This was the fine work of a co-worker (self-proclaimed programmer). I basically threw it in the trash.
|
| # ? Mar 25, 2011 21:48 |
|
Modern Pragmatist posted:Yes. Unfortunately I'm forced to work with matlab. This was the fine work of a co-worker (self-proclaimed programmer). I basically threw it in the trash. It can be surprisingly elegant if used correctly, but it takes practice, and you have to think vectors instead of iterations. The fact that it can't handle dates or strings well is something that belongs in this thread. I suggest using java classes for those. And just stay away from the database toolbox, scripts, and the eval command.
|
| # ? Mar 25, 2011 21:54 |
|
Bozart posted:It can be surprisingly elegant if used correctly, but it takes practice, and you have to think vectors instead of iterations. I love linear algebra, and can optimize me some Matlab code. However, 99% of scientists who use it cannot, and are ok with running a script over night because 2 hours is "fast enough".
|
| # ? Mar 25, 2011 21:59 |
|
After working in research for a few years I'm amazed that anything ever gets done at all. Everything is done in hackey poo poo like that, and it's so bad that results are not reproducible unless someone has the exact environment that all the hackey poo poo was run in. If someone published a paper and they said 'well you can't reproduce our results except only in our lab' would get people taken out back and beaten up. But they're all strangely okay with 'you can't reproduce our analysis unless you have our exact environment'.
|
|
| # ? Mar 25, 2011 22:40 |
|
Modern Pragmatist posted:I love linear algebra, and can optimize me some Matlab code. However, 99% of scientists who use it cannot, and are ok with running a script over night because 2 hours is "fast enough". This is something I understood after the first assignment of my Computer Vision class when I was an undergrad. You're doing linear algebra, not C programming. You're dealing with vectors and matrices, not arrays and, well, 2D arrays I guess. The point is, for loops are your enemy. Worse, however, are the people who do not understand the difference between numerical and symbolic computations and always use the latter with Mathematica or Maple.
|
| # ? Mar 25, 2011 22:48 |
|
YeOldeButchere posted:This is something I understood after the first assignment of my Computer Vision class when I was an undergrad. You're doing linear algebra, not C programming. You're dealing with vectors and matrices, not arrays and, well, 2D arrays I guess. The point is, for loops are your enemy. quote:Worse, however, are the people who do not understand the difference between numerical and symbolic computations and always use the latter with Mathematica or Maple.
|
| # ? Mar 26, 2011 05:21 |
|
code:I replaced it with a prepared statement, then ran into escaping-related issues because one of the things I was using was a regexp that involved both literal parens and grouping parens and I couldn't for the life of me figure out how to escape properly. So I just wound up running code:yaoi prophet fucked around with this message at Mar 26, 2011 around 07:47 |
| # ? Mar 26, 2011 06:19 |
|
yaoi prophet posted:
That statement there is a pretty big horror. code:
|
| # ? Mar 26, 2011 13:03 |
|
BigRedDot posted:What? If you need symbolic computations (like I did when I was in graduate school for physics) then Mathematica and Maple are exactly the right choice. If you are doing symbolic math in matlab, you are doing it wrong. That's not what I meant, but looking back at what I wrote I can see that's what it sounded like. If you need symbolic math then Maple/Mathematica are definitely the way to go, but some people apparently have no idea that there's a faster way to go than "crank through symbolic math -> evaluate result" when all they care about is the numerical values. So they always use Maple/Mathematica. It leads to things that would take seconds with even the worst Matlab script taking hours.
|
| # ? Mar 26, 2011 18:05 |
|
|
| # ? May 21, 2013 10:13 |
|
qntm posted:That statement there is a pretty big horror. Fortunately nobody is going to be searching for stuff including backslashes in our data. ![]() edit: from the Python questions thread: king_kilr posted:Fun times: yaoi prophet fucked around with this message at Mar 27, 2011 around 09:01 |
| # ? Mar 26, 2011 23:51 |























