When I try to use this function I made I get the error .addEventListener
I think .addEventListener isn’t being found as a function because it is not finding the class in my html. but I added document.addEventListener(“DOMContentLoaded”, function(event) {
}); after it so the function with the addEventListener should only work after all the html is loaded. It still doesn’t work and I’m not exactly sure why. Does anyone know how I can solve this or if there is a better way to do this?
here is my javascript I will appreciate any help.
function newQuote(){ let httpRequest; let reset = document.getElementsByClassName('reset'); reset.addEventListener('click', makeRequest);
function makeRequest(){ httpRequest = new XMLHttpRequest();
if(!httpRequest){ alert('giving up, can not create http instance'); return false; }
function randomQuote(){ if(httpRequest.readyState === XMLHtttpRequest.DONE){ if(httpRequest.status === 200){ alert(http.responseText) } else { alert('there was a problem with the request'); } } }
getElementsByClassName return a nodelist object (multiple elements), so either you loop through it or choose one element like this reset[0].addEventListener('click', makeRequest);
I currently have a for loop with the var i increasing over the length of the array of objects. Console.logging it returns the entire array of objects, but I just want a random single value. I have got the for loop to return objects in random order, but how do I return just a single value from this? I will appreciate any help or if anyone can lead me to a similar problem on stack overflow that is answered. here is my relevant code :
function randomQuote(){ if(httpRequest.readyState === XMLHttpRequest.DONE){ if(httpRequest.status === 200){ var data = JSON.parse(this.response); var randomresponse = data.map(quote => quote.quote); console.log(randomresponse); } else { alert('there was a problem with the request'); } } } makeRequest(); randomQuote(); }
>>41234 I fixed it. Here is what I wanted and it works
if(httpRequest.readyState === XMLHttpRequest.DONE){ if(httpRequest.status === 200){ var data = JSON.parse(this.response); var randomresponse = data[Math.floor(Math.random() * data.length) ] console.log(randomresponse.quote); } else { alert(‘there was a problem with the request’); } } }
I am trying to pass my array 'url' through my XMLHttprequest GET, and I'm using .forEach to do it, I want to GET the json object of each of the strings in my url array. I had to define my httpRequest outside of my makeRequest function because the console was saying httpRequest is not defined, but now my GET request isn't working, I'm just getting 'test' from makeRequest. Been trying to solve this over 10 hours now and still nothing, will greatly appreciate any help with this.
>>41488 >The problem withs programming is… Once you've learned the basic syntax of a language (which should take a month or two tops) there is nothing more you can really do. that is simply false >The problem withs carpentry is… Once you've learned how to cut wood (which should take a month or two tops) there is nothing more you can really do. programming isn't just a syntax, it's the theoretical knowledge that you use to structure those basic parts into a more complex project >Programming is basically the latest form of industrialization. true, but the amazing part is that it's still possible to do it in an "artisanal" way >computer science theory (based on electrical engineering circuitry) computer science is based on math, and it's completely different from electrical engineering >it's just a tool true. it's just a very complex tool. again, programming is not about programming languages, it's the technique of deconstructing a complex problem into smaller sub-problems that can be solved with the language / api / tool >bullshit sociology kys
i'm not the guy who you reply to. there is not so much to study in programming on its own. yes, writing safer (from memory point of view), understandable and supportable and blah blah. but what is fun in this? anyway, if you have no idea what to do, learning programming will not give you that. you need to look somewhere else. you can learn computer science, but it is not programming.
i'm not saying you should not learn. if you do not know what to do, you need to start somewhere.
but i recall when i got my first book. i thought: now i will learn the language and will be able do anything there is possible to do. but i did not know what to do in end.
>>41499 Programming is a pretty broad term, it can mean, coding (expressing arbitrary commands through syntax), software engineering (the practical art of building software) and of course, computer science (a mathematical discipline).
Programming is a tool, like a pen. You can learn how to write pretty quickly, a couple coherent sentences, draw some stick figures, but that's miles away from doing something like drawing the Mona Lisa or writing a good novel.
Yes, you can learn "coding" in a few months. But can you do anything useful with that skill unless you also understand several other disciplines? Can you build a compiler? A web server? A ray tracer? "Coding" in itself is pretty useless unless it's used in combination with other things to solve practical problems.
Didn't realize there was a new thread, so I'll repost here.
I just started learning ncurses using http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/index.html. I am not sure how this compares to other resources since this is just the first one I clicked on, but it is easy to understand and has been informative at least in the getting started phase.
I have a few ideas about what I want to do with it, but I want to understand the library better before I get into any specific project.
I'm taking an introduction to Programming class and the required book is Programming for Dummies. SO I GOT a couple….. of quest-ions for you, oh great and magnificent masters… >1. What should I expect, and not expect? >2. How can I impress my instructor? >3. Are there any tools and soft/freeware you would recommend, or do I actually have to read the info in the links graciously provided and install Gentoo and switch to Linux….?
>>41549 >SO I GOT a couple….. of quest-ions for you, oh great and magnificent masters… Why did you format that so strangely? Your ellipses even include U+2026. >1 In terms of the general experience, it's hard to say without knowing your background, the instructor, or the target audience for the course. Some people struggle with basic programming/CS concepts, making it difficult. Some instructors are bad. Some courses are "bootcamps", while others assume you're an idiot and move at a snail's pace. If you're in an undergraduate university, then I'd assume it's the latter, though. In terms of content, read the syllabus and the table of contents in the book. >2 Why do you want to? If you're looking for a reference for a letter of rec, then just use the same "good student" principles as in any course. >3 What does the instructor recommend? What programming language will you be using? If it's Linux or no recommendation, then I would suggest Ubuntu 16 because it's accessible to noobs and has a huge amount of stackexchange questions/answers. You can use a VM, but I'd recommend a dual boot. If the projects involve small stuff in C or C++, then I'd use Vim. I'd be surprised if you were using C, though. Same goes for Python; for small stuff, Vim is fine. If you really want an IDE, then ipython/jupyter is nice due to its cell execution. I've also used Pycharm with its vim plugin, and that was fine. For Java I usually use IntelliJ with the vim emulator plugin (same company that makes PyCharm). Vim and jupyter are open source, Pycharm and IntelliJ have free versions. >do I actually have to read Yes. Read everything related to what you are doing. If you are copying code for tutorials, read that and type it in manually. If you are using a function, properly read the documentation for that function. While you are getting started with Linux, type "man <program name>" before using a program that you are not familiar with.
>>41550 It's a relatively large university that buys into most of the new, popular stuff that comes along… I think the latest popular meme degree is Organizational Leadership. Before that it was all Information Systems I think. Whatever. I think it'll be nice. The class doesn't count towards the CS degree, but I think it might count towards quantitative reasoning basics; so I don't think too many take the class and it might be a little more focused on each student a little more. >Why do you want to? Getting in good with professors can save your bacon a great deal if you find yourself in a pickle. Plus, impressing the instructor is another way of saying, "I want to do better than my best." >What does the instructor recommend? >>This course covers a study of the algorithmic approach in the analysis of problems and their computational solutions, we will use VBA (Visual Basic for Application) for that. >>1. Interpret information presented in mathematical and/or statistical forms. 2. Illustrate and communicate mathematical and/or statistical information symbolically, visually and/or numerically. 3. Determine when computations are needed and execute the appropriate computations. 4. Apply an appropriate model to the problem to be solved. 5. Make inferences, evaluate assumptions, and assess limitations in estimation modeling and/or statistical analysis.
>>41551 >the class doesn't count towards the CS degree In that case, it will probably be slow-paced. I guess the best indicator for how well you might do is your competence in math classes. If those are no problem for you, then the course might feel too slow. >VBA You will need to use Windows, then. I would recommend trying Linux on your own, though. Especially if you are in a CS/CS-related degree program.
I don't think there's much you can do to impress the instructor that is different from other classes. In the past I have done a couple of things in projects that went "above and beyond" the scope of the course because I was interested in the content, but there was never a reaction from the professors. Sit in or near the front if you can, ask questions and use office hours if you need to, be clearly attentive during class, show up a few minutes early and stay until the end. That sort of thing.
>>41554 I think a dual boot is better, but if you're not sure about committing the hard drive space to it yet, then a VM might be better. There's a linux thread in the catalog right now; it doesn't have much substance for beginners, but you could ask questions there if you need help.
>>41612 I just got out of my Intro to Programming class. And what I'm very VERY interested in now is knowing whether or not this is the place I should come to when I have questions about my class and other things of interest that come up along the way. And is /g/ and /v/-/agdg/ any good for general, basic programming questions?
4chan is terrible if you actually want to learn anything. You may learn something there on accident, though.
I remember my intro to programming class was a complete cakewalk. It was so damn easy I don't even remember what I learned. Basic shit like difference between iteration and recursion, control structures, and OOP principles.
>>41634 >/g/ is much more about consumerism and autism It isn't even good at that. Most don't stay up-to-date on tech and rather then autistically look things up and argue with data and details they mostly just use obsolete generalizations and stale memes.
>>41635 Well, it's worth adding that there's /vm/, /ideaguy/, and an actual /agdg/ board for people who want to get very specific. It's worth noting the potential for actually starting up a team that you can not only learn from, but teach at the same time - and a lot to do with coding and programming with design and brainstorming. It's a huge shitstorm of disorganized blithering and attention whoring, yeah. But, I see it as trying to start a clan, or a Barbarian Assault team. No one ever really wants to take the initiative and carry the responsibility of helping lead a team of random guys to actually create something that might be a wate of time, nothing, illegal, whatever. And all, but what ifthis would just happen's aside.
I am learning algorithms currently and I'm wondering if its a good idea to try to solve the problem and then look at the solution if I can't solve it, or just look at the solution and see all the parts to understand how it works?
Made an overwatch aimbot, which was a lot easier than I thought (made it in about 2 hours). In the video I am barely touching the mouse at all and was intentionally trying to miss when shooting the bots. It uses the healthbar to detect where the head is, which is why tracking is lost when the healthbar disappears or goes outside of the green rectangle.
Babby's first aimbot isn't worth sharing. Overwatch detects cheats like this and makes the screen black so it no longer works. They also make the health bars darker but that is easy to bypass.
I figure the screenblock could easily be bypassed by reading directly from the framebuffer using directX, but I don't know shit about directX programming and I don't really feel like learning.
Workaround for now is to just mirror the screen using OBS's game capture, which is unaffected by the screen lock. I assume OBS is using the directx method I mentioned.
For the love of my life I cannot understand linked lists. No matter how much shit I read, videos I watch, and examples I look at it's just abstract nonsense to me. How useful/important are these things?
>>42253 Do you understand pointers? It's a pretty simple data structure, and while it's not used because of performance issues, it's important in the bigger picture.
Just imagine a bunch of cubes connected with strings. The cube is an object/information and the "string" is a connection to the next object either in the form of a pointer or a reference (depending on the language) to the next object. The way you traverse it, unlike a array which is accessed by an index, a linked list can only be traversed linearly one object at a time, starting either by the "head" or the "tail" (or whatever object you keep as "reference point", doesn't make much sense to keep one in the middle).
The advantage of a linked list is that you can easily add new objects at any point because the objects aren't stored in memory next to each other but in arbitrary places in memory. Adding an object in the middle of the list requires you to traverse the list until the object just before the place you want to add, change the pointer to point to the added object and set the added object to point to the next object.
Of course, this isn't very performance friendly due to how modern computers work (accessing memory is slow when it's not continuous, see "cache misses").
>>42253 >>42254 and to answer your question >How useful/important are these things? they aren't and you'll probably never use them, but if you don't understand how a linked list works you'll never understand something like a binary tree which is a very useful data structure
Are you able to understand recursion? Concepts are similar except that linked lists do not execute code, they are just a way of keeping track of memory addresses.
what's the absolute easiest way to make a game without having to code too much? i have learned java and python coding a bit and made games systems/mechanics using interactive fiction engines, but it's always too much effort making a full fledges game experience. it's like once i work out an inventory system, or make a jrpg style chat system, or work on saving/loading, user input, it is too hard to combine everything and make a game. i just want something where all the normal shit is already done and you just gotta plug in a bunch of things and make it your own flavor, anyone know anything?
>>42575 Depending on the type of game you want to make, just pick an engine/tool that's specialized for it. RPG maker is good for, you guessed it, RPGs. Monogatari.IO is good for VNs. etc.
These tools already have the most common features implemented and you can focus on making content. The drawback is you have less control over your game, tho.
>>42590 >Depending on the type of game you want to make, just pick an engine/tool that's specialized for it. took that advice, ended up googling for visual programming things for beginners, and i found flowlab.io, has zero typing whatsoever aside from entering values. while it's great for me now, i don't know how to use everything and the circuits you make aren't timed, as in everything fires at the same time, but some signals linger longer than others, some nodes take longer to output, some nodes need an ON output to their OFF input to stay off despite being a toggle, some values like 1 and 0 when passed through filters, even if they don't pass, will output their values, and when you are filtering for 0 and it passes 0, the 0 doesn't count as an input for some things, some things accept 0 as an on input though… many of the logic gates have a delay far greater than the speed of most other nodes so they can get choked up and stop working if the input varies too fast. despite all these confusions im making progress on my first game
tldr - you just drag and drop and connect blocks and don't gotta type or look at pages of text. why can't all suggested beginner game maker enginer include this? it reminds me more of avionics wiring diagrams like pic related, a kind of flowchart for dumb technicians to see the basics and not worry about the internals which is great for me
i'v thought of programing as a possible career path before but due to class scheduling issues (bad programing classes as well) and low motivation at home, i have gone months without any programing practice. i;ve got a pretty good knack when it comes to programing, but i have difficulty retaining information like certain aspect names in html and entire commands in python and c++. is ther a good website out there that can help me jog my memory in things like html and python, and that will teach me shit i will actually use when building a website or program cause all they taught me in c++ was how to do basic math in python and some what if shit that half the time didn't work
I currently need to use the computer at the library, but there is a time limit of 2 hours per user.
How would I go about increasing this time? (is it synced with windows internal clock?)
I have access to their webserver drive, C drive, task manager, CMD and system 32.
The timeclock program is called "Cybrarian" and on the webserver drive it has all the programs and administration tools, but I'm not sure what file to select for "PatronMGR.exe" to increase the time for my user. There is a file named "Patron" with my user ID in it, with the file extension of "DBA"
>>44419 You can pirate books on the subject for free, but other than that you can check out open-source projects that use your favorite language and study them.
>>44420 Do you have any suggestion on books? I was thinking clean code and clean architecture would be good read Is computer program structure and interpretation worth the read for what I am looking to learn?
"Design Patterns" is a good general one. Or "Head First Design Patterns" if you like the style. >clean code and clean architecture
Seems like exactly what you're looking for. >computer program structure and interpretation
If you mean SICP, I haven't read much of it but it's more about computer science principles than software engineering per se. You're much more likely to get something practical out of specific books on the subject, like the above.
Looking at the top replied comment about the /etc/mysql/my.cnf file, I have the file, but I'm not sure what to do with it. It's here.
orpheus@Roedelius:/etc/mysql$ ls conf.d debian-start my.cnf.fallback mysql.conf.d debian.cnf my.cnf mysql.cnf
It's not clear to me what the top answer says I should do with the my.cnf file to solve the error 2002 /var/run/mysqld/mysqld.sock problem I've been getting. I'd appreciate if anyone could help me with this.
what do I do from here? the top answer in stackoverflow says to do something but I don't understand what. Can anyone give me a step by step answer of what to do with this.
>>44704 >>44705 Hard to help you without knowing specifically what's happening. First of all, did you try restarting the mysql service (assuming you're running Ubuntu) before you start messing with config files?
>>44706 Yeah I did, but never mind my question because I managed to reset my root password somehow but now I have a different problem. My mysql server is failing to start. I worked on this shit all day so I'm going to work on it tomorrow now. Shits really makes me tear my hair out..
>>43252 ask for an extension if you need it, if you are too afraid to ask, try changing the timezone, if clock changes are locked, the timezone feature often times is not for various update reason, just tun it to a time zone behind yours >tfw wiz changes the timezone forwards and locks himself out
How do you not go insane when debugging something? I'm a self taught noob and I just spent about two days trying to fix my simple login/registration function, and had to ask my question 7+ times on different forums, and the answer was just a few lines of code but no one could explain it to me correctly and just assumed I knew how to implement it even though I said I was a noob. I did some further research on documentation and found the answer to my problem which I got completely lucky by finding and I had no idea this function was required to fix my issue. I've had problems like this on several other projects I've done in the past, searching for days just to add a few simple lines of code or finding some typo in my code that breaks everything that I overlooked, and it drives me mad. This takes a lot of patience to do.
>>44907 Take hard breaks between sessions. It helps clear your mind of frustration and come up with new approaches.
Also, Read The Fucking Manual (RTFM). I can't count how many times I've tried to wing a solution by stitching together pieces, ending up actually doing more work debugging simply because I was too lazy to go from zero and read the documentation.
In your case tho, I think it's a matter of both not reading the documentation and also lack of googling skills. Login/Registration has been done to death, every question possible has been asked, and there's countless working examples. Can't imagine why you would need to ask 7+ questions unless it's a radically different approach to the problem.
So, try this next time when encountering a problem: (1) Re-examine the theory of the problem you're trying to solve (example: Website Authentication/Authorization) (2) Re-examine the tools you're using, like the libraries, frameworks and language (3) Find working examples (4) Finally, if you're doing something truly unique, ask a question but be specific because Internet strangers are lazy (5) Otherwise, refine your search parameters and find an already answered question or library/framework/solution
I think the problem with a lot of "noobs" are that they start learning at the wrong place. You've started web development without first understanding the basics in a compiled language and how a computer actually works. You probably lack the theoretical knowledge about networking, web protocols, encryption, server-client model etc.
Can't say I have a solution, considering I was the same way. Programming since I was 12, learning things I found interesting leading to big holes in my knowledge. A foundational approach to learning would likely be faster and more effective, but that's seldom how self-taught people approach learning.
>>44927 Well, you need to know these things: >HTML/CSS >a server-side language >basic SQL, database management and communicating with the db through the server-side language
It's very basic. There's isn't even any authentication.
>>44926 FTP server/client perhaps? You'd need to work with files, sockets and threads/processes possibly.
I've been trying to do cool projects for some time now and have made a few but it's all so tiresome. They're always bigger than I initially thought and take so much effort to do.
When I walked outside the other day and contemplated a house complex being built, It dawned on me that the average project would be so much easier to do with someone else.
Have you guys met someone you could count on to build stuff together? Where and how did you meet if so?
>>44967 What projects are you building? I doubt anyone would want to work with me for free unless its for mutual benefit.
Whenever I got stuck on projects I just ask on stack overflow or other programming forums. I'm a beginner though so my questions are all at that level.
>>44969 I'd say DigitalOcean is a popular choice for personal projects. You get a small server instance for 5 bucks a month or at an hourly rate of $0.007. You can turn it off at any time or create another instance, or even scale it if you need more juice.
But you have to setup all your web server stuff on your own. Basically everything you did on your home machine except through a terminal. There's easy to follow guides on the net, so it shouldn't be too hard.
>>44967 I met a guy through wizchan and he's a good programmer but is absolutely anal about code styling and tool usage. We tried to make a game together but he lost interest immediately and hasn't contributed at all since the first few commits where he yelled at me for using tabs instead of spaces and having Windows file endings.
It seems less of a hassle to just work alone. For a successful partnership you both need to have similar visions, work ethics and values. On a paid job, that's not too important. But for personal projects it's always better to work alone since it's unlikely you'll find that person.
Also, thinking that adding more people to a project will get it done quicker is a common delusion in software development. It adds complexity since you need to now get more people on the same page which requires excellent communication skills. Unless you can reasonably divide the work into self-contained chunks, I wouldn't try to work with other people.
>>44975 There's code formatting and then there's autistic nitpicking about completely unimportant things. If by sloppy you mean laid back and open to compromises for the sake of working together, that person would likely focus on writing more functional code instead of playing with the formatting.
Still, I obliged his preferences and it still didn't work out because people lose interest.
>>44974 >he yelled at me for using tabs instead of spaces man, I haven't done any major programming in a long time, but fuck that guy, I hate spaces with a passion, I would seriously instantly delete/block/ignore anyone that told me to use spaces instead of tabs
>>44974 Automatic code formatting is a must. Configure a strict linter on every project. Into the script which installs dependencies, add a command that creates a pre-commit Git hook that aborts the commit unless it passes the linting. Linters now can fix most formatting mistakes on their own, don't forget to mention in documentation for contributors how to run one.
I'm trying to make my text in this div not go beyond the width of the image width. This isn't a problem with most of the images I put here, but if the text is too long then the text goes beyond the width of the image and I don't want that.
on my page with my html I put an <a>tag with a dynamic link href='displayPost<?php echo $image->id; ?> but I'm not sure how to add that $image->id; part into my router list and class to make dynamic url's.
>>45320 screw it I'll just not add dynamic links to my project, all the solutions I'm finding are too hard to understand. I'm going to learn a framework like symfony or laravel before I try coding dynamic links again, coding everything in raw php is too dam difficult.
>45346 You need to truly want to be able to program, and have things you want to do with programming beyond just making money. You also need to have the discipline to stick with it for months, perhaps a year, but that goes for learning any marketable skill.
After that, it's just a matter of picking any project (imageboard, video game, mobile nutritional tracker, etc) that strikes your fancy and learning any modern language that can do that, following tutorials, understanding programming fundamentals, and reading the goddamn documentation. Automate the Boring Stuff with Python is good if you're the practical sort. Don't worry about what the best language is, the only time that's a relevant discussion is when you're already a good programmer that has a couple paradigms under his belt (object-oriented, functional, symbolic, etc). Understanding paradigms leads to being able to pick up the syntax of a new language of that paradigm quickly.
Don't try to understand everything, programming is far too expansive a topic to do so. Don't feel bad about using libraries to get a project rolling, don't feel bad about feeling like you're working with a black box you don't understand. You might with time. You also might not, and that's fine, as there are millions of other programmers who rely on another programmer's domain knowledge to finish their project.
>>45322 Try implementing the following API, you'll be happier:
$router = new Router([ new Route('/^\/messages(?:\/([0-9]+))?$/', 'Message/MessageController') ]);
First route parameter is a regular expression that you match $_SERVER['REQUEST_URI'] against, second is the name of a class where you keep all the POST/GET/PATCH/etc methods for that resource. In the expression, id is optional, so you can either show all messages or find one.
$router->run();
if (empty($router->status)) { // Success. echo json_encode($router->body); } else { // Router caught some exception. http_response_code($router->status); echo $router->body; }
Also delete that controllers/ folder and organize by feature, like a Message directory for MessageController, MessageService and all the helper utilities you write for your Message model. Frameworks will teach you the opposite but please try writing simply first, as simply as possible. Sorry I didn't answer earlier, not much of an attentive poster.
>>45408 I don't know much about back end coding, but I don't know how to add that code into my current code and its using functions like ->run and ->status that I don't have so I'm not sure how its supposed to work. From you're showing I don't know how to match my html pages and controllers with it as well.
Why should I write as simply as possible first? I've read that frameworks will teach me a better way to code rather than learning this on my own. I started learning php 2 weeks ago and all I know is from the free courses of it on laracasts, but I don't think I can go very far with that knowledge and I don't even understand the code you have for a router.
foreach ($routes as $path => $controllerName) { $match = [];
if (preg_match($path, $_SERVER['REQUEST_URI'], $match)) { $controller = new $controllerName($match); echo $controller->$method(); exit; } }
http_response_code(404); echo 'No route defined for this URI.';
And Message/MessageController.php:
<?php class MessageController { function __construct($match) { $this->match = $match; }
function get() { if (empty($this->match[1])) { // …your database code to get all messages…
include __DIR__.'/MessagesView.php'; } else { $id = $this->match[1];
// …your database code to get one message…
include __DIR__.'/MessageView.php'; } }
function post() { if (empty($this->match[1])) { // …insert a message into database… } else { $id = $this->match[1];
// …update existing message in database… } } }
Message/MessagesView.php:
<h1>All messages.</h1> …probably a form here to insert a message…
Message/MessageView.php:
<h1><?php echo $id; ?></h1> …probably an update form here…
Save it and open /messages/123, /messages and / to verify that it works before adding other routes, methods and database code. Frameworks don't teach you how to code better, they teach you their specific way to code. But you might not need one for a little personal application, since you won't use most of its features and will likely overcomplicate your task.
Must say it's cool you got this far in 2 weeks, took me much more.
Ok, in c++ i want to make a map that takes a string and a vector pair that contains a string,int. Pretty much:
map<string,vector<pair<string,int>>> mapName.
I'm trying to add stuff to it like this. mapName.insert(string,vector.push_back(make_pair(string,int))).
And I'm stumped because I don't know how to add things to the vector since you can't name it doing this as far as I know. I've tried googling but can't find much on it.
I created a matlab script that will aid me in my house hunting. Unfortunately crime data is fairly useless without knowing the population of area. I found some population data for every city with city borders. The borders are shapes that outline every city with latitude and longitude coordinates.
So basically all I had to do was pick points on the map, find out what city they are in, and then associate it with the population so I can get a crime per person statistic. Great! I used matlab's inpolygon() function for that.
Unfortunately this data really isn't nicely formatted and I am a lazy fuck who didn't want to do that. I have to make some ultra slow matlab calls which is causing this processing to take forever.
I dunno why I am posting this. I guess I am just bored while I wait for this slow af code to finish, and I am slightly drunk right now.
>>46000 you don't know javascript is free on github and its the only book that helped me the most. After that I learned by making projects. I tried eloquent javascript too but its too technical for me to understand and I dropped in midway.
>>46517 Good courses for a very beginner. Introduce you to commonly used libraries, patterns and cloud services. Still you can just read the official docs of the libraries, with an alike result if not more up-to-date in the end.
Please don't do this kind of shit if you absolutely have to start writing anything new in Rust. Developing on a latest Rust release, fine, even a beta version is understandable, but writing your entire build process using features from a nightly branch of a compiler built for only a few chosen platforms that needs its own binary to build itself creates quite an unpleasant loop. You might be thinking that features from a nightly will move to stable some time in the next four years. They won't. I'll boldly name this as the single reason behind how Firefox got stuck in its current limbo state. Sorry for the rant.
>>46916 Well it was over my head when I was in the thick of learning to code.
Since I so rarely use it I have forgotten nearly everything so it probably seems even harder then it really is to me now more then ever. Occasionally I lurk the thread telling myself I will get back into it but I never do since I never have a good reason to push myself beyond extremely simple scripting within existing programs.
Maybe if I was into a game like second life again that had where you could add code to objects based on C# that you could play around with, I would be more likely to get back into it since it would be more playing around instead of feeling like doing work/studying. Oh well.
Anyone here willing to take a beginner under his wing? Feed me little projects or something you need help with so that I could have direction on what to learn and be useful.
>>46917 Simple scripting is the best, most useful kind of programs.
>>47022 Can share an unfinished textboard codebase if that doesn't sound ridiculously easy to you. Posted my feature plan on /meta/ in the textboard general, and you'll be able to pick up whatever catches your interest. Unlikely to be of much help in terms of advice, support, appearing online or responding to messages though.
>>46913 Coding a neural network, from scratch even, is MUCH easier than a video game. If you don't do it from scratch especially, then libraries make it very easy
>>45448 I start drawing control flow or objects/interactions with boxes and arrows. Sometimes I include (pseudo)code in these modules, but frequently I begin from a higher level of abstraction. A whiteboard is usually good for this, but I always have graph paper on hand just in case. A blackboard is the most comfortable, but those aren't very common and you have to be careful not to get chalk in your keyboard.
If I can't come up with a design that I like, then I walk through everything from the beginning. I ask myself: what am I starting with, and what are my desired outcomes? What are the high level components? And other similar questions. Basically, the idea is to strengthen your understanding of the problem and of your desired result; this understanding will help you form the high level building blocks for the solution and how they interact with each other. I usually speak this self-Q&A aloud while taking notes and drawing more boxes and arrows.
idk if anyone else knows, but windows batch scripting is easy to pick up. it has some severe limitations compared to virtually any real programing language, or even other operating systems shell scripting languages, but if you are on windows it's still kind of cool
for example just open up up notepase and type/paste this, then save as runme.bat or runme.cmd, then double click it
@echo off set yourvariable=wiz echo hello %yourvariable% pause
any text-based game or interactive program can be made pretty quick. here's some descriptions of the commands i use often, or examples of the usage set x=1 <assigns local temporary variable> set /a x=y+z <same as above but allows simple artithmatic> if %x% equ 1 (set y=2) & (set z=3) <using if. %variable% uses the value of the variable. "&" is a way to separate commands> if %y% equ 1 if %x% equ 3 (echo ASFFDGgd) <if can just be stacked with other ifs to next them. echo prints out text> goto example <makes the program go to :example>
:example <label, serves as jump point for goto> if age geq 5 (set dog=blah) & (set blahblah=blahblahblah) ^ <this " ^" escapes the end of line character, lets commands be broke up over multiple lines if they get too long and hard to read> (set asdfsdfsd=sadfasdf) <this is considered part of the above if condition>
if something equ nothing (set example=55) || (set example=99) <the "||" means if the previous thing fails, or isn't true, it runs the command. i think it means OR>
echo a - first choice echo b - second choice echo c - third choice choice /c abc /n <halts the program, only continues if they press a,b, or c. the /c and /n are just some options i like with it> set yourchoice=%errorlevel% <if they press a, that sets errorlevel to 1, b-2, c-3, etc> if %yourchoice% equ 1 (echo first choice)
pause <pauses the script, and displays message letting you know to press something to continue cls <clears the screen of text>
setx catdog=dogcat <this is setting a permanent variable, but you can only use it later, not in the current batch file>
there's a few variables and "cmdlets" you can use as well to do stuff, %username%, %cd%, %date%, %time%
timeout 600 /nobreak <halts script. after 600 seconds, script continues. /nobreak means you can't interrupt it> shutdown /h <can hibernate computer> cipher /w:c:\ <wipes the deleted/unallocated space on c: drive by overwriting with random data or something. basically after running cipher you can't recover deleted data. all windows have cipher> taskkill /f /im openwith.exe <terminate tasks like how you normally would by using task manager> @RD /S /Q "C:\$Recycle.bin" <effectively clears recycle bin> net stop WaaSMedicSvc <can stop services> title command shortcuts <renames the command line interface to "command shortcuts"> color f0 <sets the command line interface background color to white, and the text color to black. opposite of how it is normally> @echo off <used at the start of scripts for a cleaner output> type example.txt <prints out the contents of example.txt if example.txt is in the same directory as the batch file. otherwise you specify filename>
there's also CALL used for creating subroutines and functions, but i haven't even used it once. you can call labels or other programs i think. also there's piping to output or input stuff, also haven't used that though.
in general you can use set, set /a, echo, choice, and goto for simple games without any problem. those have made up like 99% of the commands i use.
here's some other stuff a bit more complicated using other program's command line functions, but i'm not a programmer so it's not that hard. this series of scirpts is started by dragging a folder containg .png files onto the batch file. the location of the folder dragged is %1, %cd% is the directory of the batch file itself, and the programs with command line functions i can utilize are all in the folder 'scanmate' on the same directory as the batch file itself
%cd%\scanmate\advanced_renamer_portable\arenc.exe -e %cd%\scanmate\alphanumeric-to-numeric.aren -t files -p "%1" -msk "*.png" -o filename -m rename >this uses the program advanced renamer to rename .png files alphanumerically counting up from 01.png
for /r "%1" %%a in (*.png) do (%cd%\scanmate\optipng\optipng.exe -force -v -o2 "%%a") >this uses optipng to compress the .pngs
echo ARCHIVE FORMAT: echo 1 - ZIP echo 2 - RAR choice /c 12 /n set cnum=%errorlevel% if %cnum% equ 1 (set archiveformat=ZIP)^ else (set archiveformat=RAR) set /p archivename=%archiveformat% ARCHIVE NAME: %cd%\scanmate\winrar\rar.exe a -r %1\%archivename%.%archiveformat% %1\*.png >choice for zip/rar. prompt for the filename. then uses rar.exe to archive the pictures using the format and filename.
>>47539 batch is pretty fun, that's how I started programming when I was 12, I'd make tons of stupid little programs in batch and show them to my parents
output from what people now call a 10 print program/pattern. it was originally a single line of code in basic that would randomly print either / or \ and fill the screen. some people actually found it interesting enough to write a book about it. example are found online https://snek.dev/10print
the cool thing is that when rotates 45 degrees, it is like a maze, using only 2 characters. but because it's random it's not a very good maze and you can see using paint bucket to fill either side, there can be ver large sections that are uncrossable
Tired of having to make multiple different commandline parsers I've been programming a generic unix-style command line parser.
I know I don't have to, libs exist, but I code everything from scratch (and all libs have security vulns).
Nothing impressive. Just –xxx-xxx and/or -x added to an iterative AVL tree implementation, with doc strings to generate the –help output, and fn pointers to call upon encountering a parameter.
I feel like most of my time programming is not spent…programming
Instead it’s what I would call “bullshit one-off IT problems.” I need a weird library and spend a day trying to track down the particular version I need because it’s not in any package manager, of course. Or I have to use some function that I do not understand how it works, nor can I track down the documentation for what the error code “E705” that it keeps popping out (c.f. the error codes hidden in LAPACK hidden in GSL), nor does ANYONE know how it works. Or I spend two days just figuring out how to get weird library X to work with my set of bullshit code, or how the library calls even work, or a version that doesn't require me to learn two or three other lirbaries just to call the one function I want to call. Or, my workstation is a Windows x64 distribution whereas the compiler I need to use only supports a Debian i686, but that’s O.K. because then I can cludgily call it if I manage to make an executable on the separate workstation—if I can manage to get the particular version of Debian the damn thing works on. Or my IDE breaks and gives some mysterious code (or I’ve even run across kernel faults) that I have to track down even though it doesn’t even come up on websearches, and I get sidetracked fixing my computer for a couple days. Or, I need to register some odd account on a website a client uses and take forever to figure out what should be a simple web-portal that instead has evolved 3 million widgets (imagine a screen just filled with more buttons that the cockpit of the space shuttle) over the past 30 years that all interact in the most obscure of ways.
When I actually finally get to the problem after a week, I end up only writing at most a hundred lines to solve the actual problem.
>>47704 I wish I could only write a hundred lines to solve an issue, usually I end up writing a few thousand. The less code and the fewer dependencies you introduce, the more quality thing you create.
>>47704 Same, the second you step outside the standard and most popular libraries/frameworks you are in the middle of a gigantic minefield by yourself without an end in sight. I loathe working with most programmers code, but reading their documentation (if it even exists) is even worse, things almost never work as they should. Last week I spent 3 days setting up and trying to use a small library for a very specific use. The thing kept throwing all kind of errors that didn't make any sense. Found one single example of code in the documentation which was 2 years old, the only way to make this library work as intended was to use a 2 year old version in debug mode.
>>47709 What language or ecosystem is that? I never have these issues when dealing with Node.js or pure C and simple focused libraries, but projects in Java and C++ and enterprise frameworks regardless of the language turn out abominable hell with conflicting dependencies every time.
Somebody in a chatroom kept pushing python as the best thing ever, I've only ever worked with C# and I think python seems like it's over-hyped and a meme.
>>47710 >language >ecosystem It's never one language/ecosystem. It's whatever package/library/language that needs to be found and pulled together to get the project to work.
>>47711 How can Python be overhyped when it's much less widespread? Personally I like how compact and readable it lets you script GUI and text file operations, but altogether it's huge and I don't appreciate its presence and sometimes requirement in base Linux systems in a similar way that C# is on Windows.
>>47712 I don't understand, why are you pulling in those packages, libraries etc unless you're sure they work and integrate fine? Nobody should be adding languages to projects, the mention of "pulling together" such enormous third-party components clearly sounds like someone up the business chain is making disastrously incompetent decisions.
>>47711 man i hated python for the mandatory indentation and case sensitivity. they really wanted every program to look the same way regardless of who wrote it. it's super popular in universities and just common usage though from what i've read
>>47900 You can probably make a program that gives the illusion of a waifu but we haven't figured out a way to make sentient AI yet. What's the point anyways? If you write the program then you know how it exactly works so it is impossible to fool yourself.
>>47900 One of the main reasons why I got into science and programming was to make an AI. Kinda like in the 1995 gits movie. That stuff is fascinating. I don't think anyone's close to achieving that though, although deepmind is doing interesting stuff.
If you're feeling incredibly irritated, anxious and frustrated at the start of learning how to code is it perhaps the wrong thing to try? Has anyone else started out feeling like this?
I am avoiding learning because of this but I want to do the course on Khan Academy before I completely give up on it
>>47948 I started learning java when I was 13 coding runescape private servers, literally just doing trial and error coding until I understood what was going on. That felt really rewarding to me, I never got frustrated but I got excited because I was making cool stuff in runescape. I assume those khan academy exercises are boring though
>>47960 It seems unrelated to your interest in programming. You'd likely experience the same feelings towards any hobby or skill. Nothing else to do except push on and focus on the process. Perhaps once you observe your own self-efficacy, you'd gain more confidence and some relief for those pesky feelings.
>>47963 This is what I was thinking. Ill go through the classes and if I still don't like it Ill move on. But I gotta push through the starting pains. Thanks for the input anon.
I'm 2 weeks into a codemonkey job and starting to hate programming. I used to like messing with the computer, writing small programs, understanding how things work behind the scenes, configuring my system etc. And now after this short period of being _forced_ to write code I'm actually adopting the idea that computers should "just work" and considering switching back to windows and using bugged, resource heavy spyware because it's too much hussle otherwise. How to I prevent this process from going further and revert it back to normal?
was playing with idea of a vn kind of engine yesterday, this is what i got so far using autoit. the script part looks weird like a batch script right now but it works at least
I don't know if it's qualify as programming but given the fact this is the best place to ask I'll give it a shot. Do you guys know any good places to learn html? I've done the codeacademy course but you don't learn much in there. I was looking for something a little more extensive.
>>49272 There really isn't much to learn, in html you use tags to specify how a document is structured. There's a lot and even web developers don't use most of them. It's pretty much a learn as you go thing. Best thing you can do is learn the basic structure and tags (html, head, body, a, p, div…), try to write your website/document and google whatever you don't know how to do i.e html embed audio.
The mozilla documentation is usually good for html/css/js. I haven't went over any of the tutorials but if I need to check how X thing works I check here or the first stackoverflow google result. https://developer.mozilla.org/en-US/docs/Web/HTML
>>49273 Thnks for the quick response wiz. I guess you're right, I'll just continue doing the css exercises from codecademy as there's lots of html in there and once that's done I'll try to build a small website.
>>49273 I'm not >>49272, but I too would like to work with HTML/CSS/PHP a bit. I did it a lot as a kid. I remember being able to just open a plain HTML document and then build up a page in pure WYSIWYG realtime with Firebug but that was like 10 years ago and I can't find an equivalent now.
If anyone working with it has any tips on how to set up a seamless work environment for such things, that would be cool. What browsers/extensions/programs to use so that I can say, edit the HTML or CSS in an editor in one monitor, and the browser updates the webpage using it in realtime or with a simple refresh in the other monitor.
anyone know a good way to produce a vector image using several thousands points? like for example to draw a square you'd just have 4 points and they would be connected. i'm considering just simulating mouseclick/move and drawing one point, then a line to the next point, etc with a vector image editor
would be cool if there was a program that could just accept a list of x, y values
>>49485 actually just information on a simple vector image format that is easy to understand would probably help if i can just create the image directly
Ahaha, I broke the gcc in my windows. Nothing fucking works, not Eclipse, not Netbeans, not Codeblocks. I may be a beginner retard but it shouldn't be this hard to build a hello world program. I mean I can use an ide with its own compiler like devC or an online one but I am still mad at these garbage software that's different from than everyone else online. Eclipse and Netbeans won't build binary files or whatever. Codeblocks keeps telling me that some dlls is missing when it's right fucking there. I even deleted my mingw and reinstalled it directly from the codeblocks installer. Nothing online helps. Maybe it's time to try out linux. Hope it's not some epic /g/ meme and is actually useful.
>>49489 >hello world program that's a lot of work for that, just pick up an interpreted language or something if you just wanna learn how computers work
>>49490 I'm trying to do a rudimentary lightning system with c++ using sfml. What I did was creating a vector of small black squares (5x5) that covers the entire screen and each frame I check distance to source (mouse in this case) and adjust the alpha accordingly. Pretty simple, thing is, it annihilates the framerate. How do 2d games usually do lightning?
>>49491 they route computationally intensive sections of code to run on the gpu, and they also utilise multicore programming, and they use engines that have already worked out efficient implementations for stuff like lighting
most importantly though they cheat and use tricks. one trick they would use is just an overlay constantly positioned to the cursor to achieve that effect
>>49495 Yeah an overlay works great but I was trying to something for when I have more than one light source. Now I'm trying to learn about blending. Man there's so much to learn. At this rate I'll never be able to make anything.
>>49489 it's a pain to do a lot of development tasks in windows try with vscode there might be a plugin to compile C easily without installing visual studio
>>49489 Why gcc? If you're on Windows it's much better to use something that actually works natively such as DevCpp, PellesC or even Visual Studio. But in case you really want to use gcc, you can always install Linux distribution inside virtual machine.
>>49503 Wow using color blending was so easy I feel retarded because someone had to actually tell me how it was done. And I struggled all afternoon with this.
>>49490 I don't really just want to learn computers. I want to be kinda serious. But it really is a lot of work. I though beginner's linux would be easy but I still get errors I wasn't in the mood to deal with.
>>49510 Thanks, but I already restored my system and got codeblocks to work. It's still a pain to set up some other things though. Now I finally understand why people hate windows.
>>49513 All the "big name" IDE that's popular in the industry usually use gcc though. Eclipse, Netbeans,and Codeblocks use an external compiler which is usually recommended to be MinGW. Visual studio could work but I don't really want to use them unless it's for .net languages.
Since CSS is technically a programming language. There is a userstyle out there called "Base 16 for 8chan" that works on here that I tweaked to match my system's colours. The difference is small but it's satisfying. I also made it use variables so it can be easily ported to other themes from base-16 family.
played with inform7 today after going through the documentation. all i can say is jesus christ. i dont get these programming languages using 'natural language'. it says to be intended for programmers interested in writing, and writers interested in programming, but i dont think syntax has ever been the most difficult part of learning most languages. everything is a god damn sentence requiring. instead of briefly checking over a syntax guide, you are required to learn a completely different way of speaking english. everything has to be written very specifically. instead of making a quick game it's become more or less a prescriptivist grammar lesson. natural language processing, at least whatever they are using, i NOT developed enough for this to be anything but a chore. it still seems really cool and powerful for text based simulated interactions between things, and i'll continue, but it's not fun
>>46009 just wanted to say thank you for this post. different wizzie than the one you replied to and i'm reading it almost a year later but this is a great book and it's helping me a lot. thanks.
>>50080 Yes. I studied different things when i was at university, so now that i'm an unemployed neet im reading about it and might try to get some certification/s
Im going to try solving advent of code thid year. I won't do it at the time the problems are opened, because it's 5 am in europe. So no worries about times and rankings. I can't promise I won't forget about it by the second day.
I forgot this existed, guess I'll try it too since it's something to look forward to each day. Just got caught up and solved all 4 problems released so far.
I'm going to take a test on my programming class in about 10 minutes. It's going to be GG no re since I feel unprepared overall, but I feel like I've learned a lot about python, my first language. I am going to fail though. I have a 50 in the class, so this final will not affect anything.
i didnt setup my timer to the current time on a script, it was at 0 lol. so every check for whether (timer < current time) would pass and every instance would incrememt until it caught up to the current time. it basically resulted in all the instances having the same values dependent on the timer regardless of when the instance was created
really silly mistake but i had no idea what was going on at first
>>41214 wrote a script that converts my text document that contains all the anime i watched, want to watch and dropped to json. now need to write a gui that makes it easier to add new data to that json. i'm not sure if i should use some client side shit or set up a server and modify the file remotely or something. i used to keep that document in my mega cloud and sync it across devices. i suppose i should write that thing in python (using pyside) since python is the only lang that i know really well and actually enjoy writing stuff in.
Feels weird to see this thread I created after two years (hob is slow as fuck) Can't even recognize my posts, like, did I really ask this dumb question?
Anyway this time gonna try my hand with AI and machine learning after learning javascript, html, css, python and building some apps/extensions (had been learning C++ before those, japanese as an extra). I'm pretty good at theories but frustrated at learning their syntax, like, why do I have to memorize someone else's arbitrary naming convention, and they change all-the-time?
Honestly I've been having a blast with programming lately. As strange as it sounds I've found myself really appreciating C. People say that C is "low level" but it's really not. Everything works the same way it does in any other language. The main difference really is having to work directly with memory. You have to learn what a pointer is; How memory is managed for functions; How parameters work; and so on. People really exaggerate how difficult it is.
At most it means using pointers virtually for everything – but that's not difficult at all. Being explicit about when you're making copies or working directly with a 'variable' is a very useful property and something that can get confusing in hand-holding languages that try to hide everything. The main problem that people are going to have with C is the lack of data types.
It has no support for lists or associative arrays / dictionaries / hash maps – and those are very fundamental data structures for most engineers. A linked list is a basic data structure that's easily implemented without reference, but hash maps may require more study if a developer has no exposure to their theory. Once you've added hash maps you'll probably also want to use an arbitrary precision number library for your program.
The reason to do this is because numerical operations in C can overflow or underflow and it's not practical to write checks before each and every math operation. You'll eventually want a library. If only to be able to work with sizes larger than the standard data types provided with C which are only up to 64 bits. Some compilers support 128 bit numbers but it's a special platform and compiler specific type. I ended up writing my own safe math library with support for add, sub, mul, and div of integers and decimal numbers simulated using integers.
My code is extensively tested, detects all math operations that will go outside the bounds of a type before they occur based on number theory, and provides highly accurate results for decimal calculations by avoiding floating point errors (it uses integers instead of floats.) The target platform for all of this is 64 bit but it degrades to a simulation automatically if compiler support for the special large numeric type isn't avoid. All of this is significantly easier, faster, and less disgusting than GNUs arbitrary precision library – my code is a single file header – no includes.
I mentioned earlier that C doesn't have hash maps. What this means is a lot of C libraries have terrible interfaces. Because most programmers are used to thinking in terms of hash maps for many different problems. An example of this is JSON which is basically just a key value store with hierarchical keys. Many of the C libraries for JSON are fucking disgusting and have API interfaces that practically require writing your own parser to parse the 'results.' These aren't parsers, they're dog shit.
It's been fun fixing all these problems. The next problem that I really need to solve with C is possibly expanding how strings are built. I'm not sure how I want to go about that yet though. I might do some Googling to see how people are currently doing it or if they are. After that I'll really have everything I need to release some solid software.
Tl; dr – with only basic comp sci and good testing C is not a low level language.
>>52108 Managing pointers and memory is simple in small projects. Combined with undefined behaviour and lack of features makes development painful and very error prone. Do it in a big project with a bunch of other people working with time constraints. Each language has its own use and outside of a few cases C is a bad choice.
>>52110 >big project with a bunch of other people working with time constraints quiche eater
>>52108 You sir are on the path to enlightenment; May the wind be always at your back and the sun shine warm upon your face. Ignore those that glow for they will envy the intrepidness of your journey.
Less than one cycle of the moon ago I perchance happened upon the need to solicit a considerable quantity in .bss - I decided to ink the scroll in the new tongue of Go for I foresaw the need to divide it's labours in the near future. Alas, aghast I was when presented with:
too much data in section SNOPTRBSS (over 2e+09 bytes)
How dare the staff spake to the magician in these ungodly magic numbers — doth it not know I am the mighty sorcerer whom has willed the mechanism with dark spells for many eons? I dusted off my tunic, sat upright and with a fierce glare, exclaimed in the ancient tongue of the sea of my desires — All was well.
>>52110 I don't know how you can say C is always the wrong choice. Look at the Linux kernel. It has some of the most beautiful code out there and it's written in C and assembly. I really don't get how people think memory management is too much. It's not like you need to use the heap for everything anyway. Is writing
if(p) { free(p); p = 0; }
… too hard? I would dismiss claims about buffer overflows because it's also an exception to write outside of memory offsets in other languages. The bigger issue with C is if you use standard library functions and don't understand how they work 100%. Many of the default funcs are unsafe and there are subtle vulns you have to know about. But again - not exactly rocket science.
>>52113 >Linux kernel Kernel development is a niche. Also programmers working on linux are easily in the top 1-5% of income. >It's not like you need to use the heap for everything anyway Uhh I'd say most code requires dealing with dynamic memory such as retrieving data from a database.
>>52118 There's also embedded systems where C is still a -very- popular choice. God only knows how much firmware code was written in C. A lot, I would guess
some funny incorrect results trying to convert .obj vertex/face values into 2d .svg images
first i tried just making lines for x/y, then x/z plus z, now i'm trying to make it single point perspective with things scaled according to z. in the beginning i also forgot to clear the vertex/face arrays in between conversions so every conversion just added a bunch of junk which was entertaining
>>52379 i just want maps i guess. xbm is a cool format for making images from this kind of data. just have to find a way to combine the tree position data with this stuff and ill be content
You know those deceptively simple questions in math and computer science that have been open problems for like 20+ years? I had the bright idea of trying to solve one recently and I'm in deep this time. I know now why professors tell their students to stay away from them. These problems make it seem like the answer is JUST AROUND THE CORNER. So you keep going…. And going. Write more code. Try more approaches. Drink more red bull… I'm in deep this time. Deep inside witchie, and IDK if there's a light at the end of this wiz tunnel (witchie.)
If I have to throw away all this work (and most likely I will since NO ONE IN F*king 18 YEARS has solved the problem) then I'm going to be EXTREMELY butthut!!!! And yet… And yet… and yet and yet. I have made progress. I've managed to reduce the problem from intractable to exponential. I need to reduce exponential to something that a computer can actually F*[fuck]ing run! I have an algorithm that I've been working on since all of last night. It's based on 100+ lines of complex BITWISE ops that resemble a hash function. IF it works, I will be the first person to solve this problem.
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh sips more redbull Still writing the code and testing it. I can honestly say this is the most complex thing I've ever worked on and I've invented a lot of shit. Will see what happens. sipping stops
>>52490 This wiz is exhausted. Tomorrow I'll write some code to generate the inputs to test the last part of the algorithm. Wish me luck wiz. If it works I'll be the first person to ever solve this problem ((((but I doubt it))))
A quick wiz update. I've been working on an unsolved problem in math and I think I may have just solved it. When I started this process the problem was intractable, meaning that it required too much computing resources to ever be solvable. Even if every compute in the world were put to use towards solving this problem an answer would never be reached before our sun burnt out.
With some careful hacking I managed to divide the problem up into a series of smaller problems, each of which eventually added up to an exponential growth curve. Such a result makes calculating an answer impossible as after a few iterations the set size growths so large that we run into the same issue that we've started with.
That's when I realised I could carve a path through the noise by creating a fuzzy sampling the answer. Exponential growth was traded away for a minimal footprint of the output size which could be compactly represented without requiring universe sized amounts of memory. After working on this idea for the last few days I managed to transform the exponential growth curve into a linear growth curve but the calculation is STILL too slow!
While I have succeeded in allowing computations to be VASTLY and almost immeasurably, more efficient, it means that after just 20 iterations or so, the growth from the previous number of cycles has already stacked up making future progress prohibitive. But I've just realised that I can create a 100% accurate offset in the computation paths by the realisation that I know the set sizes in advance and by purposefully varying the set sizes. What this means is that rather than relying on a chain of fuzzy check points to guide the computations, I can instead strategically choose points to insert a reference.
The reference will allow the algorithm to DISCARD all previous state chains that it builds up as part of the computation, essentially reducing an accrued linear growth back to zero, and turning a gradually growing linear curve into a parabolic one. Basically, my approach works. The numbers line up. The parameters are perfect. Every bug has been sorted out in the fuzzy sampling code which was the most difficult shit I've ever worked on. Tomorrow I will add the strategic check point algorithm on top of the existing algorithm which will allow it to run VERY fucking fast. We're talking about finishing what would previously take a universe sized amount of energy in what I calculate to be about 5 - 30 minutes.
That is the second part of the problem solved. The first part I have already solved as it exhibits no growth what-so-ever, is in within the range of what a modern processor can calculate, and could even be concurrently computed on a cluster or GPU. This is honestly significant.
>>52542 >>52559 I managed to reduce the results down to an average of around 100 - 150 candidates per set. But the way I setup filtering means having to compute: 150 * 150 * 150… etc for the entire number of sets left (128) in total. That adds up fast. The problem is that the filter I designed is primitive and doesn't allow for sorting the candidate sets on a whole. I think that potentially the solution is to use merkle trees but I haven't written enough code yet to verify this. I may end up using a combination of approaches because 150 candidates is still honestly decent for what I'm trying to do.
Okay, big update for you all. My merkle tree approach is working. I'll be able to move to integrating this part with the rest of the code. I'm very surprised that it actually works. I think I'll end up being the first person to solve this problem. this is crazy
Coding an emulator using the technical documents that are available. Planning on using C, Visual Studio and Win32. No external libraries.
I'm sure it will be completely redundant and nobody will use it but I can maybe add it to a portfolio. I have had enough of obsessing over the usefulness or lack thereof of my projects. It gets in the way of progress.
I hope I can someday make a game, too. Just gotta hang out code. Read books. Every day, no exceptions. Don't plan, just do. It's all about mileage.
Buy Colt Steele's Bootcamp on Udemy for £10 which will give you a brief overview of HTML & CSS, JS & more languages. But don't watch all of it, just do the first 4/5 sections which cover HTML and CSS (Dont begin Bootstrap yet). You wont be a pro but you'll understand the underlying principles of each. Then do Academind's 'CSS - The Complete Guide' which you can find on google / torrenting sites for free, or buy it if you prefer. This will give you a much more in depth understanding of CSS, as for HTML don't worry, you'll just pick up the rest as you go on. Once you've completed Academind's course you can return to Colt Steele's course and begin the following section which will be Bootstrap 4. Buy this point I'm sure you'll be confidently progressing in HTML & CSS and have a clear path to forward onto CSS frameworks and Javascript/Python.
>>52124 >>52118 >>52113 C is the most lindy programming language. This is a fact. Long after Python is in the dustbins like fortran or basic of this era, C will still be in use. C is king…. also much faster than Python.
Writing an FTP client and server without using existing FTP libraries. Pretty fun so far, client has most of the basic functionality implemented but needs a lot of refactoring and more robust error handling.
>>41214 DO NOT learn C from " Learn C the Hard Way". Sure you can learn C from it but its somewhat notorious for being structured very poorly for beginners.
Another one I'd very much recommend is "Modern C" which is a free, open source book. Is very well structured for beginners and intermediate alike, but is longer then the prior mentioned book. https://modernc.gforge.inria.fr/
>>52601 I was wrong wiz. My merkle tree approach didn't work to stop the exponential set growth like I was hoping. I believe it's still an efficient method, but I jumped too quickly in declaring I had solved the problem.
I've now failed with 8 different algorithms over a period of 3+ months. That should be the end of it; I mean everyone whose ever tried to solve this problem has failed. I decided I would give it one last shot and try a new filtering approach. See, I had an intuition about a similar algorithm that was metaphorically like the same problem… so I decided to play around with the idea, thinking it was senseless even to me.
I made a few modifications to the algorithm to make it work with what I was trying to do (set reduction)… and that's where shit gets p wild… After almost no work it was many magnitudes more efficient than my merkle tree approach. It was GOOD, but after I ran the numbers and did some experiments it still didn't solve the exponential growth problem. That was until today…
I found a way to forge a weapon to strike through the entropy. As the sets grow larger and reach a certain threshold, I forge a new sword and strike down my target, slashing the sets back down to a manageable size. It might honestly be the most beautiful thing I've seen a computer do. wtf im CRYING… WTF Best of all – it takes up no special room in the final program.
At this point the algorithm is final, but my code for it isn't. What remains is merging in my experiment code into the reconstruction algorithm. I have proven that it works now. But I won't be satisfied until the full program runs as part of a working system in the real world. Something that I can point to with certainty and say 'this was impossible before, it's not any more.'
>>53248 Still rooting for you then wizzie. Finish your code and publish the solution to this problem so others can use your solution! You'll have contributed to humanity.
It feels like 90% to 95% of the time I spend “coding” is actually spent “trying to figure out how to compile a project/library/simply get it to run in the environment” as opposed to actually writing and debugging code. Ironically, every project that tells me to use a program to satisfy all the build dependencies usually takes even longer just to get that program to run correctly, despite ‘in theory’ it should not.
>>53544 I've only had that issue with C/C++ because it just doesn't have great tools that will work on every platform. Even experienced programmers are frustrated with that aspect of it.
Most modern programming languages have a package/dependency manager that handles downloading and versioning which makes it really easy to set up a dev environment i.e. npm, cargo, gem, pip and so on. The only time I have an issue with those is when the "library" is a just a wrapper around a C/C++ DLL and I get linking errors for whatever reason.
I have learned Java and Python and wanted to write a monitoring tool for myself. Monitoring my PC and browsing activities, that is.
Java apparently only exists in its own box and cannot interact with the machine. How do I interact with things happening outside of the "program window"
>>54146 To clarify: yes you can interact with files outside of the program. I did as far: creating and changing files. But how to detect inputs and read out data form other software (eg which site I am browsing). hmm
>>54147 >>54146 Well, that's complex and depends on the operating system and applications. You can easily execute a system command to list out current running processes (ps on linux, tasklist on windows), but getting data from other applications is tricky when there isn't an API or they encrypt their data files.
For instance, to get browser history, you have to know where the browser stores that information. For Firefox and Chrome it's an SQLite database file (lookup the location online). It's readable with an SQLite library and some investigation of the table structures.
brother got an IT job and emailed me a book for learning powershell. doubt im gonna read it but maybe someone else can use it. i would attach it directly but it's 42MB. https://gofile.io/d/fe9ctH
perl is so cool. joe camel is cool. perl sounds like pearl. thats like expensive. larry wall is a cool looking dude. hes like a rms that trims his beard. perl used to be known as the glue that holds the internet together. then boring php and js came. state of the onion sounds cool, like an intelligence brief. "perl monks" sounds cool. its just like "the knights of lambda" in coolness. and camels were the best in aoe2. they could beat knights. i think its better than python or c or scheme as a language for newbies. "print "hello world"" is a full and valid perl program. its good at manipulating text, automating stuff, some web stuff, piecing programs together. its like bash on ritalin. perfect for people new to this. perl books have cool names. like "The Camel Book". and "High Order Perl", that one sounds sophisticated. compare that to automate the boring stuff with python which has boring in its name. pythons name is based on a boring english tv comedy show. might as well make a mr bean programming language. its used by people who see computers as only a means to an end. perl can be obfuscated. python obfuscation? pfft. i think everyone should start with bash, then perl, c++, c and assembly. it looks like theyre all that you need to get real stuff done. then if computing isnt just a means to an end you can read about APL, Prolog, scheme.
anyone know a program for 'unreflecting' or correcting reflections. assuming you know the exact geometry of an object's reflection that is being recorded, like a reflective sphere for example
I wanted to learn Laravel and hone up my frontend coding skills so I'm recreating the Sublime Text interface as a dynamic personal website thing. I just didn't know what else to do.
>>54309 took longer than i expected. some things aren't going as planned, like the second room sometimes doesn't connect with the first room and this can lead to two 'halves' of the map that don't ever join up
i already have ideas for improving it, in particular reducing the hallway lengths, and adding dead ends. im content for now though
>>54386 Like in everything programming - there are ready algorithms for that, and they're probably more effective than what you'll produce by yourself. Use one of those.
>>54402 you're right, but i'm not intelligent enough to understand them. it's also not fun just mindlessly implementing someone else's creation. it's not like this is my job i can afford to have fun and come up with my own ideas
>>54402 I know right? Why try learning to do anything when you could just have money and do it the proprietary way with a team of college trained graphic artists?
>>54386 well i got it to work perfectly. but slapping on code for making dead ends reintroduced the disconnected rooms problem. so it isn't perfect anymore but still kind of cool
>>54556 No, but I once tried to learn it. I did an extremely simple EA that was profitable in backtesting in two certain years (I can't recall which ones). Have you done an EA?
>>41488 this dude might be the most retarded person i've ever seen lol… ah yes programming, the cultural artform of america that's functionally equivalent to calvinism… programming, an entire field of study in which all the subject matter is a mere facade, amd where, beyond syntax, there's nothing more to be known… it's not like there are overarching abstract concepts that permeate the actual syntax, like computational complexity, data structures, algorithms, and design methodologies and not to mention plain old engineering techniques that apply to software… no, none of these exist… and it's not like programming, as a form of activity, is directly corespondent to a linguistic theory about logical syntax and analysis developed by alonzo church which had implications beyond mere charlatanry in birthing programming as an activity… much like how the financial revolution, being largely theoretical and economics-concerned, birthed industrial society and all its tedious tasks that in reality aren't any different from that of programming as they share the same relation to their correspondent theoretical basis… no this can't possibly be the case it must be some cultural resurrection of calvinism…
>>41488 Agreed. Though there's a HUGE learning curve. One that most people can't get over. It's INSANELY easy to get started. There's just so many fucking mental blocks to getting there. It's fucking boring as well. This is the same with any other industry if you learn enough. It all feels like one big scam. That's 'cause people put money on a big-ass pedestal. Money doesn't mean anything other than an exchange of value. Value is measured by attention. That's why following your passions works out and people say it's "luck." Because it felt effortless.
>>41488 >The problem with programming is that there is nothing to learn.
Programming is a tool, just like a pencil. While it might take some trivial amount of time to hold a pencil, the amount of things that you can learn to express with it is infinite. Talking only about "programming" doesn't make sense after the fundamentals, it's always about what you're trying to build and express through computation. Some of that is being able to express stuff through algorithms, but most of the time it's about integrating various independent systems into a coherent whole. Yes, you're rarely building stuff from scratch (unless you want to), but I think that's a good thing because it increases people's ability to express things with less code - like using Unity to build their shitty indie game or communicating with their fridge with some javascript library. You'll unlikely be able to write an operating system from scratch but you can take various individual parts of the system and integrate into something new - which is why there's a gazillion linux distros that come out every week. The point is that the rising tide lifts all ships and using other people's solutions that were built on top of other people's solutions only creates more freedom and increases what you can express computationally (it's crazy what you can put together in a weekend).
I'd have to agree about programming jobs though, especially in big companies. Working at FAANG companies is usually every CS graduates dream job, but they are increasingly soul-crushing places because of the sheer size and number of employees. You pass their meme interview by memorizing all the interview problems on the Internet and then you join some small team, building some minuscule part of some Google's pet project website, you get your code reviewed by some Tech lead and then you go eat avocado toast before some tranny holds a meeting about notifying everyone xe changed xis pronouns again.
>>46518 More specifically the nth element of an array is located at the address of the first element + (n * size of type) with indices starting at zero (obviously).
>>54591 >an entire field of study in which all the subject matter is a mere facade, amd where, beyond syntax, there's nothing more to be known… it's not like there are overarching abstract concepts that permeate the actual syntax, like computational complexity, data structures, algorithms, and design methodologies and not to mention plain old engineering techniques that apply to software Syntax itself isn't involved in those problems. Take a series of buckets, some containing a rock and some not, sorting those rocks in the minimum number of operations doesn't involve the syntax used to express that problem. Which series of high-level syntactic constructs resolve to which series of operations is a different problem. >it's not like programming, as a form of activity, is directly corespondent to a linguistic theory about logical syntax and analysis developed by alonzo church which had implications beyond mere charlatanry in birthing programming as an activity Most people don't write in logically coherent programming languages, though. Most people write in programming languages descended from assembler macros, e.g. while loops, assignment, etc, which is just an ad-hoc and pragmatic way to get things done.
anyone have experience with ffmpeg? i can get a list of .ts files from an .m3u8 and simply concatenate them into a single .ts video, and it plays continuously perfectly fine, but jumping and skipping to different parts causes weird lags. i was thinking converting it to mp4 might help but have never used ffmpeg
>>54812 My IRC client disconnected and now I'm locked out. :/
>>54813 Those .ts files is what makes skip forward/backward possible (over a network), must have if self-hosting content! Have you tried `youtube-dl –verbose -f worst https://path/to.m8u3`? It should show the sub-commands used.
>>54826 sorry if i'm not understanding, what do you mean 'It should show the sub-commands used.'? that prints a whole lot of shit i don't understand on the screen. it does download all the ts files to mp4 correctly though
this is great and using your thing i'll probably find the command/s to just use ffmpeg to do accomplish the same. i wish i knew why simply concatenating the ts files together doesn't work but oh well
I'm going through Bjarne's PPP2 (first nine chapters so far) and I feel like I'm not putting in enough effort. I'm a pretty meticulous reader (not giving myself credit - this is mostly due to my autistic rereading of the same sentences over and over), but when I get to the drills, and especially the exercises, I completely run out of steam. The drills and review questions I can somewhat put up with, but when it comes to the exercises and just general code writing I feel such a sense of lethargy. Trying to formulize solutions to the problems is very taxing on my motivation, and I just feel like doing something else.
And that's my problem. I can follow along and grasp most of the material so far, but for that material that isn't as intuitive to grasp, and for any degree of mastery of the material you ultimately have to put in the work and write some code. Shouldn't that be the fun part? Why am I so dismayed by the idea of analyzing problems, designing and implementing solutions, troubleshooting and debugging, etc? Isn't that the whole point of programming? I really feel like I shouldn't continue with the book if I don't seriously up the amount of coding I do. But I'm just so lazy.
It is apparent to me that I have no passion for programming. It's been apparent for quite a while. Even so, in a month i'm starting university for a software engineering degree. I feel bad when I think about programmers like John Carmack because I realize that even without the expectation of reaching his skill level, I fundamentally don't have the proper mindset for being a programmer. I just don't care enough about solving problems.
>>54829 have you only tried c++? i did some online courses for my brother and had to use that and i wanted to kill myself. people say languages don't matter and syntax doesn't matter and blah blah i say bullshit, it feels so much more enjoyable in certain languages to me
>>54829 >>54830 I've wanted to learn C++ (instead of plain C) for awhile but could never sit down and get into it… Actually I learned plain C from old lecture notes found on the internet.
>>54829 Same thing happens to me, though in math/physics books. I've started to think it's a bit pointless to have a bunch of excercises after each chapter. It's like a little wall that kills motivation. Some books place small excercises interspersed with the main text. But I do see the point, at least in mathematics, to have excercises. Only the drills are annoying and unmotivating. But I think the reason is that we either fear failure, or simply hate to break continuity. I like to think that reading about programming is because one has some project in mind. I think that's a good motivator. To carry the process of writing whatever application one has in mind, at least in your head (and on paper!), instead of doing some silly tax recording drill that serves no purpose. In the end the thing to do is to just sit down and do the thing, once you've decided that it is necessary to do it. On the other hand you could skip most excercises, and get the whole info in your head at once, then keep the book as a reference and start programming something that actually interests you. Or just read the excercises, pick one that looks challenging enough, and try to implement it, if you fail at some point nevermind, just look up the info you just read (it's easy to not see the connection right away). Honestly a lot of that shit you learn is overkill, why have to do a bunch of excercises for learning all the different datatypes if you haven't even gotten to control structures? Do as thou willt shall be the whole of the law. But yeah you should devote some 30 minuted to do some actual coding. This is what I always do: write the outline first:
#include <stdio.h>
/*I'm using C btw*/
/*Program: prime number sieve*/
int main(int argc, char** argc) {
/*check for args*/
int sieve[1000];
/*for each number, check if prime*/
for (int i=2; i++, /*???*/) {
/*???*/
}
/*print sieve*/
return 0;
}
Just translating to C-syntax my thought process as I start outlining what the steps are and then fill in the missing parts. even doing the int main() {return 0;} alone provides a starter. Hope it helps.
>>54813 >anyone have experience with ffmpeg? i can get a list of .ts files from an .m3u8 and simply concatenate them into a single .ts video, and it plays continuously perfectly fine, but jumping and skipping to different parts causes weird lag The most likely problem is the timestamp doesn't match the video or audio streams. There are a few options for recalculating this in ffmpeg which I've thrown together:
It's also worth trying -vsync drop, as according to the docs "as passthrough but destroys all timestamps, making the muxer generate fresh timestamps based on frame-rate" and if the video has a variable framerate you can impose one with -r 30.
>>54826 >>54812 >>54789 >>54733 >>54731 >>54729 If the IRC isnt working, we could use Mumble instead. I really dont want to just give up on IRC though. Lets get either the irc or mumble up and running so we can actually work on a project or something. Maybe github could work too?
>>54907 https://web.eecs.utk.edu/~huangj/cs360/index.html >To become good general-purpose C programmers >To become decent Unix hackers >To become well-versed in the language of systems programming >To understand basic uniprocessor organization
[note: the /2006sp/ can be changed to 2004-2008 and either "sp" or "fa" after. Very basic course but may need to ask for help.]
At a higher level read the book "Expert C Programming. Deep C Secrets" by Peter Van der Linden (1994).
That is the book with a blue fish on orange cover. Yes, 1994 was before C99 standard… Yes, the book is out of print… Yes, the copyright is still in effect… If you can aquire a copy it is a good book!
The cs360 course will need just a little familiarity with UNIX. All this stuff is old, become a Unix Gray Beard today!
>>54912 That's not a jank shell because it has bloated features like handling signals and shell redirection. What next, handling backspace correctly? >What about two weeks per chapter? There are no public homeworks just the labs, we will have to come up with suitable exercises. I've been doing systems and embedded stuff for coming up to a decade, so the course wouldn't be much use for me. We could collab on the exercises though.
I would like to make a Scheme interpreter in C. Sounds easy, right? Well I have no idea where to start. I do know there's an online book about just that, I did start it once but put plainly it is shit. Does anyone know a serious resource that actually goes into some level of detail on how to go about this? The book I mentioned (BYOL) it all does it for you, leaving you right where you started. I was thinking a book about interpreters (rather than compilers) and the theory behind writing one. GC, parsing, executing code (bytecode? JIT?) , etc. Thank you!
>>54973 Most books about implementing lisp-like languages tend to focus on scheme actually. That includes "Lisp in Small Pieces" (LiSP). Some of those books are also out of print…
trying to learn gpt2 so i can play around with it. python still needs regex installed, apparently it requires a fucking 5GB windows sdk install of visual studio c++ build tools. are you absolutely shitting me? regex in other languages is built in. how the fuck is this possible. fucking python lmao
>>54986 nvm, it's only like 1.5GB, the rest isn't necessary i think. but still, a python module requiring this… why can't they just use PCRE or something
Then, see if you can transform a stream of tokens from stdin like (a b c) into a list structure. eval will traverse your list expression and the environment list to look for special forms to apply.
With an environment containing
cons(symbol("+"), cons(add, NULL))
the special form in eval
if (op) return apply_op(op, evlist(cdr(e), env));
will apply the function pointer add to the rest of the evaluated arguments in expression e. >I was thinking a book about interpreters (rather than compilers) and the theory behind writing one. GC, parsing, executing code (bytecode? JIT?) The difference between interpretation and compilation is a matter of degree. Nearly all languages are first tokenised and hierarchically structured into trees (lists) before being transformed further. In Lisp there's no difference between your program and that structure.
>>41214 Can someone link me to a good webhosting guide? I'm getting cucked by cpanel, it has denied my entry into my directory and i cant even change file names wtf
>>54998 I don't think you know what that word means…
Whatever, cPanel should have something called the "File Manager". It might be possible your version and/or configuration looks different than others. It might be possible there are bad permissions on home directory.
New special forms CAN BE implemented using macros. Minilisp uses "fexpr" style macros (a historical but obsolete kind of macro system) but uses them to implement `let` forms and `progn` forms etc. in example programs.
Or add new features via C code, you don't need to fully understand the garbage collector if just imitate preexisting functions as examples.
For example, an ADD (+) already exist but not MUL (*). Copy & paste the ADD function, rename it to MUL, modify the code to multiply instead of add keep the other stuff the same!
Don't forget to add a call to `add_primitive()` inside `define_primitives()`.
Minilisp doesn't have keywords like `&key` or `&rest` but a function's arguement list can be declared with a dotted pair (function will see that last arg as either nil or a list). It isn't standard but is pretty nifty!
made a skew correction thing for images containing text today. it just uses imagemagick to median filter > canny edge detection > hough line transform. then you can just look at the line data, the angles and so on, to determine which angle is the strongest and apply a rotation based on that
because it's not actually looking at the text, if the image's text is more upside down then normal, the result will stay upside down. to figure if it needs flipped or not i think is just a matter of passing it to tesseract and seeing which version contains more text
>>54973 It's not in C, but one of the projects of Berkeley's CS61A course is to implement a scheme interpreter in Python. They give you the skeleton code for lexing into tokens, but other than that most of the meat regarding environment lookups, lexical scoping, and eval/apply metacircularity is implemented by you. This might be worth going through. https://inst.eecs.berkeley.edu/~cs61a/fa18/proj/scheme/
>>55013 That Lisp is written in a clunky way (the environment and primitives could be defined together without registering functions) but it's pretty comfy to use. The print function in particular is clearer than mine. >Minilisp doesn't have keywords like `&key` or `&rest` but a function's arguement list can be declared with a dotted pair (function will see that last arg as either nil or a list). It isn't standard but is pretty nifty! The dot notation for variadic argument lists is the old skool Scheme 1 way. Apparently in Maclisp &rest wasn't necessarily standard at first, so it may be older.
>>55014 That program would have been handy when I was manually aligning scans for a short booklet. Nice work wiz.
>>55032 >That program would have been handy when I was manually aligning scans for a short booklet. Nice work wiz. that's kind of why i made it. i have spent years doing image processing stuff for fun with image editors, doing each step manually at a time. after learning to program, the manual labor from before feels like a big waste of time since you can just make your computer do it for you. here's something else that's kind of related i'm working on for grabbing paper from photos
>>54829 >>54830 >>54831 I tried PPaP when I was just starting out and Bjarne is honestly a bad teacher. Brilliant computer scientist. Bad teacher. His choice of where to start out, what to focus on, etc… they were bad. Unengaging, and focusing on the wrong stuff, and dumping too much info on you too fast.
So instead I went over to Deitel & Deitel C++ and worked through that for a while, and it actually explained a lot of the basics that Bjarne had glossed over, as well as offering more interesting exercises, once I'd gotten those basics down I switched back to PPaP and it was a lot easier to work through.
>>55100 >You gave that minilisp a try too, cool! I used it for a few minutes before stealing the print function. I find the rest of the program pretty ugly tbh. >I couldn't implement (cond <clause-list>) by using macros… A cond is just a series of ifs whose elses are ifs. (cond (a 1) (b 2)) is the same as (if a 1 (if b 2)), therefore you can accumulate the ifs by walking down the arguments passed to cond. In theory you could implement this (or anything else without side effects) just using lambda.
(defmacro cond (a . b)
(defun make-cond (e)
(if e (list 'if (car (car e)) (car (cdr (car e)))
(make-cond (cdr e)))))
(make-cond (cons a b)))
>>55109 That helper function is lexically scoped and reduces complicated quoting somewhat… Helper functions don't need to be anonymous lambdas. Nice trick!
tried making a shape classifier that just looks at outlines as a 2d waveform and turns that into a 1d barcode type of thing. there is too much info being lost converting it to 1d, but for very distinct shapes it does work. it doesn't work well for round things though, it can't even identify a circle for example lol. you can see the scribbles i converted into distinct datasets on the right side, and on the left which dataset it thinks the input image is most similar to
>how do i split a dynamic array into 4 equal parts for threading >spend an hour messing with quotient and remainder of length of divided array for an arithmetic solution >just split the array twice
any binaries for a self contained machine learning system that i can use? something that just fucking works out of the box. i cant fix python dependency hell trying to set up gpt2, trabsformer, pytorch, etc and similar shit, everything is outdated, missing files, incomplete, undocumented. i dont care if it's inefficient or old as long as it works. how is there not a market for this
>>56072 Docker is meant to solve problems like that. I used one recently, but I don't remember the author/name. Have you tried https://github.com/anibali/docker-pytorch? It was high in the search results that I found. I've never had a problem pip installing pytorch on a fresh pyenv, though, with or without a gpu on the system. Not recently, at least; I remember a while back having a hell of a time doing all the bootstrapping and such for tensorflow, but maybe that's better now.
>>56112 yeah i didnt say tensorflow but thinking back that wasnt good either. ive never used docker, though ive heard and read things mentioning docker containers for years. i guess it's something worth checking out, i have all tomorrow i can fiddle around. thanks
>>56072 Have you tried Darknet? It's written in C and fully open source. Conspiracy time: AI is written in shitlangs and kept in dependency hell and hidden behind 500 arcane libraries to ensure independent devs never produce a new competitive AI algorithm(not training, just the algorithm)
Learning about search algorithms. Implemented binary search to help understand it.
(defparameter *xampl* (loop for i from 0 to 980 by 20
collect i))
(defun bin-search (ls x)
(loop for i from 0 to (log (length ls) 2)
with l = 0
with r = (1- (length ls))
with m = 0
initially ;;(format t "~a~C" ls #\newline)
(format t "~a indices to search. log₂(~a) = ~F max divisions to reach it.~C" (length ls) (length ls) (log (length ls) 2) #\newline)
when (> l r)
return (format t "~a divisions and ~a not found." (1- i) x)
do (setf m (floor (+ l r) 2))
do (format t "Index ~a: ~a~C" m (nth m ls) #\newline)
;;(format t "L: ~a R: ~a~C~C" l r #\newline #\newline)
when (< (nth m ls) x)
do (setf l (1+ m))
when (> (nth m ls) x)
do (setf r (1- m))
when (= (nth m ls) x)
return (format t "~a divisions to reach index ~a: ~a" i m (nth m ls))
finally (format t "~a divisions and ~a not found." (1- i) x)))
Someone please help me I can't figure out how this part works in Stroustrup's calculator source code from PPP(Programming Principles and Practices using C++.pdf). How does the putback function "operate" on the cin stream? Thanks.