[ / / / / / / / / / / / / / ] [ dir / random / ebon / erp / fol / hnt / leo / mu / rickroll / sw ]

/g/ - Technology

Make /g/ Great Again
Name
Email
Subject
REC
STOP
Comment *
File
Password (Randomized for file and post deletion; you may also set your own.)
Archive
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
dicesidesmodifier

Allowed file types:jpg, jpeg, gif, png, webp, webm, mp4, mov, swf, pdf
Max filesize is 16 MB.
Max image dimensions are 15000 x 15000.
You may upload 5 per post.


File: db75a7fe968db4c⋯.jpg (262.76 KB, 1118x1600, 559:800, db75a7fe968db4c0505bb28ca3….jpg)

 No.7227

Banned from 4chan edition.

What are you working on /g/?

I just finished adventofcode 2017.

Now going through the suffering of building python.

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7485

>>7227

hi fellow 4friend

also why the fuck would you even build python of all things

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7496

>>7227

I want to try building Python. Do you compile it like other stuff?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7539

Reminder that Lisp can't even make a text editor https://archive.fo/mnbNo

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7544

>>7539

Reminder that "Able to" isn't the right question. "Want to" is. A notepadish text editor is terrifically boring as an application, and nobody's going to spend that effort pleasing some autist on a polynesian underwater basket weaving forum.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7548

>>7496

Now you gotta define how to deal with an AST using a lexer or parser, but yacc for example does compile down in some sense. Problem is Python runs as Bytecode so you cant really interpret it

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7549

>>7544

>copypasting the same autistic admittance of defeat

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7551

File: 141216d9072e3ae⋯.jpg (2.71 MB, 3632x5456, 227:341, 1525241911872.jpg)

Hello guys. I'm trying to solve a weird glitch I'm having in my C code. I have these two simple structures, and a function to create the atlas structure:


typedef struct {
int loaded;
SDL_Rect clip;
int x_off, y_off;
int advance;
} GlyphData;

typedef struct {
FT_Face font;
SDL_Rect next_slot;
unsigned line_height;
SDL_Surface *gmap;
SDL_Texture *gmap_tex;
GlyphData glyphs[256];
} GlyphAtlas;

GlyphAtlas *create_gatlas(FT_Face ft)
{
GlyphAtlas *ga = malloc(sizeof(GlyphAtlas));
ga->font = ft;
ga->next_slot.x = 0;
ga->next_slot.y = 0;
ga->gmap = SDL_CreateRGBSurface(0, ATLAS_DIM, ATLAS_DIM, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF);
ga->gmap_tex = NULL;
unsigned gi = 0;
while (gi < 256)
ga->glyphs[gi++].loaded = 0;
}

For some reason, that loop inside the function which is meant to set all glyphs to unloaded, makes my font member unusable (it probably is overriding it, since it works if I set the font member after the loop), but I don't get why or how, since the range is within the array size; in fact, even if I manually do something like ga->glyphs[1].loaded = 0, the same problem occurs. What am I doing wrong here? Do I have to do some funky malloc stuff because of the 'glyphs' array, or is it something else?

Thank you in advance, have some 3dpd for your time.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7557

>>7551

I looked carefully at this code and it doesn't seem that there is anything wrong with it.

You believe that font gets corrupted? Why don't you put printf("%p\n", ga->font); before and the whole loop (right after setting it) and after the while loop. If it changed then corruption happened but I think the error will be something else.

And .. rest of set? goggles did nothing

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7559

>>7557

I wasn't return 'ga' and my code was working anyway, so it was just one of those things which were clearly wrong and should've clearly crashed from the start and didn't.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7560

>>7559

ah maybe add compiler flag -Wall

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.7607

still working on fizzbuzz since a year

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.8029

>>7551

You can try: 1) using memset instead of initializing to 0 separately. 2) compiling with g++ -fsanitize=address and running the binary to see if/where you have an out-of-bounds.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.8399

>>7496

Try to compile Lua first. You might need ```readline-dev``` or similar package installed. (```<editline/>``` will need modifying a file or two)

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.8407

File: b55a7efefd10d3c⋯.png (86.56 KB, 640x1508, 160:377, ClipboardImage.png)

battleships

everything else is in place, i just need to make the AI now

this is for >>3529 it should be done within a few days

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.8417

>>7227 What is the title of the comic book? Is she learning a programming language?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.8467

>>8417

i think shes reading sicp

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.9034

anybody familiar with NAudio? Why the fuck is playing a midi file so complicated?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.9848

I wrote a program that will trace the ip of the most baddass hacker in the universe:


#include <iostream>
#include <regex>
#include <netdb.h>
#include <unistd.h>

int connect_socket();
void make_request(int socket_file);

int main(int argc, char *argv[]) {
if(argc != 1) {
std::cout << "\nUsage: " << argv[0] << "\n";
return -1;
}
int sfd = connect_socket();
if(sfd <= 0) {
perror("Couldn't connect: ");
return -1;
}
make_request(sfd);
return 0;
}

int connect_socket() {
struct addrinfo *addr, hints;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ALL;
int check = getaddrinfo("checkip.dyndns.com", "80", &hints, &addr);
if(check) {
fprintf(stderr, "Couldn't get address; %s\n", gai_strerror(check));
return -1;
}
int sfd = socket(addr->ai_family,
addr->ai_socktype,
addr->ai_protocol);
if(connect(sfd, addr->ai_addr, addr->ai_addrlen)) {
perror("Couldn't connect socket; ");
return -1;
}
return sfd;
}

void make_request(int sfd) {
write(sfd, "\n\0", 2);
char buffer[512];
read(sfd, buffer, sizeof(buffer));
std::string buf(buffer);
std::smatch match;
std::regex expr("\\d+\\.\\d+\\.\\d+\\.\\d+");
std::regex_search(buf, match, expr);
for(auto ip: match) std::cout << ip << std::endl;
}

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.9857

File: 60907995750f5de⋯.jpg (254.84 KB, 900x1200, 3:4, Statist Enforcer Patrol.jpg)

>dpt

>10 months old

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.9858

>>9857

>enter dead board

>surprised when threads are old

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

 No.10169

>>7549

If Lisp is turing complete and can use the API of the operating system, then it can be used to make a text editor.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



[Return][Go to top][Catalog][Nerve Center][Random][Post a Reply]
Delete Post [ ]
[]
[ / / / / / / / / / / / / / ] [ dir / random / ebon / erp / fol / hnt / leo / mu / rickroll / sw ]