/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

github.com/lokesh/color-thief
learnpython.org
docs.python.org/3/
docs.python.org/2.7/
arduino.cc/en/reference/SD
arduino.cc/en/Reference/SPI
arduino.cc/en/Tutorial/ReadWrite
twitter.com/SFWRedditGifs

nth for 2lazy to think of a new nth

>manager asks for new feature
>Existing code was a designated shitting repo for some Indian guy that left

Do I refactor or just get the feature done quickly and avoid cleaning up someone else's poo?

>try out new terminal color theme
>not used to the new colors
>pussy out and revert back

every time

Umaru on the front page once again!

The moment you touch it, you are going to be responsible for every possible way it fucks up in the future.

Put your gloves on and wade through the poo now, it'll be easier in the long run.

I've got an SDET I interview coming up and I'm not sure what kinds of questions to expect. I assume it'll mostly be technical, but if that means standard coding problems or problems focused specifically on testing, I'm not sure. Anyone actually done an SDET interview before?

0.9999...= 1

Repost from last thread.
I'm looking for help with some Python. I have the logic written, but I don't know the language. If there's a student or someone who could use some extra cash for a few hours' coding, hit me up.

Sup [email protected]

wow dude just do your own homework

Technically, the limit of 1/X as X->inf. Is 1.

Lol, just post it here. I'm not gonna dick around with email

Oops, fucked that up. Whatever.

email sent

Learning c++(first language).I need to start working asap, I decided to go with a painful shit, so that later my anus will be relieved when I reach php/java/whatever.

>install any dark/non-white theme
>never look back

can anyone think of a good background to go along with this web page? Black seems dull, and it's also too empty.

Gross. Just do C then Java or whatever OOP shit

Just post it you fucking faggot

>posting worst girl

steal from apple and dynamically get the background color from the card

...

G(foo(G, G(length([zero, true, fun(X,Y) -> X(3) end])))))

How do I tell what is bound and what is free?

very pretty, although I don't see how this can be done dynamically.

It's bound if it's in a scope where it's been declared.

Its just finding the majority color in the area to return

would I need css/javascript for this? Not familiar with either, and getting tempted to hardcode this for each type. :S

CHECK THE COLOR OF THE CARD BORDER

good news
github.com/lokesh/color-thief

So G, foo, length and X are all bound, Y is free, and zero, true, and end are atoms?

would this still work if I don't know the image url until runtime? I'm using Python.

First time arduino user here.
I have to do some basic coding for measuring shit from a sensor. I've done a basic code using serial for communication, and gathering the results on MatLab.
However, the real application will run with an SD card attached. And I can't get this shit to work at all. I think I'm really skipping something in here.
What i've first done is to try using SD.begin. However, that gives no answer at all (my program has some basic coding to analyze wtf is going on). So I tried with some numbers I found on the internet (SD.begin(4), SD.begin(10) and a few other random ones) and most give no answer, while SD.begin(10) just returns false.

Here's how I know wtf is going on BTW
while (!SD.begin(10)){
if (ledState == LOW) {
ledState = HIGH;}
else {
ledState = LOW;}
digitalWrite(led, ledState);
delay(1000);}

Easy stuff, just flashes the LED while it can't read. For SD.begin() and the other few numbers I tested, it doesn't even flash the LED, which makes me believe the begin function fails to return a value at all.

Anyone can shed some light on what to do? the arduino is a uno r3 btw, and the SD adapter is the thing in the picture (it has no writings on it, but a google search gives me the name w5100 ethernet shield, so I guess that's it)

I posted this on the last thread and someone told me to look into the arduino's datasheet, but I have no clue what I'm looking for. Please help, this is the first time I've messed around with arduino. I was able to breeze through everything else because I have quite a bit of experience with C so it wasn't that hard, and this SD begin thing is the only thing setting me back rn

How much of a faggot do you have to be to not be able to put already figured out logic into Python?

Python is practically pseudo-code. Getting the right logic is 90% of the work if it's a one-off script or something that doesn't need to be maintained (which must be the case, assuming your situation).

Either you're a retard, or you don't know how to program and don't actually have the right logic.

Seriously, RTFM

learnpython.org
docs.python.org/3/
docs.python.org/2.7/

Only X is bound.

Yeah, I suck. I know Py is on the simple side of things, and it's something I plan on learning when I have time to sit down and study it, but I'm in a hurry and just don't have the time to learn a new language right now, especially if it's something that someone can slap together in a couple hours. Paying someone else to do it is just a better use of my time at the moment.

in the two times you posted the request you could have learned everything there is to learn in python.

i think "dpt please do my homework" has just reaches its peak

if i have a 2d array how can i break that 2d array up into k smaller 2d array blocks?

e.g. a 8x8 array into 4 2x2 arrays

You got this, buddy.

How much time have you put into thinking about the solution to your problem?

im trying to do it in pseudocode right now

i know im going to have to iterate twice by the width and the height its just after that im getting a bit lost. my current thought process is to use the width or height somehow and maybe divide that by some variable to get the starting point

You're on the right track, friend.

How do i into application version numbering?

Just assign the numbers randomly.
v0.0.7 - First stable release
v1.0.3 - Small update
v7.3 - Minor bugfix
v7.3.1 - Major version; ABI breakages and backwards incompatibility

ive got this so far

input_arr = some square 2d array
k = # number of partitions
int width_chunk = input_arr.width/k
int height_chunk = input_arr.height/k
result_arr[k][k]
for int i = 0; i < k; i++:
for int j = 0; j < k; j++
result_arr[i][j] = input_arr[width_chunk * i][height_chunk * j]

but on that last line im only getting the current element of that target array when in reality i want to get a range. any idea?

ideally it'd be something like this (there would be some edge cases id need to take into account)

result_arr[i][j] = input_arr[width_chunk * i-1:width_chunk * i][height_chunk * j-1:height_chunk * j]

idk anything about arduino but wouldn't you need to decode the partition table and file system when accessing an SD card directly?

why are you multiplying i * width_chunk and j * height?

afaik some projects go for first-second decimal being the release and third being bugfixes, but you might skip to the next first (like in Python 2.7->3) if the change is significant. but you can really do what you want if it's your project

eh, seems about as good a scheme as any.
It's kind of what i'm doing now.

thats the bit that i got stuck on see

first stable release: 1.0
major version number changes when API or ABI changes or theres an important new feature
minor version numbers change with bugfix releases and new features

everyone expects API/ABI to stay stable within a major version

where's this problem from? post it, i don't understand the question

use git commit hashes

Only index i. If you index j you're getting an element and not an array. This also means you don't nested loops.

its part of an assignment in my image processing course about motion estimation with macroblock matching. im trying to divy a frame up into k blocks

see step 1

so something like this?

input_arr = some square 2d array
k = # number of partitions
int width_chunk = input_arr.width/k
int height_chunk = input_arr.height/k
result_arr[k]
for int i = 0; i < k; i++:
result_arr[i] = input_arr[width_chunk * i]

API/ABI isn't an applicable concern for end user binaries.

drawing some pictures might help

PRIMARY KEY(key1, key2)
How do primary keys work in SQL when you have multiple fields defined?
Does the database check if the second value is unique to the left one?
Or do they both have to be unique?

That's just blatantly false.

Hi guys been a while

I'mma look around and post if I can

trying to figure out how to mess with the person who gave me a virus. i found a folder called resspam deep inside system. the contents of the folder were recognizably shit that runs as many programs as it can, and a bunch of logs confirming my suspensions that this was definitely the folder i wanted. however going though the log i found this little gem
17:05:01 [002624] [CLSK][YouCam] SR = YUC150326-03
17:05:01 [002624] [CLSK][YouCam] UserName = HP
17:05:01 [002624] [CLSK][YouCam] CompanyName = Hewlett-Packard
17:05:01 [002624] [CLSK][YouCam] ComputerName = UMV90M34CG1OP
17:05:01 [002624] [CLSK][YouCam] OS Display Lang = 1033
17:05:01 [002624] [CLSK][YouCam] OS Non-Unicode Lang = 1033
17:05:01 [002624] [CLSK][YouCam] Location ID (GeoID) = 0xF4
17:05:01 [002624] [CLSK][YouCam] ProductName = YouCam
17:05:01 [002624] [CLSK][YouCam] Version = 6.0
17:05:01 [002624] [CLSK][YouCam] Command Line = "Setup.exe" -s
17:05:01 [002624] [CLSK][YouCam] OS Version = Win10
17:05:01 [002624] [CLSK][YouCam] Bit = 64.
its been a while since i last got really into computers so im pretty much just working off of what i remember,and google. so all i could gleam from that was that he's somewhere in the U.S. help if you can. i could really use it.

Closer. However you need to get rid of width_chunk and height_chunk. All you need is chunk_size. This value should be equivalent to input_arr.x such that k | x where x is the width or the height.

Now you can produce the proper range of the subarray.

We aren't your script kiddy army

The combination of all of the primary keys has to be unique.

for a table
animal(type*, name*, age*)
dog bob 1
dog bob 2
dog jim 1
cat bob 1
cat bob 2
cat jim 1

are all unique primary keys in the table

Install Gentoo. That'll show 'em.

how did you unironically fall for a skiddie from 2006

can you please post your actual code dude, i don't want to trouble shoot this generic loop. port your setup() and loop() and everything else. Tell me what SD library you are using and how you have the SD shield wired to the board. Tell me if the compiler is compiling or throwing errors or warnings etc.

this gets interesting when you begin to work in clustered OLAP databases. Primary and foreign key constraints become mostly informational and sort/distribution keys determine storage and traversal

Working on an encryption decryption program that doesn't use any of the encryption libraries in c#

because I'm a masochist. and yesterday someone said it wasn't even possible.

what library/API are you leveraging for ciphers, RNG, etc?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


Thats all I'm using.

The hardest part is finding an encryption method that's actually reversible.

But I think I have it.

It is not impossible but it is very possible that your implement is flawed and has some vulnerabilities.

so, just out of curiosity, are you going for something like a gpg or openssl type utility? That is quite an endeavor indeed.

Honestly i'm just being basic.

take text, change text into something else semi-random and give a key.

then decrypt by giving that same text and your key.

When I'm done I'll pastebin it here.

have fun

Wouldn't doubt it.
The problem yesterday was me trying to reverse modulus, because I'm stupid.
so tonight I'm trying something different.

yeah...

>tried to reverse a modulus operation
wew lad

code is too big to post all at once, but setup is the following:
void setup() {
pinMode(led, OUTPUT);
pinMode(swi, INPUT);

while (!SD.begin(4)){
if (ledState == LOW) {
ledState = HIGH;}
else {
ledState = LOW;}
digitalWrite(led, ledState);
delay(1000);}
digitalWrite(led, HIGH);
analogReference(EXTERNAL);

calib();
}


all the led stuff is for debugging there, and calib doesn't use the SD. However, the code doesn't even reach calib(), it stops by the SD.begin(), (I know this my using the led - by flashing at different frequencies or just staying on/off, I know where in the code it currently is) so I don't think I need to divide my code into mulltiple posts. loop() doesn't even get called as well. The compiler gives no errors, and the only warnings are
WARNING: Category 'Device' in library ParPrinter is not valid. Setting to 'Uncategorized'
WARNING: Category 'Device' in library Radar is not valid. Setting to 'Uncategorized'

But i'm using neither libraries, so I don't think it matters (or does it?).
The sd library i'm using is just SD.h. I didn't even know there were other libraries. As I said, it's my first time messing around with arduino. The ethernet/SD shield only has one way into the arduino, which is literally placing it on top. As you can see from the pic, it just has it's pins that connect to the arduino analog/digital/source entrances, and it has six ICSP connectors that connect the SD reader to the arduino itself. That's the thing I should be accessing, but idk if I should be stabilishing shit like said, but I was hoping it would be kinda like standard C programming where you only mess with file pointers and that's it.
I use the standard arduino compiler btw, not sure if there are others.

>when you add a bracket around a variable and it fixes the code that you've been working on for 2 weeks
pic related me, taking off my noose.

>whip up some quick n dirty code
>hmm i wonder if i could make this a bit more efficient

>4 hours later on history.stackexchange reading about the Saud family and the destabilizing effects of discovering large pockets of fossil fuels leading up to WW2

arduino.cc/en/reference/SD
arduino.cc/en/Reference/SPI

The communication between the microcontroller and the SD card uses SPI, which takes place on digital pins 11, 12, and 13 (on most Arduino boards) or 50, 51, and 52 (Arduino Mega). Additionally, another pin must be used to select the SD card. This can be the hardware SS pin - pin 10 (on most Arduino boards) or pin 53 (on the Mega)

I don't see those pins being set here or being #define above

>aka taking your first dose of the redpill
>A few more steps and you are on Sup Forums
>Then you realize that it is just the start of the bunny hole

>a few more days go by
>writing haskell to scrape loli threads on Sup Forums
>finally hit final form

>Hits final form
>Knock on the door
>"FBI here!"
>Its go time

this is over my head but I'm refusing to give up.

>hit killswitch
>all drives wipe at once
>FBI rolls in
>Me in my ergonomic chair
>leather trenchcoat
>leather fedora
>let_the_bodies_hit_the_floor.jpg

When looking through the SD reference and the examples it gives, no function is ever called from the SPI.h library, neither are any of those pins
Just look at this example:
arduino.cc/en/Tutorial/ReadWrite
after estabilishing a Serial connection, it just jumps straight into the SD. Is there something I'm missing? I feel really lost desu, i was finding most of this stuff easy until I hit this fucking problem

I'd suggest that you dupe your friend by making an application that uses base646 and ROT13 (both should be hellishly easy to implement) and with both they probably wouldn't be any wiser that it was a sham.

Just a way to best your mate and not drive yourself insane with a Sisyphean task

>spend an hour wondering how I'm getting exactly the wrong output for a function
>realize I forgot to escape my "." delimiter

In my stress testing of akari-bbs, I managed to increased the maximum post rate to around 40 posts per second and I fixed a glaring oversight that was allowing multiple posts on the same board to share the same post number.

Fuck off and kill yourself

>You have prepared for this moment for a long time
>Go down in a blaze taking down as many of the Jew's pigs as possible
>Immoralized on CNN and Sup Forums
>Another user is tricked into visiting Sup Forums upon hearing your story
>So the cycle begins again

Wow thank you for responding.
I'm just very happy.
Hahaha (:

That makes no fucking sense faggot

can you try using an if statement instead of while here:
while (!SD.begin(4)){
if (ledState == LOW) {
ledState = HIGH;}

thats one difference I see between what you have here and that. From a logic perspective it makes sense you'd only proceed to open the file called later if the SD card was initialized.

there's no mate involved. its just the dpt roller task I'm doing. Thats why I'm sure I'm being a masochist.

...

tried it, it still doesn't reach calib()