|
The Dark Wind posted:Recursion is cool. I haven't seen it in anything at my job yet, but I remember during my bootcamp I ended up using it for a few things, such as rendering nested comments. Also if you believe everyone who says functional programming is the future, then in functional languages (like Elixir, for example), you'll often see tons of recursion as alternatives to loops. Recursion is not cool. It is most often than not (depending on your compiler or JIT) a waste of cpu cycles and stack space. Usually (not always) an iterative algorithm can solve the same problem faster and cheaper. However, recursion is trivial to reason about, nice to look at and read. And sometimes, the iterative algorithm does not provide such gains to justify for the increase in complexity. Use recursion with care.
|
# ¿ Dec 20, 2017 19:45 |
|
|
# ¿ May 18, 2024 08:56 |
|
Dominoes posted:I dunno; 'git init', 'git add .', 'git clone https://github.com/...' , and 'git commit -am "updated things"' are the only commands I'm familiar with. add git pull to the list and you're a git master. nothing to worry about anymore.
|
# ¿ Dec 24, 2017 00:19 |
|
Grump posted:okay cool. Looks like this was the problem: Didn't you already do that by setting the SSL verify to 0?
|
# ¿ Dec 27, 2017 23:40 |
|
Those people were selling their bots. I think the rules are quite more relaxed if you use it just for yourself from a legal point of view. But I wouldn't try it though.
|
# ¿ Jan 6, 2018 07:08 |
|
Google's Protobuf, how I love thee. Let's assume that I have a message like this (proto3): code:
code:
Is there a way to validate the type of message that's being sent over the wire? Does protobuf have any kind of metadata around the messages that it sends and receives? How does it protect against the client lying, something like: "the repeated message will contain 100 Foos, but I'm only sending 10"? Also, how come that the C++ API does not have "ParseDelimited..." and "WriteDelimited...". They can be added, but is quite a hassle.
|
# ¿ Jan 20, 2018 17:16 |
|
TooMuchAbstraction posted:Then your code would get handed a binary blob, you would tell the library "here, try to turn this blob into a Bar", and it would either say "here you go" or "nope, that's not a Bar", and in the latter case you return an error to the client. That's exactly what I expected as well. But the protobuf library, when told to "make a Bar out of this blob of bytes" it made a Bar even if it had a Foo. It did fail when I sent a blob of bytes all 0x01, or completely random. That was invalid blob. But if I sent a Foo or even half a Foo (I just cut the blob of bytes in half) it worked . And then I had to step in and say: In order for Bar to be valid it has to have at least one Foo. TooMuchAbstraction posted:So far as I'm aware, you can't have a single method that takes either a Foo or a Bar. Certainly even if it's possible I don't think it's a thing you should do. There should be one correct way to use your library. I am not using gRPC at the moment, it is just simply reading the stream of bytes from the network. I agree that there should only be one correct way to use it, I just want to change that way (deprecate the old way) and not inconvenience the 3 people that are still using the old way, not for a while at least. I should have had the Bar message from the start, but is too late now.
|
# ¿ Jan 20, 2018 17:47 |
|
nielsm posted:What if you add an int32 version field to the start of Bar, would it then still eat a single Foo buffer? If I do that then it fails as expected. But, looking at the exception thrown, it fails when it reads the string of the Foo, since it is no longer a valid UTF8 starting from that byte. Hmm, it seems that the library (at least the Java one) it does its best to provide an object from whatever it has been given. If two messages are close enough in structure, on the receiving end you may not be any wiser of what you have been sent. I guess it does make sense, but I am surprised to be honest. I would have thought there must have been some metadata around the message, something that if I send a Foo when I expect a Bar (even if Foo and Bar have an identical structure) the library would yell at me. But yes, at scale, all those extra bytes would add up. Oh well, lesson learned.
|
# ¿ Jan 20, 2018 18:58 |
|
Hmm, that could work. To be honest though, rather than doing that, for my case and my usage so far, I'd rather inconvenience those 3 users. The Bar message would look ugly and scream "Bad decisions were made, now we live with regrets". Declaring that a Bar is invalid when there are no Foos present is enough for me right now, as it makes sense from a business logic point as well. And when a single Foo is sent, then there are no Foos in the Bar. Would gRPC solve this problem better? I've never used it (and I believe there aren't C embedded libraries for it, but i could be wrong there), but could one declare something like: code:
code:
|
# ¿ Jan 21, 2018 01:20 |
|
Jabor posted:Worth noting that it wouldn't necessarily be a long-term thing - after enough time that you expect all clients to have updated (and/or you're willing to stop supporting the ones that haven't), you delete the backcompat logic and change the definition to: Yes, that's good advice, thanks, I'll keep that in mind. While I do not control all the code that calls this API, and I wanted to not inconvenience those few clients ... theyr'e very few clients and they know they're testing my API (beta and all that) so I just may start fresh and tell them to change their stuff. 2 developers are chinese and one is indian, I have no idea how they're gonna react, but I can tell the business guy to just make it work.
|
# ¿ Jan 21, 2018 01:41 |
|
TooMuchAbstraction posted:That was my original suggestion: make a new API method with the desired signature, and delete the old method once people have had sufficient time to switch over. No, I am not using gRPC. One of the reasons is because I had to write an implementation in FreeRTOS on an ARC board using both lwip and bluetooth as communication mechanisms, and while looking around it didn't seem that gRPC and nanopb were working together. So, I abandoned the idea completely and I just read the message directly now. The https://github.com/nanopb/nanopb/pull/248 pull though does gives me hope of this being implemented in the future, at which point (with a different endpoint than now, of course) i can probably provide a gRPC server.
|
# ¿ Jan 21, 2018 05:42 |
|
downout posted:I can't help you but your av is pretty sweet. First time I've heard about form.io. Looking at their page ... what is it exactly that they're providing here? A form designer? They call it "application"? Whose application? Where is it hosted? Where's the database? Who sees the data? How ... what? It looks extremely confusing.
|
# ¿ Jan 27, 2018 06:43 |
|
TooMuchAbstraction posted:I'm using an HTML canvas with a Javascript script for visualization of the output of a procedural map generator. However, for some reason I only can have one map in a given file. Can anyone tell me why this HTML doesn't draw anything on the second canvas? This: code:
code:
|
# ¿ Feb 2, 2018 17:14 |
|
Acidian posted:I need to do some work on updating a book database, and instead of using an external developer (expensive), I might try and do it myself. If you already have the book data in a database (I assume a relational database? MySQL or something similar?), why bother exporting it to Excel? Work with the database directly. Then you can use whatever language you're comfortable with (if none, python would be a decent start for a beginner). If you absolutely have to use Excel, then I would think that you pretty much have to use Excel's VBA. There are libraries out there that can manipulate Excel sheets (Apache POI for Java for example), but for a beginner VBA is probably the easiest way.
|
# ¿ Feb 12, 2018 15:47 |
|
Acidian posted:The data is currently in a SQL database, but I do not have access to it directly. I have to export it to excel, then I can import again via excel. I can double check with the company maintaining the server. Anyway, we will be changing system in a couple of months, and I think I will have access to the SQL database directly in the new system (if I ask for it). However, I do not want to wait until it is in place before I start this work. Is VBA very similar to basic/visual basic? Oh, so if you want to learn a programming language to use after this particular endeavor, then VBA is probably not what you want. Like pokeyman said, python can manipulate Excel files and in Java there is the excellent Apache POI library. Pick your poison.
|
# ¿ Feb 12, 2018 17:23 |
|
Dominoes posted:Hey dudS. Learning C. For context, I'm fluent N Python, A modern JS. A keyboard.
|
# ¿ Feb 23, 2018 14:56 |
|
ufarn posted:I have file.txt: Volguus fucked around with this message at 18:55 on Mar 12, 2018 |
# ¿ Mar 12, 2018 18:51 |
|
TheCoach posted:Sadly all we have here are PHP and javascript folks so this might prove problematic. Whenever I hear an X language developer saying that "I can't program in Y, I am an X developer" I feel like punching them in the face. In reality, I just fire their rear end. It is perfectly acceptable to say: "Y language sucks donkey balls, I don't like it", but to refuse to work in it for 5 minutes, that's not acceptable. And C# is not set in stone, was just suggested because it is easy. VB would work too (and just as easy). Or, go with plain old win32 apis.
|
# ¿ Mar 14, 2018 14:15 |
|
nielsm posted:When you're targeting a receipt printer you don't want to make PDF files anyway, they usually take some text-based format with escape codes for formatting, barcodes, and graphics. You mean postscript? Not all printers know PS, but there's a fair amount of them that do.
|
# ¿ Mar 14, 2018 16:55 |
|
Bob Morales posted:ZPL is a common one Are there printers other than the Zebra ones that know ZPL?
|
# ¿ Mar 14, 2018 22:03 |
|
Here is a SOCKS proxy that i wrote back in 1999 or 2000 or so that i found on my harddrive (yea, my /home folder is that old). As you can see, nothing much to it, just passing bytes around and interpreting them according to the spec.
|
# ¿ Mar 17, 2018 19:20 |
|
KernelSlanders posted:Is there a coherent definition of "real time" systems or programming? Back when I did robotics, we thought about dedicated OS feature and guaranteed task execution times, but now I hear the term thrown around to describe REST services. Should I just stop thinking of "real time" as meaning real time? That is the definition that I was familiar with as well: guaranteed task execution time. Lately people just mean: display the data as soon as is available (different values of "soon" are acceptable).
|
# ¿ Apr 9, 2018 03:29 |
|
JawKnee posted:The code is at my work and I'm at home, so I don't have anything I can copy-paste for you, my apologies. It's a new job and I'm not terribly familiar with most of the technologies being used - C#, SQL, LINQ, typescript, JQuery, and others that I'm forgetting. That looks like old asp and jsp pages.
|
# ¿ Apr 27, 2018 12:17 |
|
Munkeymon posted:ASP only uses @s in the directives you'd see at the top of the file, so I understand why you'd get that impression: you open the file, recognize it's ASP and close it immediately without looking at the rest because that's the rational thing to do. It uses <% and %> for open/close tags (and I think maybe optionally <? and ?> because they were competing mainly with PHP when they made the spec). Source: I maintain ASP at current job Right, but there doesn't seem to be a difference between this @{} and <% %> (in either asp or jsp). Is the same hat just a different color.
|
# ¿ Apr 27, 2018 13:39 |
|
AFashionableHat posted:I'm almost inclined to point out that you are talking out your rear end. Preact is under 5KB gzipped. Even React and Redux, together, are under 35KB gzipped--so, yanno, you're only four orders of magnitude off. The entire JS bundle for my current project, talking to two external services and pulling in about a dozen dependencies of various types, is 105KB gzipped--which, given HSPA speeds, is a reasonable first-visit download for our target clients on HSPA or better. I'm also inclined to point out that you are talking out of your rear end too. React - our god and savior - rear end.
|
# ¿ May 31, 2018 00:56 |
|
baby puzzle posted:Hi I'm stupid and I want to create a build process that does things. I had implemented this with gnu make a while ago, but the makefile is now impenetrable to me, and it also just randomly doesn't work. It is not something I can maintain. CMD bat files can do all of that just fine. I can guarantee that they will not be more reliable or more "penetrable after 6 months" to you either. But, at least is not "unix tools".
|
# ¿ Jun 2, 2018 05:12 |
|
tricksnake posted:Best/popular coding practice websites/games/apps? OK I have learned C++. Next I get bombarded with "just go code stuff" from every person I ask. Open up an IDE and write code. Why do you need a website for that?
|
# ¿ Jun 29, 2018 01:48 |
|
Munkeymon posted:Yes but have you considered that it's the cheapest RDBMS option on AWS?! Not only that, but MySQL is easy to get started with. At the end of the day 99.999% of the applications out there that use MySQL never hit those problems. Because they will never have that much amount of data. For them, LAMP was the best thing since slice bread. Sure, it is an awful stack, awful language, awful database, but hey, they did their thing, it worked (at least in demo), got their paycheck and went happily on their way. 10 years later they call you, the expert, to come and unfuck their poo poo since now they got a ton of records and the DB keeps missing data and the reports take 1 day to generate. But that's fine, since the peanuts they paid for that simple CRUD app was more than worth it and it probably save/made their company millions of $.
|
# ¿ Jul 11, 2018 16:45 |
|
Thermopyle posted:Is MySQL easier to get started with than Postgres? Yes when the only tutorial you've read only mentions MySQL. Odds are you don't even know PostgreSQL even exists. Maybe heard of Oracle, but that's it.
|
# ¿ Jul 11, 2018 19:10 |
|
The Fool posted:You need better tutorials We're talking here about the new graduate or that accountant that happens to know a bit of programming and that whipped together that little app for their company. We're talking about done on the cheap. Hell, you're lucky that they actually read a tutorial and didn't just dive in applying hearsay knowledge they had. "Better tutorials" only applies to someone given the time and who has the interest to learn more. Usually is a miracle that whatever they make actually works.
|
# ¿ Jul 11, 2018 21:05 |
|
rt4 posted:What strategies are people using for high availability Postgres? I haven't seen anything as convenient as MySQL with Galera. I just tell AWS to do it for me.
|
# ¿ Jul 12, 2018 18:11 |
|
edmund745 posted:I had read in the past that if the program has a GUI, then that program's GUI thread may occasionally get skipped in the OS's task list if it does not have focus on the desktop. I doubt that the linux kernel has a way of checking if a program has a UI. In windows, the UI is part of the kernel (well, they took it out somewhat, still heavily embedded within the system) so I can see it happening there. Additionally, windows programs can be marked as console or windows (UI) , so that definitely helps . ELF binaries don't have that flag as far as I'm aware.
|
# ¿ Aug 20, 2018 13:32 |
|
Thermopyle posted:Are any of the books in this machine learning humble bundle good enough to justify buying the bundle? While I do not know the books themselves how good or bad they are, the subjects though are definitely worth $15. For this money I wouldn't even blink given what information is offered.
|
# ¿ Aug 29, 2018 22:10 |
|
Magnetic North posted:Hungarian notation NO
|
# ¿ Aug 31, 2018 02:16 |
|
huhu posted:If I were you, I'd stop watching a course recommending outdated tools. I doubt that the recommended tools have anything to do with anything here. He's trying to learn about ML and a big part of it is understanding the math behind it. Octave works perfectly fine. Yes, python comes nowadays with very powerful ML and math libraries, and he will need to work with them in the future, but the math is still the same. Whether you're doing it on paper, in Octave, Mathematica or python is irrelevant. Now, if the math presented in the course is bad/wrong/irrelevant that's a different issue. If I were you, I'd stop giving lovely advice.
|
# ¿ Sep 19, 2018 15:02 |
|
Helicity posted:git is a DAG. directed acyclic graph. The whole point is to always move forward. No, rewriting git history is not a common thing, normally. There was (still is?), however, a fad going on that advocates doing exactly that on a daily basis. That is, the workflow comes and says: instead of using git properly (you know, create branches for the poo poo you're working on, make sure you're alone in said branch), how about you do your work-in-progress commits (the little ones, that we do all the time) in a "main enough" branch that everyone is working on, and when you're done, just rewrite history (push --force) to make the git history look nicer. And oh, here's how you deal with the inevitable shitstorm that will happen once you obliterate your coworker's work. It's hosed up, but it exists. On this very forum i saw people advocating that.
|
# ¿ Sep 20, 2018 14:17 |
|
Plorkyeran posted:I've literally never seen anyone advocate this, so I'm pretty sure you're just misunderstanding people talking about doing WIP commits on a personal branch that you then rewrite into something sensible before mixing it with other peoples' code. It may be the case, if everyone is saying this then that must be it. Still, in a world that has merge --squash rewriting history is never needed. While is true that on a private, only you work on it, branch anything goes, why would you have one workflow in one instance and another workflow when working with other people when is trivially easy to just merge -squash and not carry the WIP baggage with you?
|
# ¿ Sep 20, 2018 20:33 |
|
Plorkyeran posted:A PR may have multiple things that should remain distinct commits when merged, but there really isn't any value to preserving "oops fixed a typo" commit. Perfect, then you merge --squash from multiple branches. you can go as deep as you want in this rabbit hole. The only time I had to use push --force was when Helicity posted:The downside to that approach is getting in the habit of force pushing on your feature branches all the time - the last two times I've had to rewrite git history is from people accidentally force pushing on master when trying to do the above workflow and just whipping through commands too quickly. Life is complicated enough, without additional help. Why make it hard when it can be easy? Why have a headache when I can sleep soundly? Why give myself work to do when I could be playing a game? Or work on poo poo that actually is important?
|
# ¿ Sep 21, 2018 00:12 |
|
Plorkyeran posted:Why would I assemble several different branches when I can just have several commits on one branch? Because branches are cheap in git and because you can't use --force because the powers that be (who know their poo poo) disabled such heresies.
|
# ¿ Sep 21, 2018 00:23 |
|
Plorkyeran posted:Nah, I think I'll continue to use git features rather than jumping through dumb hoops to achieve the same thing. push --force is the nuclear option. Sure, it's nice to have it when poo poo hits the fan, required even, but just like the nuclear red button that US presidents have, exercise caution when using it. Preferably, never touch it. Use the better suited features for your goal.
|
# ¿ Sep 21, 2018 01:22 |
|
|
# ¿ May 18, 2024 08:56 |
|
pokeyman posted:git is hard to use and even more confusing to talk about. Exactly. And what's even more baffling, is that there are few simple rules that one should follow to not shoot oneself in the foot and make life simple and easy for everyone (including himself). And then there are still those that come and say: naah, i'll keep shooting, since not once in the last X years i blew my foot off. Which is technically correct i guess.
|
# ¿ Sep 21, 2018 04:05 |