Leave these fields empty (spam trap):
Name
You can leave this blank to post anonymously, or you can create a Tripcode by using the format Name#Password
Subject
Comment
[i]Italic Text[/i]
[b]Bold Text[/b]
[spoiler]Spoiler Text[/spoiler]
>Highlight/Quote Text
[pre]Preformatted & Monospace Text[/pre]
[super]Superset Text[/super]
[sub]Subset Text[/sub]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists
File

Sandwich


420chan is Getting Overhauled - Changelog/Bug Report/Request Thread (Updated July 26)

Crypto Currency Technical Discussion Channel

View Thread Reply
- Wed, 10 Jan 2018 22:16:05 EST agmSr6q5 No.37263
File: 1515640565870.jpg -(154202B / 150.59KB, 1096x750) Thumbnail displayed, click image for full size. Crypto Currency Technical Discussion Channel
Thought this might interest the board! They discuss the technical merits and trading strategies a lot of different coins including ETH, BTC, and BCH. They also discuss programming methods, APIs, and workarounds for various echanges.

https://discord.gg/KNzz9Wk

HOLY SHIT I'M ABOUT TO KILL MYSELF (SEGFAULT AT INDEX 0)

View Thread Reply
- Thu, 04 Jan 2018 10:17:51 EST kvqggUwM No.37252
File: 1515079071468.png -(47908B / 46.79KB, 625x429) Thumbnail displayed, click image for full size. HOLY SHIT I'M ABOUT TO KILL MYSELF (SEGFAULT AT INDEX 0)
Has anyone ever had a segfault while accessing an array A at A[0][0]?
So, this is making me go insane. I have a good understanding of C, but I stopped doing anything with it after completing my exam about it (which was about simple client/server applications and implementing a petite GNU find).

Now I have to use it again for a BLOODY SIMPLE SHIT, WHICH IS GENERATING A FUCKING MATRIX. I've been banging my head on the wall for the past hour and nothing seemed to help.

My code segfaults at index (0,0) of the matrix. I isolated the problem by reducing it to a simple function that should print the contents of the matrix, which you can see in the image but I'm going to paste it here anyway:
[Note: not event matrix[0][0] is printed.]

#define RADIUS 7
int ** mask;

void printMatrix(int ** matrix, int size) {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
//segfaults at i = 0, j = 0.
printf("%d",matrix[j]);
}
printf("\n");
}
}

int main(int argc, char ** args) {
printf("%d\n", RADIUS * RADIUS);
mask = (int **) calloc(RADIUS * RADIUS, sizeof(int));
//int mask[RADIUS][RADIUS] doesn't work either
printMatrix(mask,RADIUS);
exit(0);
}
>>
Ian Bingerspear - Thu, 04 Jan 2018 15:09:48 EST 5/K3jMSW No.37253 Reply
Obviously the matrix isn't what you think it is. Debugging with print statements like that doesn't help you much. Print more interesting information about matrix or better yet learn to use a debugger.
>>
Ernest Pimmledale - Thu, 04 Jan 2018 20:44:52 EST 4Jf4geC2 No.37254 Reply
Okay so I ran your code through a debugger and figured out what happened. Also as one minor thing I think you forgot your #include's for printf and calloc (which I believe are <stdio.h> and <stdlib.h> respectively).

So you're using calloc() which allocates you cleaned memory that is set to all zeros. The NULL pointer is also represented by all zeroes. You should consider how the constructs you are invoking actually work here. What you're allocating with calloc() is a block of memory (in this case, a block of memory of size "RADIUS * RADIUS * sizeof(int)" ) and setting that memory to all zeroes. Then your code, outside of calloc, is creating an int** and pointing it to that newly formed block of zeroed memory.

If you were to access this block of memory as a regular int* array, like this:
int* memory = calloc(RADIUS * RADIUS, sizeof(int) );
for (int x = 0; x < RADIUS * RADIUS; x++) printf("%d,", memory[x]);
Then that would print out RADIUS * RADIUS zeroes, since all of the ints in your block of memory are zero.

Now what you did instead was you made a pointer-array pointing to that block of all zeroed memory. We can indeed print out the pointer values of each element in your array like this:
mask = (int**)calloc(RADIUS * RADIUS, sizeof(int) );
for (int x = 0; x < RADIUS; ++x)
{
int* thisPointer = mask[x];
printf("%p,", thisPointer);
}

The code will now print RADIUS NULL pointers in a row. The reason that all of the pointers in this array are NULL is because in almost all C or C++ compiler implementations, the NULL pointer is equivalent to a pointer to address zero (which is then mapped in most CPU hardware to cause an access violation exception, which stops your program with a crash). What your original crashing code was doing was trying to dereference the NULL pointers in the array of pointers that you made.

Now you can fix your crashing code in several different ways. I'll show you two of them here:

// Fix solution #1
// Allocate arrays of arrays
/* The only change is to how you allocate the arrays in main(), so I won't bother rewriting your printMatrix() function here */
nt main(int argc, char** args)
{
printf("%d\n", RADIUS * RADIUS);
// mask = (int**) calloc(RADIUS * RADIUS, sizeof(int) );
mask = (int**)calloc(RADIUS, sizeof(int*) );
for (int x = 0; x < RADIUS; x++)
Comment too long. Click here to view the full text.

Game Engines with open source-code

View Thread Reply
- Thu, 30 Nov 2017 17:54:29 EST xESEUkvI No.37244
File: 1512082469156.png -(399990B / 390.62KB, 2000x1037) Thumbnail displayed, click image for full size. Game Engines with open source-code
What are the best 3ngines to work with?
>>
Molly Fasslewane - Thu, 30 Nov 2017 19:18:04 EST v79vrqu4 No.37245 Reply
You mean FOSS or just a copy of the source with a license to use it?
>>
Henry Beblingbutch - Sat, 02 Dec 2017 02:30:33 EST BW3MomrQ No.37246 Reply
The ideal game engine is dependent upon what project you have in mind. There is no such thing as a "best" game engine.
>>
Nell Nagglefot - Sat, 02 Dec 2017 15:18:11 EST 9QSfnS0r No.37247 Reply
Best as in most feature complete (level editor, asset management, rendering & events, virtual reality) and fully FOSS is Blender.

They don't want to solve this simple math

View Thread Reply
- Thu, 16 Nov 2017 15:34:35 EST /Irek0az No.37234
File: 1510864475496.jpg -(63851B / 62.35KB, 1200x599) Thumbnail displayed, click image for full size. They don't want to solve this simple math
Find out before it is taken down from the web: https://youtu.be/7GbsO-CFNMo

TDD

View Thread Reply
- Thu, 31 Aug 2017 10:33:41 EST 9cestl8h No.37169
File: 1504190021194.jpg -(324209B / 316.61KB, 503x376) Thumbnail displayed, click image for full size. TDD
Hey how often is test driven actually used in the real world.

Arrange - act - assert...
3 posts omitted. Click View Thread to read.
>>
Jack Chobblebot - Tue, 12 Sep 2017 10:50:53 EST MEaLO7ku No.37190 Reply
1505227853286.jpg -(89762B / 87.66KB, 493x396) Thumbnail displayed, click image for full size.
>>37189
> Well sort of, this stuff is usually done for code that's intended to be shared on your github curriculum

The pretty well sums up the quality of my code. "Will anyone else else ever look at this code? If yes then pretty code, if no then garbage."
>>
Frederick Drovingcocke - Fri, 17 Nov 2017 22:51:43 EST uWLieSb9 No.37235 Reply
tdd?

everyone wants to do it and you'll get points in an interview for familiarity with it, but I've never actually seen someone really do it. it's like agile, lot of people want to do it, they just have no idea how to actually make it really happen.

Security, FTP and MITM attacks

View Thread Reply
- Wed, 11 Oct 2017 16:15:57 EST fDdwArgq No.37213
File: 1507752957499.jpg -(83736B / 81.77KB, 883x431) Thumbnail displayed, click image for full size. Security, FTP and MITM attacks
I'm not going to perform any attacks whatsoever, I'm more interested about securing my server and learning more about possible attack scenarios. So pardon my stupid questions.

I'm not going to explain every detail why my current system uses technology x or protocol y, because I'm writing this on my phone and I don't want to write too much with this, so please, let's just assume!

My server acts as a FTP server. FTP credentials are transfered in plaintext, what are the possible ways to steal my precious FTP login credentials? I would assume that a MITM attack would be one of them? Does the attacker need an access to my server's router or to the router I'm logging in from? If I disable WiFi, what kind of attack vectors still exists?

Please do explain! Thanks for in advance!
2 posts omitted. Click View Thread to read.
>>
Caroline Blackgold - Thu, 12 Oct 2017 00:36:17 EST 4Jf4geC2 No.37217 Reply
There's also the gamut of typical attack vectors that might affect any computer system, such as somebody remotely compromising your router or hacking your operating system, or you accidentally getting some malware onto the same machine that you're using for FTP hosting.
>>
Albert Saddlelock - Thu, 12 Oct 2017 16:07:56 EST fDdwArgq No.37218 Reply
>>37214
Interesting, didn't know about that at all...
>>
Cedric Brookridge - Sat, 11 Nov 2017 22:19:13 EST XBm2HhG+ No.37232 Reply
>>37213
>FTP credentials are transfered in plaintext, what are the possible ways to steal my precious FTP login credentials?

  1. As you mentioned, an MITM attack
  2. Any attack that can actively listen in on your connection (including a spliced cable)
  3. Direct password attack(bruteforce or dictionary)
  4. hacking other weak points on your server (like VNC,RDP,SSH and so forth)

>Does the attacker need an access to my server's router or to the router I'm logging in from?

not nescessarily, as long as the proper ports are opened or forwarded. As long as a given TCP/UDP port is opened to the net, it can be exploited.

> If I disable WiFi, what kind of attack vectors still exists?
All of them, except those that apply specifically for wifi...


C++: TRY-CATCHING for Bounds

View Thread Reply
- Thu, 03 Aug 2017 20:40:54 EST HsZblEoz No.37132
File: 1501807254829.png -(32495B / 31.73KB, 500x386) Thumbnail displayed, click image for full size. C++: TRY-CATCHING for Bounds
Hay PROG!
With C++, I'm doing a lot of computation with arrays/vectors and always running into bounds/BAD_ACCESS errors. I'm here to ask if using try-catch blocks to handle these guaranteed thrown exceptions is a good idea.

You can find my code snippet at https://pastebin.com/uWM3MXxs
9 posts omitted. Click View Thread to read.
>>
Jack Heshfield - Tue, 08 Aug 2017 18:32:03 EST akqfogJa No.37144 Reply
>>37143
That's not how exceptions are always handled. It's a different story for every implementation, but in general the catch can stand around looking dumb for a long time.
>>
Charles Gallylat - Thu, 24 Aug 2017 17:54:54 EST 9QSfnS0r No.37166 Reply
>>37143
That may be true, but I doubt that modern compilers won't optimize exceptions you handle yourself to the point where there's practically no difference because 99% of the time you already know exactly which exceptions you want to catch in which order at compile time.
>>
Fanny Wondleson - Sat, 07 Oct 2017 16:29:47 EST JfbkjUm/ No.37211 Reply
>>37143
Yep.
But if you know that the exception will happen infrequently, and you have a lot of if's, then it's possible that all branch mispredictions you might get add up to an even greater penalty. As you say, unless it's performance critical it's not worth thinking about.
And if it is performance critical, the only way you'll know is by measuring.

School Project

View Thread Reply
- Sat, 30 Sep 2017 20:59:23 EST 33yd9LRh No.37201
File: 1506819563741.jpg -(16329B / 15.95KB, 290x290) Thumbnail displayed, click image for full size. School Project
Soo.. I'm soon going to start working on my school project and I've decided to make DIY electric drums. I'll use piezo senzors. The problem I'm having is how should I connect 4-6 drum pads to my computer and what program to use... I'd be very glad if u could help me out with this one progs ;)
>>
Eliza Lightdock - Sun, 01 Oct 2017 04:32:59 EST P6PS9CBz No.37202 Reply
Grab some simple piezo sensors and wire 'em up to your Arduino, then wire your Arduino up to your computer. All the common Arduino boards have 6 analog inputs. Write a simple program that reads analog values from these analog inputs and detects beats, then simply send the beats (also probably with their beat amplitudes) from the Arduino to your computer and have the computer do whatever you want with the info.

C++ delete not working on (I believe) allocated pointer

View Thread Reply
- Wed, 27 Sep 2017 21:44:16 EST 5sC0bueS No.37196
File: 1506563056371.jpg -(111717B / 109.10KB, 1920x1080) Thumbnail displayed, click image for full size. C++ delete not working on (I believe) allocated pointer
Sup my people, I come here, humbly, once again to seek your guidance of C++.

I'm trying to implement my own linked list in a search algorithm and am running in to memory leaks. I define a node struct, create a 4 element array of pointers (because of the search algorithm), use new to fill those pointers, add those pointers to a linked list, and then create 4 new elements using the same array of pointers. HOWEVER, when I go to iterate through the list later to delete everything, I get an error saying:

malloc: *** error for object 0x7fff5fbfe4f0: pointer being freed was not allocated

I don't understand why I saying it was never allocated? Here is some of the code highlights and I'll also paste a link to the full code on pastebin:

//USING NEW TO (ALLOCATE?) NEW MEMORY (THIS IS IN A LOOP)
list_node* neighbors[4]; //The FOUR neighbors
neighbors[0] = new list_node;
*neighbors[0] = {nullptr, nullptr, q, (q->x)-1 , q->y , 9999, 9999, 9999};
neighbors[1] = new list_node;
*neighbors[1] = {nullptr, nullptr, q, (q->x)+1 , q->y , 9999, 9999, 9999};
neighbors[2] = new list_node;
*neighbors[2] = {nullptr, nullptr, q, q->x , (q->y)-1 , 9999, 9999, 9999};
neighbors[3] = new list_node;
*neighbors[3] = {nullptr, nullptr, q, q->x , (q->y)+1 , 9999, 9999, 9999};

//DEBUGGING
//Print out the closed and open_sets
//...the closed set
bool printing = true;
list_node* current2 = copen_set.first;
printf("\nCLOSE ");
while(printing){
if(current2==nullptr){
printing = false;
break;
}
Comment too long. Click here to view the full text.
1 posts omitted. Click View Thread to read.
>>
Matilda Bandlechutch - Thu, 28 Sep 2017 19:36:34 EST 5sC0bueS No.37198 Reply
1506641794371.png -(807B / 807bytes, 48x48) Thumbnail displayed, click image for full size.
>>37197
Holy shit, that worked! Thank you so much.

I forgot to initialize the very first node with new and delete somehow knew. Does that function check the address and it's able to tell what's on the heap or something?
>>
Thomas Brindleworth - Thu, 28 Sep 2017 23:13:20 EST gezKXAce No.37199 Reply
>>37198
I believe calling delete on something not created with new is undefined, so it depends on your compiler.
>>
George Senningstone - Fri, 29 Sep 2017 13:08:19 EST P6PS9CBz No.37200 Reply
>>37198
At least on Windows with the debug CRT there's a mechanism built in to detect you calling delete or free on a pointer that did not come from the current process heap. You can easily do this in constant-time by simply checking the address against the lower and upper address bounds of your heap region.

a phone os

View Thread Reply
- Thu, 10 Aug 2017 09:59:00 EST CZA5DFLp No.37145
File: 1502373540803.jpg -(80244B / 78.36KB, 1000x661) Thumbnail displayed, click image for full size. a phone os
How realistic would it be to create a very basic os for an arm phone?

I'd be content if I could just boot, and maybe send a blank sms by pressing the home button or something. Has anyone ever done something like this? Do you know of any good resources to get started?
I had a basic computer architecture class, so I know how to program simple startup code and taskmanagers for x64/x86 and some microprocessors, so learning arm assembly wont be a problem. Having access to I/O, and eventually the gsm functions will probably be the difficult part.

I never really wanted a smartphone, but now I got a 2015 samsung galaxy a3 because it was only 25 euro. The battery life is really shitty (40 hours at best), so an ultra efficient os would be really cool.
7 posts omitted. Click View Thread to read.
>>
Jarvis Sodgemon - Sun, 10 Sep 2017 00:33:33 EST xLKzmVTo No.37188 Reply
>>37187
> but with some things you feel that it should have been replaced a long time ago when you use it.

Agreed. AT commands are a pain in the ass.
>>
Ian Brookfield - Mon, 18 Sep 2017 16:27:34 EST 4MJeso9G No.37192 Reply
>>37145
You should try flash it to lineage
many report huge battery time increases with all the bloat removed

Help me as I ask questions

View Thread Reply
- Wed, 23 Aug 2017 18:12:33 EST FzfAQ7sK No.37162
File: 1503526353355.gif -(2193920B / 2.09MB, 125x125) Thumbnail displayed, click image for full size. Help me as I ask questions
>1. Goal = define a function that takes input and then returns it in reverse
>2. result https://pastebin.com/BqUXJMxP
>3. Question = I somehow got it to work, but I dont even know how. I intended for this to just print the last part of an input, but it actually did it and I dont understand how


for i in text:
new_string = i+new_string


someone explain the code logic for why this returns the input in reverse for me, thanks
1 posts and 1 images omitted. Click View Thread to read.
>>
Charles Gallylat - Thu, 24 Aug 2017 12:05:26 EST 9QSfnS0r No.37165 Reply
  • it start with an empty string:
  • it starts a loop over each character starting with one
  • takes a concatenation of character of the loop and the variable and stores it into the variable
    • it does that till there is no characters left

in python you'd actually can do:
"abcd"[::-1]
and get:
'dcba'
>>
Basil Duckspear - Fri, 08 Sep 2017 14:58:56 EST 2mg3P58s No.37183 Reply
Inside of the reverse function your code creates an empty string and then for each character in the string provided as argument you are *prepending* the current character to the string that is defined in the function.

Say that you have the string "hello world", here's what happens:

you enter the reverse function and create an empty string ''

you take the first character of "hello world"; 'h' and put it in front of the empty string and then assign that to the variable that held the empty string. Now that variable holds "h".

Next iteration of the for-loop it takes the next character of the argument string, so 'e', and it puts that in front of what it has and it becomes "eh"

It then continues in this fashion until all of the characters of the argument string have been consumed.

"leh"

"lleh"

"olleh"

" olleh"

"w olleh"

"ow olleh"

"row olleh"

"lrow olleh"

"dlrow olleh"

Finally it returns the result

Data Structures

View Thread Reply
- Sun, 03 Sep 2017 19:28:25 EST rvUFtpA8 No.37175
File: 1504481305294.gif -(530982B / 518.54KB, 360x362) Thumbnail displayed, click image for full size. Data Structures
hey /prog/,

I'm looking for a good book or resource to help myself learn about data structures.
I'm in a college course next semester and for some reason they don't have a text for the class.
3 posts omitted. Click View Thread to read.
>>
Hannah Neshdale - Wed, 06 Sep 2017 01:37:32 EST BBXKtFPn No.37180 Reply
>>37179
You're not allowed to post here anymore. Please go away.
>>
Priscilla Trotwill - Wed, 06 Sep 2017 22:16:55 EST rvUFtpA8 No.37181 Reply
>>37178

Notes are bad, not allowed to use a computer to take notes during lectures.

>>37177

I know a little bit about Data Structures, I passed the introduction course with a C. I got mono during the first section, and after that the teacher pretty much hated me since I needed help catching up.

>>37176
I've seen that one already, was just wondering if anyone had other advice.

A friend of mine recommended a book called Cracking The Coding Interview
>>
Graham Clommlelad - Thu, 07 Sep 2017 13:04:24 EST jt2fMkCV No.37182 Reply
1504803864531.jpg -(70341B / 68.69KB, 620x372) Thumbnail displayed, click image for full size.
Could you post a list of data structures that you need to know and maybe we can find resources for you or help explain things?

Also, what language are you using in the course?

I would go to a VBS forum, but...

View Thread Reply
- Sat, 11 Feb 2017 07:27:55 EST 1joa5uVv No.36502
File: 1486816075377.png -(11163B / 10.90KB, 359x171) Thumbnail displayed, click image for full size. I would go to a VBS forum, but...
I want to make a better GUI for this script. The script is supposed to accept an input string and a number -> wait -> type that string and simulate enter key in loop.
Like a basic emergecny beacon of sorts

set shell = createobject("wscript.shell")

strtext = inputbox("Message :")
strtimes = inputbox("Number of times to spam")

if not isnumeric(strtimes) then
wscript.quit
end if
msgbox "You have 5 minutes to end wscript.exe"
wscript.sleep(300000)
for i=1 to strtimes
shell.sendkeys(strtext & "{enter}")
wscript.sleep(1000)
next


But can I rather leave a msgbox open with a button to cancel it? -> 5 mins is up -> one of two things (whichever is easier for yall)
1) msgbox dissapears and the loop begins spamming message. this requires quickly ending wscript.exe
2) gui remains (msgbox with quit button), maybe even has a countdown, and allows clicking to quit the script, and the spamming happens after the timer just normal.

Option 2, harder, but does it require fancy threading?
3 posts omitted. Click View Thread to read.
>>
Edward Himmermock - Wed, 08 Mar 2017 05:14:37 EST YL0YFsWq No.36605 Reply
>>36603
BrU strikes again

Report Post
Reason
Note
Please be descriptive with report notes,
this helps staff resolve issues quicker.