comp-sci

Discord ID: 423219052849397773


17,577 total messages. Viewing 100 per page.
Prev | Page 18/176 | Next

2018-04-10 01:17:00 UTC

>postfix
<:super_edgy:426099058466095119>

2018-04-10 01:32:39 UTC

They do it the first way to try to avoid something like this:
```c
if (x = 3) { ... }```
when you actually meant
```c
if (x == 3) { ... }```

2018-04-10 01:36:21 UTC

But every compiler and LINT tool catches that and warns about it.

2018-04-10 01:37:03 UTC

In GCC, for instance, you'd have to write
```c
if ((x = 3)) { ... }```
to make the compiler like that. One legitimate use case of that would be
```cpp
int n;
if ((n = scanf(...)) != EOF) {
// now use n
switch (n) {
case 0:
return -1;
case 1:
// ...
...
} else {
// handle the case where scanf returned EOF
}
```

2018-04-10 05:12:35 UTC

Peak wokeness: Translating Java into assembly code

2018-04-10 05:12:40 UTC
2018-04-10 05:13:20 UTC

Kill Me, I've accepted that I'm not getting either %x or %d done

2018-04-10 07:37:21 UTC

you don't need to print everything lol

2018-04-10 14:44:46 UTC

kys

2018-04-10 14:45:41 UTC

Lol

2018-04-10 23:56:48 UTC

https://cdn.discordapp.com/attachments/423219052849397773/433415083423694850/unknown.png

2018-04-11 00:18:37 UTC

wtf

2018-04-11 00:18:43 UTC

is that real?

2018-04-11 00:23:43 UTC

no lol

2018-04-11 00:24:19 UTC

https://cdn.discordapp.com/attachments/423219052849397773/433422008290770945/unknown.png

2018-04-11 00:28:17 UTC

too bad I'll never use it

2018-04-11 03:10:41 UTC

https://cdn.discordapp.com/attachments/423219052849397773/433463877443911690/20180411_040952.jpg

2018-04-11 03:11:01 UTC

learning about reverse engineering is so much fun

2018-04-11 03:11:15 UTC

do you guys do much of it?

2018-04-11 07:34:06 UTC

@redd I touched it briefly back in the day.

2018-04-11 13:17:11 UTC

I need to practice reading assembly code

2018-04-13 04:40:42 UTC

no

2018-04-13 04:51:56 UTC

Yus

2018-04-13 10:02:26 UTC

Nothing unusual there.

2018-04-13 10:02:31 UTC

It's supposed to be like that.

2018-04-13 11:47:46 UTC

floating point arithmetic is <:LITAF:252198535426998272>

2018-04-13 15:02:43 UTC

Itโ€™s ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ

2018-04-14 04:28:09 UTC

I finally have the portrait monitor I've always wanted

2018-04-14 04:28:18 UTC

I should get another one when I can.

2018-04-14 04:28:42 UTC

It's vesa-mounted to rotate.

2018-04-15 03:03:01 UTC

@Deleted User Just finished my last lab for that assembly class, was all in C though, working with the GPIO on the Raspberry Pi and five pushbuttons to light up ad RGB LED and increase and decrease brightness.

2018-04-15 03:03:19 UTC

Although I'm now seeing dots everywhere from the LED constantly flashing in my face.

2018-04-15 03:10:31 UTC
2018-04-15 04:21:54 UTC

Inspired by your ARM antics, I'm too writing code for some shitty hardware.

2018-04-15 04:22:11 UTC

lmao

2018-04-15 04:22:26 UTC

Coding on the Wii U.

2018-04-15 04:22:30 UTC

lol

2018-04-15 04:22:41 UTC

At least it's mostly C++.

2018-04-15 04:22:50 UTC

I actually had a problem with this GPIO lab, but then realized I had wired all my pushbuttons as active high.

2018-04-15 04:23:13 UTC

๐Ÿคฆ -> ME

2018-04-15 04:24:22 UTC

And to balance out the high level, I spent last night designing a simple circuit for my parents.

2018-04-15 04:24:29 UTC

nice

2018-04-15 04:24:46 UTC

I think my summer project is gonna be a multiplayer text based RPG

2018-04-15 04:25:55 UTC

Good old NE555 and the "you may need a capacitor here, gotta try it out and see what happens" instructions.

2018-04-15 04:26:05 UTC

lol

2018-04-15 06:37:45 UTC

Good get

2018-04-15 17:16:15 UTC

@DanielKO what is the Wii U like to program? is it annoying or moderate?

2018-04-15 17:19:37 UTC

Libraries and shit is a bit fragmented, everyone has their own BSD sockets header, each slightly broken.

2018-04-15 17:19:54 UTC

And you can't use `cout`, only `printf`, or the entire system crashes.

2018-04-15 17:20:34 UTC

And of course, with regards to the system functions, there's no documentation.

2018-04-15 17:21:09 UTC

sounds ez <:Kappa:260415088702390273>

2018-04-15 17:21:17 UTC

good luck with that

2018-04-15 17:48:41 UTC

Sounds fun

2018-04-15 18:16:25 UTC

For those that missed it.

2018-04-15 18:17:36 UTC

TL;DR: if you have a custom system, register your device to not get locked out of some restricted apps (like Netflix.)

2018-04-15 19:08:55 UTC

```c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <wiringPi.h>
#include <softPwm.h>

#define RI 29
#define BI 28
#define GI 27
#define RO 23
#define BO 22
#define GO 21
#define HIGHER 1
#define LOWER 0

// DEBUGGING PRINTF STATEMENTS
void debugPrint(int rValue, int bValue, int gValue, int hValue, int lValue, int i, int j, int k, int rBright, int bBright, int gBright, float total_t) {
printf("DEBUG PRINTF\n");
printf("rValue:\t%d\n", rValue);
printf("bValue:\t%d\n", bValue);
printf("gValue:\t%d\n", gValue);
printf("hValue:\t%d\n", hValue);
printf("lValue:\t%d\n", lValue);
printf("i:\t%d\n", i);
printf("j:\t%d\n", j);
printf("k:\t%d\n", k);
printf("rBright:\t%d\n", rBright);
printf("bBright:\t%d\n", bBright);
printf("gBright:\t%d\n", gBright);
printf("running time:\t%f\n", total_t);
printf("\n");
delay(1000);
}

// INITIALIZATION OF RED, GREEN, AND BLUE OUTPUT GPIO PINS
void initializeLED(void) {
softPwmCreate(RO, 0, 100);
softPwmCreate(BO, 0, 100);
softPwmCreate(GO, 0, 100);
}
```

2018-04-15 19:09:33 UTC

```c
int main(void) {

clock_t start, end; // FOR DEBUGGING

start = clock();

printf("Raspberry Pi PWM\n\n");

if (wiringPiSetup() == -1) {
return 1;
}

// SET PIN MODES
pinMode(RI, INPUT);
pinMode(BI, INPUT);
pinMode(GI, INPUT);
pinMode(HIGHER, INPUT);
pinMode(LOWER, INPUT);

// INITIALIZE GPIO VALUES
int rValue = 0;
int bValue = 0;
int gValue = 0;
int hValue = 0;
int lValue = 0;

// INITIALIZE BRIGHTNESS VALUES
int i = 100;
int j = 100;
int k = 100;

// INITIALIZE OUTPUT OUTPUT GPIO
initializeLED();

while (1) {
// READ FROM PUSHBUTTONS
rValue = digitalRead(RI);
bValue = digitalRead(BI);
gValue = digitalRead(GI);
hValue = digitalRead(HIGHER);
lValue = digitalRead(LOWER);
delay(10);
```

2018-04-15 19:09:40 UTC

```c
// CHECK IF RED BUTTON IS PRESSED
if (rValue == HIGH) {
if (hValue == HIGH) { // IS INCREASE BRIGHTNESS BUTTON PRESSED
i -= 5;
} else if (lValue == HIGH) { // IS DECREASE BRIGHTNESS BUTTON PRESSED
i += 5;
}
if (i > 100) { // IS BRIGHTNESS AT MAXIMUM OR MINIMUM
i = 100;
} else if (i < 0) {
i = 0;
}
softPwmWrite(RO, 100-i); // WRITE GPIO WITH NEW BRIGHTNESS
delay(100);
}
//CHECK IF BLUE BUTTON IS PRESSED
if (bValue == HIGH) {
if (hValue == HIGH) { // IS INCREASE BRIGHTNESS BUTTON PRESSED
j -= 5;
} else if (lValue == HIGH) { // IS DECREASE BRIGHTNESS BUTTON PRESSED
j += 5;
}
if (j > 100) { // IS BRIGHTNESS AT MAXIMUM OR MINIMUM
j = 100;
} else if (j < 0) {
j = 0;
}
softPwmWrite(BO, 100-j); // WRITE GPIO PIN WITH NEW BRIGHTNESS
delay(100);
}
// CHECK IF GREEN BUTTON IS PRESSED
if (gValue == HIGH) {
if (hValue == HIGH) { // IS INCREASE BRIGHTNESS BUTTON PRESSED
k -= 5;
} else if (lValue == HIGH) { // IS DECREASE BRIGHTNESS BUTTON PRESSED
k += 5;
}
if (k > 100) { // IS BRIGHTNESS AT MAXIMUM OR MINIMUM
k = 100;
} else if (k < 0) {
k = 0;
}
softPwmWrite(GO, 100-k); // WRITE GPIO PIN WITH NEW BRIGHTNESS
delay(100);
}
```

2018-04-15 19:10:00 UTC

```c
// EVERYTHING BELOW IS JUST EXTRA ADDED FEATURES USING BUTTON COMBINATIONS

// CHECKS FOR RESET BUTTON COMBINATION
if (rValue == HIGH) {
delay(150);
if (hValue == HIGH) {
delay(150);
if (lValue == HIGH) {
printf("BUTTON COMBINATION 1\n");
printf("RESETING LED\n\n");
i = 100;
j = 100;
k = 100;
softPwmWrite(RO, 0);
softPwmWrite(BO, 0);
softPwmWrite(GO, 0);
delay(2000);
softPwmWrite(RO, 100);
delay(250);
softPwmWrite(RO, 0);
softPwmWrite(BO, 100);
delay(250);
softPwmWrite(BO, 0);
softPwmWrite(GO, 100);
delay(250);
softPwmWrite(GO, 0);
delay(250);
}
}
```

2018-04-15 19:10:12 UTC

```c
// CHECKS FOR EXIT BUTTON COMBINATION
} else if (bValue == HIGH) {
delay(150);
if (hValue == HIGH) {
delay(150);
if (lValue == HIGH) {
printf("BUTTON COMBINATION 2\n");
printf("EXITING PROGRAM\n\n");
softPwmWrite(RO, 0);
softPwmWrite(BO, 0);
softPwmWrite(GO, 0);
delay(2000);
softPwmWrite(RO, 100);
delay(250);
softPwmWrite(RO, 0);
softPwmWrite(BO, 100);
delay(250);
softPwmWrite(BO, 0);
softPwmWrite(GO, 100);
delay(250);
softPwmWrite(GO, 0);
delay(250);
exit(0);
}
}
```

2018-04-15 19:10:56 UTC

```c
// CHECKS FOR RESET AND EXPERIMENTAL LIGHT SHOW COMBINATION
} else if (gValue == HIGH) {
delay(150);
if (hValue == HIGH) {
delay(150);
if (lValue == HIGH) {
printf("BUTTON COMBINATION 3\n");
printf("RESETING LED\n");
printf("RUNNING EXPERIMENTAL LIGHSTSHOW\n\n");
softPwmWrite(RO, 0);
softPwmWrite(BO, 0);
softPwmWrite(GO, 0);
delay(2000);
```

2018-04-15 19:11:07 UTC

```c
while (1) {
softPwmWrite(RO, 100);
delay(1000);
softPwmWrite(RO, 0);
softPwmWrite(GO, 50);
delay(1000);
softPwmWrite(RO, 75);
softPwmWrite(BO, 100);
softPwmWrite(GO, 0);
delay(1000);
softPwmWrite(GO, 100);
softPwmWrite(RO, 10);
softPwmWrite(BO, 0);
delay(1000);
delay(2000);
softPwmWrite(RO, 0);
softPwmWrite(BO, 0);
softPwmWrite(GO, 0);
hValue = digitalRead(HIGHER);
lValue = digitalRead(LOWER);
if (hValue == HIGH && lValue == HIGH) {
printf("ENDING EXPERIMENTAL LIGHTSHOW\n");
printf("RESETING LED\n\n");
softPwmWrite(RO, 0);
softPwmWrite(BO, 0);
softPwmWrite(GO, 0);
delay(3000);
break;
}
}
softPwmWrite(RO, 100);
delay(250);
softPwmWrite(RO, 0);
softPwmWrite(BO, 100);
delay(250);
softPwmWrite(BO, 0);
softPwmWrite(GO, 100);
delay(250);
softPwmWrite(GO, 0);
}
}
}
end = clock();
// uncomment the below line to debugg
// debugPrint(rValue, bValue, gValue, hValue, lValue, i, j, k, 100-i, 100-j, 100-k, end-start);
}

return 0;
}
```

2018-04-15 19:11:26 UTC

@Deleted User This is all the code for the GPIO RGB LED color mixer

2018-04-15 19:34:41 UTC

wtf

2018-04-15 19:34:49 UTC

>debugPrintf()

2018-04-15 19:34:51 UTC

mfw

2018-04-15 19:41:17 UTC

Don't judge my methods.

2018-04-15 19:41:34 UTC

๐Ÿ˜€

2018-04-16 01:23:03 UTC

`int rValue, int bValue, int gValue, int hValue, int lValue, int i, int j, int k, int rBright, int bBright, int gBright, float total_t`

2018-04-16 01:23:06 UTC

holy moly

2018-04-16 01:23:14 UTC

that is a lot of parameters

2018-04-16 01:23:42 UTC

isn't it better to just put them in scope instead of passing them as parameters

2018-04-16 01:23:56 UTC

or use pointers or something idk

2018-04-16 02:54:05 UTC

I wanted to be able to easily comment out all debugging when I don't need to do it. But I still wanted it to be there because the TA's want to see the steps we took to complete the lab.

2018-04-16 08:39:16 UTC

I'd make a `Buttons` struct to hold them all.

2018-04-16 08:39:43 UTC

I get anxious when there's a bunch of variables that can end up part of a copy-paste accident.

2018-04-16 15:58:36 UTC

https://cdn.discordapp.com/attachments/423219052849397773/435469069555335168/image.jpg

2018-04-16 15:58:39 UTC
2018-04-16 15:59:17 UTC

๐Ÿคฃ

2018-04-18 01:10:26 UTC

@Deleted User One thing I did not miss about Java was Null Pointer Exceptions, ben trying to finish an old project I started during winter break last year.

2018-04-18 01:26:27 UTC

Even better are the MethodNotFound exceptions.

2018-04-18 01:33:37 UTC

I think you mean nUlL pOiNtEr ExCeP

2018-04-18 01:33:41 UTC
2018-04-18 01:34:02 UTC

๐Ÿคฃ

2018-04-22 02:19:51 UTC

what's the best sort of loop?

2018-04-22 03:02:16 UTC

The one that violates scopes.

2018-04-22 03:02:29 UTC

Duff's Device.

2018-04-22 03:03:13 UTC

```c
void send(short *to, short *from, int count)
{
int n = (count + 7) / 8;
switch (count % 8) {
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
case 1: *to = *from++;
} while (--n > 0);
}
}
```

2018-04-22 03:06:51 UTC

Followed by the `for-ever` loop:
```c
for (;;) {
/* ... */
}```

2018-04-22 03:47:50 UTC

https://i.redd.it/ososfbmrcat01.png

Need to refurbish my old laptop to a Linux box sometime

2018-04-22 18:49:30 UTC

@Legiondude eh arch

2018-04-22 18:49:38 UTC

you must have alot of free time

2018-04-22 18:50:59 UTC

I do, but the screenshot isn't mine

2018-04-22 18:51:03 UTC

Looks nice tho

2018-04-22 18:52:26 UTC

oh nvm then

2018-04-22 18:55:50 UTC

That's the desktop environment not arch that makes it look nice

2018-04-22 18:56:22 UTC

You could intall that DE on any Linux distro

17,577 total messages. Viewing 100 per page.
Prev | Page 18/176 | Next