|
When you have a data stream, are you easily able to map it to a physical sensor? Couldn't you just maintain the full sensor map without re-creating the entire dictionary every time that you see a new sensor?
|
# ? Jan 20, 2014 19:57 |
|
|
# ? Apr 27, 2024 11:59 |
|
The data stream includes the physical sensor number. Not sure what you mean by a "full" sensor map, if every application used all the sensors then this wouldn't be an issue. The issue is to figure out which subset of the sensors is currently in use. I don't know why we're still talking about this. As I mentioned earlier, I figured out a way to ask for the number of sensors in use without requiring the user to enter it, so my new method doesn't involve catching exceptions or re-creating dicts: 1. Ask how many sensors to expect. 2. Keep track the sensors I've encountered. 3. When I've encountered the expected number of sensors, create the logical-physical mapping and switch to the normal data handler.
|
# ? Jan 20, 2014 20:11 |
|
code:
|
# ? Jan 21, 2014 19:43 |
|
Tha Chodesweller posted:
Well now if you want to change the color you just update Gray.bmp to be blue, duh
|
# ? Jan 21, 2014 19:53 |
|
Perhaps more astonishingly, this exact method and image are used to set the background color of buttons elsewhere. Instead of, y'know, Background="Gray".
|
# ? Jan 21, 2014 20:48 |
|
What if Microsoft changes the definition of Gray, or makes Rectangles display as hexagons? You need to think ahead.
|
# ? Jan 21, 2014 21:17 |
|
Gazpacho posted:or makes Rectangles display as hexagons This isn't the thread for discussing leaked confidential Microsoft plans for Metro 2.0 in Windows 9
|
# ? Jan 21, 2014 21:22 |
|
Gazpacho posted:What if Microsoft changes the definition of Gray, or makes Rectangles display as hexagons? You need to think ahead. It's a non client facing utility and if I recall correctly the color definitions are from X11, so I would be more worried of interns changing images haphazardly. Goatse buttons anyone?
|
# ? Jan 21, 2014 22:48 |
I can't believe I wrote this. To be fair it was over two years ago. It's a miracle this hasn't broken until today when someone put a non-UTF8 character in the jsoncode:
Polio Vax Scene fucked around with this message at 23:20 on Jan 21, 2014 |
|
# ? Jan 21, 2014 23:17 |
|
Manslaughter posted:put a non-UTF8 character in the json A code point wider than 8 bits, you mean?
|
# ? Jan 21, 2014 23:53 |
|
What the hell is a non-UTF8 character and what is it doing in a String object?
|
# ? Jan 22, 2014 00:01 |
|
Manslaughter posted:You guys are so lucky, you actually have things in your exception blocks At my last job we had: code:
code:
|
# ? Jan 22, 2014 01:25 |
|
http://msdn.microsoft.com/en-us/library/office/cc264288%28v=office.14%29.aspx Are you loving kidding me, Microsoft? A public API with multiple numbered methods? code:
|
# ? Jan 22, 2014 04:04 |
|
You must be new to COM interfaces.
|
# ? Jan 22, 2014 04:11 |
|
Bognar posted:http://msdn.microsoft.com/en-us/library/office/cc264288%28v=office.14%29.aspx Sharepoint. That explains it. I'm still not convinced that Sharepoint isn't something Microsoft made to gently caress with our heads as opposed to a usable, sane, useful product.
|
# ? Jan 22, 2014 04:12 |
|
Bognar posted:http://msdn.microsoft.com/en-us/library/office/cc264288%28v=office.14%29.aspx Nice that the article is about EditDocument3 but the code sample is EditDocument2 Also the comment on the page: "The expample is incorrect" Edit: Using this post to share: My friend showed me this http://stackoverflow.com/questions/21186724/have-i-tattooed-a-syntax-error-on-my-arm?newsletter=1&nlcode=4592|dedb it's kind of a coding horror in a way Jewel fucked around with this message at 04:53 on Jan 22, 2014 |
# ? Jan 22, 2014 04:32 |
|
Ithaqua posted:Sharepoint. That explains it. I'm still not convinced that Sharepoint isn't something Microsoft made to gently caress with our heads as opposed to a usable, sane, useful product. I'm convinced it's a product that was made by a group of interns in 3 months that the marketing guys managed to get a hold of and sell to every large company on the planet. It's not uncommon for me and my coworker to ask each other "Why did you do this?" and the answer is usually "Because SharePoint." Here's a beauty in our current codebase: C# code:
|
# ? Jan 22, 2014 05:09 |
Munkeymon posted:A code point wider than 8 bits, you mean? Zombywuf posted:What the hell is a non-UTF8 character and what is it doing in a String object? Whoops, had it backwards. Expecting ASCII, got UTF8. Even though I'm using UTF8 GetBytes. Guess I picked one at random, said "eh it works" and moved on. It was a thing that made the length of the string different from the length of the bytes. So the stream got cut off early because I was measuring the string length and not the byte length. (gently caress your bytes)
|
|
# ? Jan 22, 2014 06:37 |
|
Bognar posted:The properties Sites and AllWebs automatically instantiate connections to the sites or webs which you then have to dispose of yourself. This happens every time you access the property. Who the hell decided to make that a property and not a method? Also, what's up with the naming? Why not AllSites, or maybe just Webs, so we could have some drat consistency? Another Sharepoint horror: Violating the design contract for the IDisposable interface. For example, SPLimitedWebPartManager implements IDisposable. But in addition to wrapping the SPLimitedWebPartManager in an using block, you must also dispose the SPWeb exposed by the Web property manually. SPDisposeCheck saved us a lot of trouble, and I've configured it to be run in every Team Build that I'm responsible for.
|
# ? Jan 22, 2014 07:28 |
|
Give me all the webs!
|
# ? Jan 22, 2014 11:02 |
|
Jewel posted:Edit: Using this post to share: My friend showed me this http://stackoverflow.com/questions/21186724/have-i-tattooed-a-syntax-error-on-my-arm?newsletter=1&nlcode=4592|dedb it's kind of a coding horror in a way I expect no less from a language that has "Quote Removal" as one of its parsing steps.
|
# ? Jan 22, 2014 14:56 |
|
Manslaughter posted:Whoops, had it backwards. Expecting ASCII, got UTF8. Even though I'm using UTF8 GetBytes. Guess I picked one at random, said "eh it works" and moved on. While you're in there you might as well change things to support all Unicode, as json is defined to be unicode by rfc4627. code:
|
# ? Jan 22, 2014 15:45 |
|
Serious contender for the worlds greatest PR; https://github.com/fre5h/DoctrineEnumBundle/pull/12 A collegue submitted that PR yesterday. We thought the reply was pretty special yesterday. Today it's all over twitter and gone totally viral.
|
# ? Jan 23, 2014 10:34 |
|
That thread highlights the dangers of code getting political:quote:poo poo. I don't want to have comments like these on PRs to my repos while I stay here, in Russia...
|
# ? Jan 23, 2014 14:47 |
|
Ahah, yep, I saw that on twitter today! Definitely getting around.
|
# ? Jan 23, 2014 14:51 |
|
Zombywuf posted:That thread highlights the dangers of code getting political: Good point, if that is all over twitter too, the wrong people could see it and take it badly.
|
# ? Jan 23, 2014 15:05 |
|
The scripting language interface for the IRC client weechat is pretty awesome:quote:As you probably know, there is not really "pointers" in scripts. So when API functions return pointer, it is converted to string for script.
|
# ? Jan 24, 2014 01:09 |
|
Still nowhere as insane as mircscript.
|
# ? Jan 24, 2014 01:35 |
|
Opinion Haver posted:The scripting language interface for the IRC client weechat is pretty awesome: Oh man, an API made of unchecked function pointers. ~What could possibly go wrong?~
|
# ? Jan 24, 2014 01:37 |
|
Opinion Haver posted:The scripting language interface for the IRC client weechat is pretty awesome: I refuse to believe that this isn't some sort of elaborate joke.
|
# ? Jan 24, 2014 01:53 |
|
Plorkyeran posted:Still nowhere as insane as mircscript. I wrote an entire trivia-based pokemon clone in mircscript. Two, actually. I think that's why I feel right at home in C++.
|
# ? Jan 24, 2014 03:22 |
|
A homework problem asked students to write a simple function which determines whether a number is divisible by 2 or 3. Some wrote it like this:code:
We just started covering recursion in Racket. Can you tell?
|
# ? Jan 24, 2014 04:55 |
|
Is this an introductory programming course, or a principles of programming languages course?
|
# ? Jan 24, 2014 05:09 |
|
The latter. Students are mostly third-year CS students with some experience programming in imperative languages, but many have never used a functional language before. My sincere hope is that most of the overly complicated solutions I've seen so far are a result of wanting to show off.
|
# ? Jan 24, 2014 05:15 |
|
I know when I want to show off, I write things like "if true then return true else return false."
|
# ? Jan 24, 2014 05:22 |
|
Internet Janitor posted:A homework problem asked students to write a simple function which determines whether a number is divisible by 2 or 3. Some wrote it like this: code:
|
# ? Jan 24, 2014 05:28 |
|
Internet Janitor posted:The latter. Students are mostly third-year CS students with some experience programming in imperative languages, but many have never used a functional language before. My sincere hope is that most of the overly complicated solutions I've seen so far are a result of wanting to show off. Probably they've come to associate functional languages with recursion as in "every solution must involve recursion."
|
# ? Jan 24, 2014 05:47 |
|
But those solutions are iterative.
|
# ? Jan 24, 2014 06:13 |
|
Not the "solution" I was talking about.
|
# ? Jan 24, 2014 06:31 |
|
|
# ? Apr 27, 2024 11:59 |
|
carry on then posted:Not the "solution" I was talking about. Yes it is. It's iterative.
|
# ? Jan 24, 2014 06:37 |