« first day (3627 days earlier)      last day (1306 days later) » 

1:46 AM
I planned to go to the rural property and do some work today, so went preparing for that last night. But it rained this morning, so I slept in - would rather not walking in the mud and working on the construction project when it rains.
 
 
2 hours later…
4:12 AM
My code works 33% of the times, now my job is to improve that success rate :p
 
 
2 hours later…
5:55 AM
So you guys up to anything cool?
 
 
1 hour later…
6:57 AM
@Mikhail yewa
wow, this place is very active
 
7:16 AM
@Laura Yeah, unfortunately
 
 
3 hours later…
10:14 AM
This 'new' person reminds me of that old chicken in the lounge :x
 
 
3 hours later…
1:29 PM
I'm close from a new cpp-sort release, but I need to run a ton of benchmarks first, which is annoying
 
 
5 hours later…
6:18 PM
Still haven't regenerated most of the benchmarks
 
user7659542
Amids all this corona fear, stockmarket volatility and other crazy stuff in our world. There are still nice things going on in our world, more precisely in Australia:
 
user7659542
This being said the Australian PM did handle that situation quite professionally
 
7:12 PM
@Morwenn Are you running them or is the CI running them :-)
 
@Mikhail I am running them, I'm still unsure which ones to pick, etc.
 
Maybe all of them :-)
 
No, that would be too long x)
 
Then run each multiple times to take an average of the walltimes :-)
 
I pick before running them
 
7:34 PM
One thing that is really pissing me off about websites like HackerRank are the absurd function signatures
vector<int> compareTriplets(vector<int> a, vector<int> b) {
ಠ_ಠ
 
user7659542
8:14 PM
I ve actually come accross a probmem which I do not know how to solve in a clean way
 
user7659542
My process receives TCP/IP messages. Based on its 2 first bytes of the payload certain actions are undertaken. Which leads me to have a function structure like this
 
user7659542
void handleTCPIPMsg(msg_t* msg)
{
    switch ((msg->payload[0]) &  (msg->payload[1]<<8))
    case 0x0001:
        func55();
        funcABC();
        ....
       break;

    case 0x0002:
        func188();
        funcFFF();
        ....
       break;
    case ...
    case 0xFFFF:
        func789();
        funcTREE();
        ....
       break;

}
 
Looks fine
 
user7659542
How do you avoid having a function which is 2000 lines long in order to handle all cases?
 
maybe use #defines or something else for the case statements
 
user7659542
8:19 PM
@Mikhail yes obviously. But the function will still be 2000 lines long in order to handle all messages
 
You'd avoid the 2k lines by nesting the statements
so that certain ranges would go to certain functions
If anybody gives a fuck about that I'm not sure
 
user7659542
I was considering callback functions in an array, where the index corresponds to the value of the case statement
 
The best code cleanup is give case x00001 a real name
 
user7659542
upon reception of a message you d go through the array of function pointers (to the callbacks) and dereference to the function in question
 
Sure, but that looks like what you wrote because you need to build the same array
KISS
 
user7659542
8:22 PM
I need to build it indeed. But then at least it is not 1 single function handling 65535 cases. I could have all those handlers in a separate source file
 
user7659542
and call them onReceptionMsg0x0001
 
user7659542
(obviously I d rename 0x0001, but you get the idea)
 
Sure but you could also just do that in the switch
 
user7659542
and for the construction it d just be:

myHandlersArray[] =
{
    .onReceptionMsg0x0001,
    .onReceptionMsg0x0002
    ...
}
 
user7659542
(pseudo code)
 
user7659542
8:24 PM
@Mikhail yes you could. But at least it s not a 2k line function you have to scroll through. Looks much less maintanable and readable to me
 
Now imagine if you messed up the order of myHandlersArray?
 
user7659542
I am not worried about that. I am more "worried" about the situation where the value in the 2 first bytes of the payload does not correspond to the array's index
 
user7659542
eg
 
user7659542
you start at 0x0123 rather than at 0x0001
 
user7659542
you'd need to somehow be able to create a heterogeneous array
 
user7659542
8:27 PM
or maybe a linked list of structures containing the value and func pointer
 
use a switch
 
user7659542
urgh... nah
 
lol linked list
at the front the of your function you check for valid inputs
 
user7659542
There must be something more clever out there I am not aware of
 
There are many ways to shoot yourself in the foot, obfuscate your code, and increase your job security, perhaps you're paid hourly :-)
 
user7659542
8:29 PM
nope, per day
 
"I finished in 1 hour now I got nothing to do" :-)
 
user7659542
Well, yhea... You can do that when the manager estimates you needed 8h for a given ticket
 
user7659542
you now got 7h of free time
 
But whenever I personally tried this stuff with the WinAPI I've always messed up at later maintenance stages keeping the list of message handlers in order.
 
user7659542
But, that switch statement just hurts my eyes
 
user7659542
8:32 PM
Wondering how would Linus have solved this
 
user7659542
there must be parts in the kernel where they faced the same "issue"
 
The principle downside to with a large switch statement is that its O(N)
 
user7659542
Don't know that crap
 
?
 
user7659542
When people were taught this at uni, I instead chose the avionics courses and trying to land a job at a drone factory abroad
 
user7659542
8:35 PM
So never learned about big O notation
 
time to learn
 
user7659542
urgh
 
user7659542
must be some theoretical crap you probably never use again later
 
8:52 PM
Does anyone know what the tech stack behind hellotalk or tandem would be???
 

« first day (3627 days earlier)      last day (1306 days later) »