Jump to content

DevBlox

Member
  • Posts

    251
  • Joined

  • Last visited

Everything posted by DevBlox

  1. They might, it really depends on what you want to do with them. There's just really no need to make producers if other services can just write to the bus directly, one less part to fail that basically just receives a request, and pushes to the bus - that's basically nothing. As for logging, that doesn't need to be scattered, it would just be a pain to work with. I'd just set up an Elasticsearch cluster of whatever size I need, and centralise logs there. I remembered a nice talk about all of this, might be interesting to you. It's specifically Go related, but has some nice displays of how microservices can work.
  2. Maybe just one more service. I'd maybe do it like so: Transaction Log API - just an api that pulls things from the database on request. Transaction Consumer (or well, Monitor) - consumes the messages in the bus, and puts them in the Transaction Log DB. It could also then produce some other event for another service that a certain message is already processed and in database. Letting the push notification service to know for example, so it, in it's own right, would see that and, would let the user know that processing is complete. No separate Producer. The Webapp and API (and whatever else ever needs to produce them) would produce the events to the event bus directly for the Consumer to process and put into the DB. This way if the API is down, messages are still being produced and consumed, still get written to database. Same if the consumer is down, you can still read the database even though it is not updated at the moment. If they would be all one service and it would be down, you're in trouble. It's unlikely that the event bus will be down, usually it's a large distributed service, plenty of failover. By flat I mean the Webapp and API gateway are no more than 1 hop away from where the actual data they're requesting is (ignoring the connection between the database and it's api), that's good, it would definitely be pretty snappy. You want to avoid dependency hell in micro-services, that causes a lot of latency and sluggish operation. Having 2 hops would be ok with some services, but that would already be significantly slower, because that middle service would probably be calling another 2 or 3 to complete it's own response. Might be acceptable for some services, but not others. EDIT: Should mention that the layout i suggest means the user should not expect an immediate response with the result from that service. If the Webapp is only producing the message, it will be processed eventually. Might be less than a second, might be minutes or hours in a serious downtime. If you want an immediate response, the situation would probably be a little different.
  3. Pretty good attempt, it's nice that you've kept a flat layout. I wouldn't be confident about some databases/apis (those are db/api combos right?) that both produce and consume event bus messages. Consumers and Producers are better off as separate services (it wouldn't really make sense if they're consuming their own messages and performing api duties), leaving databases with pure api services. That's as much as I can infer from the picture, since there is no other info on what data is written where. Knowing that might uncover some issues.
  4. 300ms seems to a be a bit much for an empty request ?. Another thing you can try, is using pm2 and spawning more processes, to handle more requests, since JS is single threaded, you might have a bit of an edge.
  5. http://www.asciitable.com If you know you are going to be comparing char's with numbers, the ASCII table has a useful feature. If you add 48 to the integer, you will get the ASCII value of the single digit character you're trying to compare to. One of the techniques from my assembly skills. Case in point. You have an int = 1 (raw 1), and a char = 1 (ascii 1). int + 48 = 1 (ascii). There must be a more Java way of doing this that I don't remember. Also, this trick will only work with single digits (obviously), you need more techniques to compare multi digit numbers manually ?.
  6. Usefulness is debatable (lol). But I've written a naive multi-core prime number generator as an exercise.
  7. Reading this I figured I'd write a naive multi-threaded one with Go as an exercise for channels, because well, eh, why not. Thought it's pretty nice how easy it is to make all cores work. Since it uses channels, it can't accommodate a proper solution, you'd need a shared memory prime number collection with locks, too lazy for that shiz. Though, it can work on any interval you choose.
  8. Usually this happens when the file was changed on master and on the child, then an attempted merge. Could be that some silly change, like a space automatically removed, that snuck in to a commit on master (tends to happen if you use git add --all regularly), that child is not basing itself on. Now that the merge conflict is active you are in merging mode. Two ways to fix it right now: Just solve the conflict and finish the merge. Remove the symbols (it shows you two possible options, local and incoming, you get to choose what you want), leave the changes you want to be in final merge, save. Then git add the file and git commit, you'll then have a merge commit, you're done. If you don't want that on the master branch (some people/teams don't like having unclean merges in master, it is dangerous sometimes), abort the merge with git merge --abort. Then you checkout your child branch, and merge master into the child branch, this will merge the changes that child is not based on. Likely will cause a conflict, since your commits are there already. Solve it like the other case, get that merge commit. Then you will be able to do a clean merge to master.
  9. Okay, a few things for improvement: You should improve your formatting. Code has to be easily readable. You can make out the flow of a program by well intended blocks, it's lacking that now. Why gameWon is not a bool? You use it as a bool, but it's not a bool. Too many if statements. You actually need maybe just three + plus a while loop. Now you've got 11 (and a while loop). Consequently you have 12 control flow cases. For such a simple program that's enormous. EDIT: You manage to use System.out.println 9 times in this, way too much for this. Code duplication. Some if statements are exactly the same. In the same block. Execute right after each other.
  10. Fundamentals! You'll probably use whatever you need to and whatever you're researching in security. If you're learning Java, don't drop it just because it might not be perfect for your field. But don't stick to it stubbornly either, learn how other things/languages work. You'll be more comfortable with everything else after you've gotten the fundamentals.
  11. Can't advise on certs, but for languages Python is sure one of those I'd use for security. Just because it's easy to write up little scripts that do stuff on the web, exploits etc and has enormous support and library options to ease life. Then when it comes to OS security, you almost have to know C, if that's the route you're going, you'd need to be very proficient with it. Javascript, because everything on web is Javascript these days. One more thing. Not really a language per se, but a framework for exploits. It's Ruby based, so you might want that too. I'm not too sure about using other languages with it. Edit: dummy me didn't list what it was - Metasploit
  12. You need to take a little step back. You can't easily understand polymorphism until you understand the importance of having a certain interface (a sort of "point of contact"). You want the same logic to be able to operate on as much types of data as you can, for it to be extendable. Because you want to have that code work and serve a long time. So you don't want to change it if you don't really have to. With some C# terms: Base classes (or interfaces) provide "contact points" for interacting with classes that extend/implement them via the methods that are overriden/implemented. Polymorphism allows classes to extend/implement base properties of multiple classes/interfaces as needed, though which the class may be interacted with and used as. Such as having Male and Female classes that Extend a Human class. They can both be used as the Human class. Male and Female may also implement an interface IRun (that describes a method Run), or whatever (Male and Female could then be used as IRun somewhere where logic is implemented with IRun in mind). Think multiple types of "point of contact" on the same class. So you can have logic that makes the IRun "Run", and you want a Human to be able to run, or a Male and/or Female separately. If any of them implement IRun, they can then be given to that logic as IRun, to be interacted with as IRun, even though they may have completely different implementations of doing so. Same stands for the Human class. Male and Female can be interacted with as Humans in a logic that is written for Humans. That's the basics which you need to understand, there's still more to C#, generics namely, that require this to be properly understood. This is about as simple of an explanation on this as I can manage without writing an article, of which there already are many, so do what you will with this .
  13. You're not going to change the buffer size afterwards. You can slice it and get the length of the slice. Like so len(buf[:n]) The way you are doing it now is correct and good enough IMO, you don't need to do much more, well, depends on what you're trying to do. I'd also encourage using io.Copy(dst, src) whenever possible. It can do the entire "actual copying the file" in one line. Again, might not be what you need or want, just saying just in case you don't know this function. EDIT: Probably should mention that when you slice the buffer you get a subset of that same buffer, laid out on the same memory. Basically, use properties of slices.
  14. There is a GUI resource editor called Glade. You make your UI, then with GTK (or in this case GTK#) load that resource. It's somewhat more manual than WinForms, but it works. You'll have a nice and quick GUI. I know for sure GTK# works with Mono, not sure about .NET Core, you'll have to find out yourself.
  15. You can do work on it proper. It's not an ideal platform for development specifically though.
  16. A programming language that isn't Turing Complete would be completely useless, therefore things like that are not really programming languages. It's a markup language, ir represents what you see in your browser, not a programming language.
  17. If I was you I'd just spin up a docker container with nginx and have them served to me. Only other way is to make the browser shut up, by disabling CORS, which I'm not sure if it's possible anymore. That's an extremely naughty (insecure) thing to do after all.
  18. If you're cutting out .NET framework - no C# for you! You could use Mono, but you'll need to find another GUI library/framework to work with, so that you could vendor it with no explicit install for the user (GTK# would work). You can embed Mono into your executables, so you wouldn't need an install here either. If choosing C++: you said that you have C# knowledge, so you'd have to learn C++ along the way. It's not trivial: memory management, no generics, a whole lot o constructs that don't need to exist in C#. Some things will be familiar, like structure, namespaces etc, others will require a lot of time. If you have some C experience, that will help. You probably won't gain much in performance (UI responsiveness) with C++, these things are a bit less sensitive to that. But it will help with memory usage a lot. It for you to decide. My two cents would be: stick with C# and .NET, less pain. If you really want to do stand-alone, use Mono with some GUI lib, and embed Mono. But if you insist on doing it with C++ and completely stand-alone, consider using QT. EDIT: As for .NET or .NET Core, it depends completely on how adventurous you want to be, I'd personally go for .NET Core if it's in a working condition, assuming it would be a pet project of mine. Otherwise, probably would stick with normal .NET .
  19. Doesn't have to be a GPU to start out. Intel iGPU needs this as much as any other card. I'm working on a laptop with no dedicated card either so far. I'm planning to build a Ryzen PC in about 8 months give or take, good way to wait for a price drop, and I'll be away from home for that long anyway.
  20. Should be a challenge and way more than 200 lines, more info in thread. And if you pick a reasonable language for a project like this (C, C++, Rust or Go), I'd contribute. I found some Vulkan trace tools that will help a bunch in my pet project, but a general GPU monitor that wouldn't be a console and would be cross-manufacturer seems to evade me.
  21. Haven't used Windows for a daily in over 4 years, only for testing software I spin up a Windows Server VM occasionally. Use a Macbook Pro for work, people are not allowed to use Linux for some reason I'm not sure of, so every single person in IT departament opted for Mac's instead of Windows devices, would use Linux if I could. Windows is a pain to set up with proper tooling (I don't mean IDE's, the terminal used to suck A LOT, the Linux one might work for me, but I'm not switching back). Building cross-platform native code is a massive pain, because libraries are not as easy to set up as in Linux, where you just install them and pkg-config get them for you immediately. You need workarounds. Macbook is ok, not satisfied with cooling and hardware, screen is amazing though. But on-topic for OS: It's better than Windows by a long shot (tooling), has some annoying things, Vagrant and nfs broke at certain updates for me, fixed now though. Docker has to run on a VM which is annoying as hell. And no Vulkan support, only MoltenVK, but validation layers are not supported. I have a pet project with Vulkan, and can't work on the renderer properly because of that. Good thing there's homebrew. Now for distro's, I used to use Debian when I was new, worked for me, all that I needed. Switched to Linux mostly out of curiosity, but there was some annoyance involved too (something about the laptop I had, it did not want to accept Windows 8 properly or smth, don't remember, drivers etc). Now I use Fedora, picked it mostly because where I worked at the time used CentOS for servers, and I needed some system that used RPM packages, so I could test them (you could install packages from CentOS and vice-versa). Stayed on it to this day because I'm really satisfied with all the relatively recent versions of software available for it. I used Gnome since the Debian days, yesterday I switched to Plasma to try it out, might do the same with Cinnamon if it doesn't stick.
  22. DevBlox

    High GPU Usage

    Try to roll back updates, GPU driver first. I that doesn't help it might be a Windows problem (a recent update or smth).
  23. You'll still be able to use it for a lot of things if you get a lightweight distro, or even modern distro with a lightweight desktop environment would work too. I'd suggest dropping any idea of having Windows, though you could potentially slim it down by cutting out a good portion of features, it's a heavy compromise. Modern tech and workloads that are easy for PCs and laptops now will be terrible on that machine no matter how you cut it, even things like watching YT might kick it's butt. The world has moved on, if you have no ability to get a new PC, you'll have to ride it out like that.
  24. That log seems to be totally unrelated. Speakers buzzed when there is interference since the dawn of time. Nearby phones, or any electric equipment, especially if it's some sort of wireless device, will cause spontaneous buzzing. I used to like this at times, you get buzzing on your speakers right before you get a call or an sms on your phone. Another thing you could do is ensure that your speaker power supply is using the ground wire, this helped big time with guitar amps + speakers, should help here too (properly grounded electronics combats interference better). One more thing. The PC's audio cards are also sensitive to this. Integrated sound cards do that sometimes, they're on the same board as everything else after all. I remember some WS class motherboard advertising that the onboard audio chip is isolated from the rest of the motherboard for that reason. In this case, the buzzing is not created in the speaker, but is already arriving with buzzing, not much you can do about that I think, except for a dedicated sound card, or external amplifier that runs over usb.
×