Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

DevBlox

Member
  • Content Count

    228
  • Joined

  • Last visited

Awards


This user doesn't have any awards

About DevBlox

  • Title
    Member

Profile Information

  • Gender
    Not Telling
  • Location
    Somewhere in East Europe
  • Interests
    Enterprise technology, software development, security

Recent Profile Visitors

851 profile views
  1. MongoDB, Elasticsearch (document id is the key if it fits your needs, and great for searching through things too). Or just have one database - a fast key-value db that stores on disk, usable on cloud storage as well: Aersospike (can use anything that can be abstracted as a block device - files, devices, but is mainly optimised for SSDs), or you can shell out for RedisLabs (also grants you SSD storage option) since you use it already basically. Having one database would simplify your application greatly.
  2. Well, if your source code is gone, you're gonna have to figure that out with manual tools. Visual Studio will probably not help you much. Read about the build procedures and try to complete them manually. That's gonna be a pain though, might be better to just rewrite the code, depending on what you've got there.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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 .
  8. Usefulness is debatable (lol). But I've written a naive multi-core prime number generator as an exercise.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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
  14. 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 .
  15. 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.
×