What are you working on, Sup Forums?
Old thread:
What are you working on, Sup Forums?
Old thread:
Other urls found in this thread:
w3.org
a.4cdn.org
jackxmorris.com
github.com
developers.google.com
twitter.com
First for Rust
Remember, if you're a christian programmer, avoid Vi and its many faces & disguises, like Vim, Neovim and the heretic alchemy of Spacemacs.
Use only the holy editor of Emacs!
More like Bust #gotem
Python master race
car_manu = ['ford', 'vauxhall', 'toyota', 'renault', 'volkswagen']
car_dict = {
"ford" : {
'focus', 'fiesta'
}, "vauxhall" : {
'corsa', 'astra'
}, "toyota" : {
'aygo'
}, "renault" : {
'clio'
}, "volkswagen" : {
'golf', 'polo'
}
}
print('\n'.join(
ele for ele in sum(
[ele for ele in [
list(car_dict[brand]) for brand in car_manu]
],[])
)
)
now do fizzbuzz
Studying for CS final and am practicing on implementing a Binary Search Tree.
Here's my code for "Delete Node"... I feel like I screwed up royally with the garbage collection.
BSTNode* BST::deleteNode(const std::string& key)
{
BSTNode* foundRoot = findNode(this->root, key);
if(foundRoot == NULL) return NULL; //Node wasn't found;
if(foundRoot->left == NULL && foundRoot->right == NULL)
{ //No children. Can remove node without needing to change the tree
delete foundRoot;
}
else
{
if(foundRoot->left != NULL && foundRoot->right != NULL) //Two children. Requires replacing the node to delete by the rightmost node on left subtree
{ //or leftnmost node on right subtree
BSTNode* replacingNode = foundRoot->right;
BSTNode* prevNode = foundRoot;
while(replacingNode->left != NULL) //Traverses all the way down the left path of the right subtree until it finds a leaf
{
prevNode = replacingNode;
replacingNode = replacingNode->left;
}
foundRoot->value = replacingNode->value;
delete prevNode->left;
prevNode->left = NULL;
}
else //Only one child
{
if(foundRoot->left == NULL && foundRoot->right != NULL) //Only right child
{
BSTNode* temp = foundRoot->right;
foundRoot->value = temp->value;
delete temp;
foundRoot->right = NULL;
}
if(foundRoot->left != NULL && foundRoot->right == NULL) //Only left child;
{
BSTNode* temp = foundRoot->left;
foundRoot->value = temp->value;
delete temp;
foundRoot->left = NULL;
}
}
}
return NULL;
}
can someone tell my what i'm doing wrong?
im following this w3.org
modified_since = time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(int(time.time())-600))
headers = {'Last-Modified': modified_since}
r = requests.get(a.4cdn.org
ups, forgot to put the url between ' ' here
What's the point of the return value?
I was sort of confused if I should return something. I need to make sure the root node is updated with the changes on the subtrees below it... Do I already take care of that in my code?
>Do I already take care of that in my code?
What kind of question is this… You wrote it…
I've got a gyroscope sensor who's outputs go from 0 to 360 and then snap back to zero
How can I take the output of these functions and map them to 361 362, etc. when the output snaps back to 0?
count cycles?
Okay, I'm probably not making much sense, but I'm trying to implement a BST . I was wondering if simply changing the pointers is enough to get the job done
How would I do that?
++ ?
>What are you working on, Sup Forums?
creating rare pepes
Under what conditions do I add one to the cycle?
r = ...
cycles += r / 360;
r %= 360;
Store the last reading and add 360 * (floor(lastRead/360)) to the new reading if the new reading mod 360 is greater than 180. Make sure the stored readings are the modified values not the raw if you want it to go multiple rotations (721, etc)
err forget the mod of the new reading
This won't work. If the gyroscope goes from 355 back to 0, nothing gets detected.
...
that's not pepe, it's his insane leftie brother
This shit is giving me headaches
fuck off
get out of here then
What's the technique, boss?
GIMP
He just inverted the colors.
jackxmorris.com
It's slow as fuck though. I'm waiting until it finishes getting the dots in the right spot. Then it'll find a solution to the traveling salesman problem with the given points.
I'm btw
I see, but the plotting of the 'dots' into the pepe, what was the technique for that?
i didn't see any code in the page you linked..
or did you wrote some?
and why is it so slow?
Oops, nevermind, I see it now.
That page says Weighted Voronoi Stippling. No idea what it means, though
>check out my code on Github
at the bottom of the page
github.com
>No idea what it means, though
I kind-of have an idea. Might try to implement it later.
Sorry that whole thing was retarded. I think this would be more accurate, if you're just above zero and the last reading was above 180, then it probably rolled over 360 and reset so handle that, if you're just below 360 and the last reading was below 180 then it probably rolled under and jumped to 360, handle as appropriate
if lastRead is undefined
return rawVal
if rawVal < 90 then
if lastRead % 360 > 180 then
r = 360 * (floor(lastRead / 360) + 1)
else
r = 360 * floor(lastRead/360)
fi
else if rawVal > 270 then
if lastRead % 360 > 180 then
r = 360 * floor(lastRead/360)
else
r = 360 * (floor(lastRead/360) - 1)
fi
else
r = 360 * floor(lastRead/360)
fi
return r + newVal
hello I'm making this post for a friend
he is an utter madman
he wants to know how to write a ddr4 ram driver
Rate my AoC Day 10!
int done = 0;
while (!done) /* run commands */
{
done = 1;
for (i = 0; i < BOTS; i++)
{
if (bot[i].idx >= 2)
{
done = 0; /* keep running */
int low = min(bot[i].store[0], bot[i].store[1]);
int high = max(bot[i].store[0], bot[i].store[1]);
for (j = 0; j < 2; j++) /* give */
{
int addr = bot[i].send[j].addr;
int mode = bot[i].send[j].mode;
struct bin *to = (mode == BOT) ? bot : out;
to[addr].store[to[addr].idx++] = (j == LOW) ? low : high;
}
memset(&bot[i], 0, sizeof(struct bin)); /* wipe bot */
}
}
}
what's the deal with bitwise operations like xor
what happens if you interpret them geometrically
didn't know you write code in Age of Conan
>what's the deal with bitwise operations like xor
I don't know Jerry
>what happens if you interpret them geometrically
Universe will be divided by zero.
XOR shows, if the sum of TRUE values is odd.
Sometimes it's useful, like swapping values without temporary variable.
Thank you for doing Advent of Code 2016.
developers.google.com
is YOUR_API_KEY something I want to keep secret? the only harm that can be done with it is making calls under my account which could jack up my usage, but since google gives you 1m free calls per day, I don't think there's any worth in stealing this key.
You are a disgusting fuck using an 'AoC' style challenge for data mining.
xor is the most important operation in cryptography. there is a joke that say you only need to know how xor work to become a cryptographer.
>what happens if you interpret them geometrically
imagine putting two shapes above each other, both are black and white. where two white areas have an overlap, it's black again, otherwise it's just as in the shapes.
Stiiiiiillllll getting the dots in the right place.
I swear, I think this is trying to solve the Traveling salesman problem each time.
I inverted the colors because I actually kinda like it that way
Woah. Didn't mean to quote.
At either rate, you can ask Linus
How the fuck do you plan to keep it secret if it MUST be shipped to the client so it can make requests?
Addition table:
addition
_|_1_|_0_|
1| 10| 1 |
0| 1 | 0 |
Xor table:
XOR
_|_1_|_0_|
1| 0 | 1 |
0| 1 | 0 |
You can see the only difference between the two is in case 1 xor 1 and 1 + 1
So, in digital logic, xor is used to create adders and half adders. you can use an AND gate to find if there's a carry-out bit:
AND
_|_1_|_0_|
1| 1 | 0 |
0| 0 | 0 |
Also, XOR can be used in imagery.
Imagine one of those "what's the difference" images. Xor the two images and everything that's the same will become black while the differences will show up.
Is AOC being used for data mining?
s-someone?
Shut the fuck up dude
k-kys?
a-are you m-m-making fun of my s-s-s-stuttering condition?
>kisses you softly
a-user this isnt the time to erp
Rewriting the Linux kernel in APL
Do it in haskell
already did
Guys, i'm working on a kernel in C and i need some help
let me know if anyone's interested and i'll post my github with the code
Rate my fizzbuzz
for i in range(1, 20): message = "fizz" if i % 3 == 0 else "buzz" if i % 5 == 0 else i; print(message)
Which is the best programming language for Scandinavians?
k tard
Cuck++
I bet you were going to post the Linux kernel when someone asked
>le APL meme
APL is dead.
It was never really alive desu, certainly was never useful.
Yes. That's why it requires google/github/etc accounts.
t. Applet
What do you listen to while programming?
Guess again, irrelevant beardy.
edenofthewest.com
Post code.
Everything is being used for data mining these days.
area = function(r) {
return r * r * 3.14159
}
(14)
// area = 615.75164
Gotta love JavaScript
Whatever helps you sleep at night.
Sperging about data mining in 2016 when we already lost is the definition of insanity.
I don't sleep any more. Don't want them to know how much sleep I need.
how many hours do you sleep a day?
I'm going to live in a yurt in Mongolia. I'd like to see them data mine me then.
>reddit account
>data mining
kek
Gross senpai
3.
So you just said you're gonna live in Mongolia. Ezpz to triangulate where your yurt is, m8.
google pls go
...
?
Triangulate with what? I'm not taking any electronics with me.
Hi guys, I just learnt about bit fields in C. I have a question. Should we programmers always try to use as little memory as a possible? Or are computers strong enough nowadays to just not care about such things?
YOU won't, but your yurt-mate surely will have one. :^)
?
It doesn't matter, especially if you're already using C. Write your code as clearly as possible.
Post times you fell for meme langs, libs, or frameworks
?
Scala isn't a meme, it pays well.
?
I know, but the Play! framework was definitely a meme.
Nothing is a meme unless stated otherwise by the mememasters.
you even don't need a email to create a reddit account.
It doesn't matter until it's obvious it does matter (for instance, when dealing with Gigabytes of data and efficiency is a requirement)
Just got my first and last application written in this to an installable and usable state.
At what point did you realize it was your last?
Let's be honest, Play is fucking atrocious. It practically forces you to use singletons and globals everywhere. The resulting code is untestable.