423 karma · joined Aug 10, 2013 (13y ago) · 65 submissions
comment 6mo ago · link · parent
Just image having a mandatory political party inside every American corporation which the board has no control over.
1. https://www.washingtonpost.com/national-security/2024/05/01/...
comment 8mo ago · link · parent
1. You will see no protest on the street.
2. You will see no homeless on the street.
3. You will hear no more school shootings or any shooting.
4. No more tech companies conflicting with the government.
5. No one will sue the government because it's perfect.
6. All bad people will disappear.
7. Everyone sings praise of the government.
This is better than Utopia, you should pursue it.
comment 3y ago · link · parent
Say I name my package "foo", foo is the top level folder for the source code. Inside foo there is a "main.py" file as the project's start point, and other various modules, let's have one called "module1.py". Now, add another package under "foo", the obvious example name here would be "bar", and add another module under "bar" called "module2.py".
The project structure looks like this:
- foo/
|- main.py
|- module1.py
|- bar/
|- module2.py
To reference "module1.py" in "module2.py", just write import foo.module1
To reference "module2.py" in "main.py", do as follows import foo.bar.module2
There is no problem importing from any level.To start the program from command line, enter:
python -m foo.main
comment 3y ago · link · parent
comment 3y ago · link · parent
Almost half of the time, I need to know if a number is even. Why doesn't it provide an end point for that?! Don't even tell me about the 409 status code. Am I suppose to know it's an even number when it returns an odd number to me? I only recognize status code 200, all other are errors, don't make this so complicated!
comment 3y ago · link · parent
The age does not matter as long as you can sit down and code. You don't see many old people doing programming because it's simply not many there. Computing is relatively new. It's obvious most people entering this field would be young, older people might require a change of career hence less incentive.
comment 3y ago · link · parent
I use to act as if I own a large stake of the company I worked for, regretting it much later when I realized I was doing too much and knowing too little.
I was just kidding myself pretending as an owner of the company therefore investing too much emotion and work into it. Why would I pretend something that is not true? It's not like fake it until you make it thing.
I do not know how much you know about your company, but I was an outsider that knew nothing about the inner workings and secrets about it. I thought I knew, that's the kidding myself part.
Unless you are a real owner, you are just a cog in a machine. If you perform well, you will be rewarded well as a cog in a machine not as an owner. Most decisions you make would not affect the overall situation. Just do your job well and try to spend time with something else you care after work, not something you have no control of.
16.
Ask HN: One of our Azure accounts was hacked – how to negotiate the bill?
78 points · by frogcoder · 3y ago · 74 comments
17.
Ask HN: Do you use foreign keys in relational databases?
188 points · by frogcoder · 4y ago · 244 comments
19.
Toyota recalls electric cars over concerns about loose wheels(bbc.com ↗)
1 points · by frogcoder · 4y ago · discuss
comment 4y ago · link · parent
And a warm welcome to this imposter syndrome help group, we are always afraid of missing out on some tech. Accept it, everyone is missing out on most of the tech.
When I was studying CS in college, I always wondered why the classes don't teach us about the hot Windows programming thing. All we did were tiny console C programs. I realized that very late, CS classes are meant to let you know about the fundamentals. You probably won't use these skills directly at work, but you will have ideas about how the languages and systems work internally. That pays in the long run.
Just go explore and make mistakes, you will be alright.
comment 4y ago · link · parent
Many of my code were like this:
foo = one_or_none()
if foo:
do_stuff(foo)
Now I have the following: if foo := one_or_none():
do_stuff(foo)
This kind of code happens quite frequently, looks nicer with walrus operator to me.comment 5y ago · link · parent
No, ORM does not simplify coding! It's a big complex adapter which does not fit many cases.
RDBM itself is complex enough, let's put another complex abstraction above it so we can forget about the tables and columns and joins and foreign keys. Complexity added upon another complexity does not make a polished interface.
If you want to use ORM, you have to learn both SQL and ORM with some depth at least. When problems occur, you have to debug both.
20 years in, I am still learning about RDBM. I still hate to compose SQL in code, but there is no better way.
Databases are used in every situation. Want to store data? Database. Want to communicate between processes? Database. Want to store logs? Database. There are different solutions for different scenarios, but as long as the DB chugs along, why? Sometimes it's sickening.
So 20 years in, the ROI of learning SQL is great. Please don't avoid learning about RDBM by using an ORM. Just learn it.
Actually, I'm not without ORM now a days. Light-weight ORM like Dapper serves well, it does not abstract out the concepts of RDBM, but make things easier.
comment 5y ago · link · parent
You are right, C# and JS use FP sparingly. I think I expect more from Python because I enjoy writing in Python and my functional adventures were rooted in Python.
Personally, lambda expression is painful to look at. Many times I have deliberately avoided it. It's possible to make improvements, but it seems the FP part just stagnated. Looking forward to pattern matching though.