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

Erik Sieghart

Member
  • Content Count

    531
  • Joined

  • Last visited

Everything posted by Erik Sieghart

  1. Erik Sieghart

    C++ or C#

    Well that's what people think anyway. You should read some of the old Joel on Software articles.
  2. Erik Sieghart

    C++ or C#

    This kind of game design should only ever be C++. You're not going to get the performance you need anywhere else. Also a note about bloat: that's a term people use but it just means feature rich. It's not a negative to have a lot of options.
  3. Okay well there's no programming advice I can give you.
  4. I agree that C# is a good recommendation. It's my favorite language, personally.
  5. And: Deluge Doki Doki Literature Club Dropbox Eve Online Reddit The Sims 4 Not to mention the countless websites currently being held up by django. To put this in perspective there are at the time of writing this according to Stack Overflow jobs: Ruby on Rails - 203 job postings Spring - 156 job postings Django - 131 job postings ASP.NET - 83 job postings Laravel - 31 job postings The fact python is competing on even footing with languages like Java and C# in the web world, proves that once again, people's misconceptions about it are wrong. It's slow, it's bad, it's not a real language is all I ever hear. Yet it's continually the language of choice in many areas due to its easy of deployment, intuitive use, and relative simplicity. You can bundle an entire python program all up in a nice little box and ship it on its way, maybe into a Docker and have a quick little script doing exactly what you want in less than an hour. It's got numpy, pandas, sqlalchemy, django, tesseract, etc. Most major companies have libraries built in python for their APIs. It has very mature and robust libraries available to develop whatever you wish. The idea that python is a kiddie script language is the idea of academics. For some reason people equate it to the like of Prolog. --- So why not write perfect code in C? Because while theoretically you could write write a program that is elegant, efficient, and masterful in C, it doesn't mean you're going to be able to write something that's large scale successful. Python is cheap to write and you might think that's bad but in reality in the world of engineering we don't care about doing things so we can get an A and a gold star, we do things that work. Why would I waste extra time coding something in C that I could write in python much faster, with fewer lines, that's easier to understand? When really all it's doing is parsing some small CSV file into a database with some correct formatting or scraping statistics for a report. You know what C and C++ has? Memory management, pointers, the ability to get in trouble much easier. Well, you may say, "Modern day C++ has these other things that..." And yeah I don't really care (for the record I have written in these languages). I don't want to write boiler plate code, and you shouldn't either. I don't have time for it. If that's your schtick do what makes you happy. But you know how big applications are created and maintained? By lots of developers. Developers of different skill levels. I'm not really going to argue about it anymore because one of the junior devs probably broke the build again so there goes another two hours of my time.
  6. Your first mistake is trusting this guy twice. You should just cut off all contact with him.
  7. You can't control what files do, they're just data. There's a lot of OS checks in place to prevent what you described because would be malicious software.
  8. People keep saying that it's locked into windows but it's untrue. I've been running a website from my macbook in a linux docker container for awhile now.
  9. This is accomplished under the hood by making a call to the OS. You can write it yourself with a "how do I get cpu info from terminal" and "how do I execute terminal commands from Java".
  10. Oh... How very naive. I'm not sure what you based that on but C# is nearly as popular as C++.
  11. You don't. I'm not kidding your question is like how do I get to the moon without rockets.
  12. If you're that intent on spending your college days doing something you'll be doing for the next few decades then... I know CS programs like to split up things by "Web, Embedded, Cloud" etc as overly broad categories but these are, in general, not what you're going to see in advertisements. I'll give you the general scope of why by breaking it down: Embedded: This could be literally anything and expect to be working in a language like C (if you're lucky) on some kind of software that's going to be put into a 256k memory module installed on a circuit board. It could be medical equipment or toys of some kind. Personally not my cup of tea since it's possible you're working on something that could seriously hurt someone (such as fork lift controller firmware) if you screw it up. Desktop: This is what I do for a living (mostly). I write a desktop CRM application custom for my business. I guess it could be fun but more often than not it's going to be some kind of business software. The languages used are pretty vast. C++, Java, and C# are some big players. Mobile: It's just like desktop but with different languages, sorta. You could be using Swift, C#, Java, or C++. Don't expect a lot of people to be using C++, though. Cloud: A deceptive name for what should really be called "Backend Services". You don't program the software that runs the cloud unless you're really into that sort of thing and get lucky finding a job doing it (or contribute to one of the open source projects). You develop APIs and such that get put up in a cloud like system. Web servers are often done this way too. Backend stuff could be anything though, like image processing, web scraping, or file management. Web: You're going to be a full stack dev. That means you can build a website from scratch all by yourself. You won't be, but that's what they want. --- Now then... These categories are meaningless because employers care about technologies and not languages. And the technologies may or may not be tied to the language. A company may want django (python) for their web development with experience in Redis and Docker. Or they may want ASP.NET (C#) skills. WPF skills (C#). Maybe they have a Qt (C++ in my example case) with a SQLite backend. Or they could have an Electron app (JavaScript.. Kinda...) if they're very daring. If you're confused that's about right. They may want you to have bash or PowerShell scripting experience. Or they could want you to have linux kernel understanding. It's better to come up with an idea of "I have a cool idea for this thing" that you can build yourself. That way it's probably going to be useful to you and fun to build. Like one of my things was, "I want to make a program to automatically upload my computer's specs into my LTT profile page." This idea fell apart for me when I realized obtaining some hardware information from Windows was actually extremely difficult, but you get the idea. At least I had fun trying to do it.
  13. If you don't know the answer to that question the answer is emphatically no: the care has a lot of power and precision behind it. I don't think it's your kind of "open up and modify in my garage" kind of car. You would have to custom design a transmission to be put in place in the car, not to mention the space constraints. While technically possible to design such a thing, is probably well beyond the scope of even a seasoned mechanic's and engineer's abilities.
  14. I checked out one: it looks like it was all in the javascript but it was compressed for deployment so it's not very readable. At the heart of it, the YT video is passed frame by frame to your computer to play on the screen. Any program which captures it is using this to convert the file. I'm not sure how difficult YT makes it to download their videos, but probably not the easiest thing in the world.
  15. Here is the program that does what you want, written in python since I don't know PHP but it should be relatively easy to convert. import copy, math from decimal import Decimal D = Decimal # For an individual line item. class Item: name = '' qty = 0 cost = 0 subTotal = 0 def __init__(self, name, qty, cost): self.name = name self.qty = qty self.setCost(cost) def setCost(self, newCost): self.cost = newCost self.subTotal = self.cost * self.qty # Generic data for an invoice. class Invoice: amountDue = 0 paymentTotal = 0 total = 0 items = [] def recalculateSubTotals(self): remainder = 0 # Determine the base cost. This is basically a more efficient way of doing this. for item in self.items: # The coefficient is basically the percentage of the total the item makes up. coefficient = item.subTotal / self.total # This is now the estimated new subTotal of the item. calculatedSubTotal = coefficient * invoice.amountDue # Now generate the base of the new item's subtotal, rounded down. # // is floor division. item.setCost(math.floor(calculatedSubTotal * D('100') // item.qty) / D('100')) # Add to the remainder amount the difference of the calculated and floored value. remainder += calculatedSubTotal - item.subTotal # Most expensive items first since they would take the remainder by weight. self.items.sort(key=lambda item: item.subTotal, reverse=True) # Now we need to distribute cents left over in the remainder. foundItem = True while foundItem and remainder >= D('0.01'): # Wait until we find an item that we can deduct from the remainder. foundItem = False for item in invoice.items: # Only if the minimum amount we can add to an item can be successfully subtracted from the remaining value. lowestIncrease = D('0.01') * item.qty if remainder - lowestIncrease >= 0: item.setCost(item.cost + D('0.01')) remainder -= lowestIncrease foundItem = True # Return the remainder since it may not have all been added to the items. return remainder invoice = Invoice() invoice.items = [Item("Apple", 1, D('1.49')), Item("Orange", 2, D('0.99')), Item("Banana", 5, D('0.47'))] invoice.total = sum(item.subTotal for item in invoice.items) # Enter payment here. invoice.paymentTotal = D('3.49') invoice.amountDue = invoice.total - invoice.paymentTotal original_invoice = copy.deepcopy(invoice) original_invoice.items.sort(key=lambda item: item.subTotal, reverse=True) # Recalculate invoice totals. remainder = invoice.recalculateSubTotals() for i in range(len(invoice.items)): old_item = original_invoice.items[i] item = invoice.items[i] print("Item: {0}, Original Amt: ${1}, New Amt: ${2}".format(item.name, old_item.subTotal, item.subTotal)) print("Total: ${}".format(original_invoice.total)) print("Paid: -${}".format(original_invoice.paymentTotal)) print("Amount Due: ${}".format(original_invoice.amountDue)) print("New SubTotal Sum: ${}".format(sum(item.subTotal for item in invoice.items))) if remainder > 0.01: print("Remainder: ${}".format(remainder)) As others have stated, use a decimal or money type for all literals so that rounding errors are not present.
  16. You're in luck I've developed an algorithm that does this using fraction decomposition. 1) Calculate the coefficients of each item. This is the total proportion each subtotal of each line has in its contribution to the total. You can calculate this by doing subtotal/total for each line. Note that we want all however many digits in the fraction there is. 2) Take your credit note value and for each item, multiply by the credit note full value. Store this value with all its decimals as the calculated subtotal of each line. 3) Floor each calculated value to the nearest 0.01 decimal place using this formula: floor(((calculatedSubtotal * 100) \ qty) * qty / 100), 2). The backslash is for integer division. Note that this gets factors the quantity of items when distributing value. Store this value as the rounded subtotal. 4) Subtract the rounded value from the calculated value to get the left over amount. Sum all of the remaining balances into one big lump sum for a remaining value to distribute. 5) Now here is where things get tricky. Sort items by highest to lowest subtotal. Loop over each item. Check if remainingBalance - item.qty * 0.01 is greater than zero. If it is greater than zero then subtract item.qty * 0.01 from the remaining value and then add that to the item's rounded subtotal. If it is less than zero move on to the next time. If you did adjust an item and change the remaining balance, loop over all the items again. If, after looping over all items, no item had its cost adjusted, then stop and return the items with their rounded subtotals. Note that at the end of 5.6 if you subtract the new subtotals from the payment, you may have a few cents left over. This is only the case if it's impossible to distribute the remaining value from total amount to the individual items. I'll post later with a python program that does this.
  17. I used to be the same way but after working a few hard jobs I eventually got comfortable to the whole doing things I don't like to do thing.
  18. I don't know and have never need to know. If we're to get technical, it's transmitted as EM waves and this all gets extremely complicated. You're only ever going to have one bit at one point in the wire at any given moment in time.
  19. Anyone can find a question to stump any expert in the subject they're an expert in. This doesn't really prove that they aren't knowledgeable about their domain; it only shows that you're petty. Further, I'll go ahead and save the embarrassment: Your question does two things: 1) Make you seem lame to your peers who don't know what you're talking about. 2) Make you seem ignorant to your peers who know what you're talking about. Firewire is just another data bus, like USB or your Ethernet port. All transmission is going to be done in serial or parallel, so your question makes no sense. Data over any kind of wire is going to be transmitted in its most basic form: binary. So yes, it's a binary "stream" of data. How else would you send it? Packets don't exist in the physical world; they're just a concept we came up with to organize the binary data we send over wires. This is detailed in the OSI Model. Packets are the in the 3rd layer. And for a high school level scope, attempting to be technically correct all of the time is just going to lead to confusion. It's more useful that you think data is transmitted in packets because that's all you're ever going need to think about it as. Really I think what's going on is you're the one overestimating your own knowledge.
  20. No one is suggesting he should be writing it in C.
  21. I mean yes and no. It's a bunch of legal grey area. Technically all he's scraping is facts off of publicly available web pages, which isn't copyrightable. There's no law that exists that explicitly mentions scraping or web crawling. A good practice of web crawling/scraping it to respect robots.txt https://developers.google.com/search/reference/robots_txt
  22. yfinance is a data scraper and not an API, meaning that it's not an official anything. Some websites, and I'm sure yahoo does this, will detect if you're a bot and rate limit you, but I wouldn't worry about it. The requests would originate from the person running your program.
  23. This will soon be irrelevant with .NET 5. I've been writing cross platform .NET Core stuff for half a year too.
  24. Enjoy being young and in college.
×