thread_id
stringlengths 6
6
| question
stringlengths 1
16.3k
| comment
stringlengths 1
6.76k
| upvote_ratio
float64 30
396k
| sub
stringclasses 19
values |
---|---|---|---|---|
ueiw3o | If I want a local data base just for me in my computer I need to create a local server. Why aren't there any local data bases programs/frameworks/libraries that I can access just like I access a .txt file.
I'm a math student solving a problem that requires a lot of memory usage and I find myself struggling with databases and I don't have too much coding experience, that is why this is a stupid question. | There are a lot of these! I guess the most popular one is sqlite, feel free to check it out. It's super simple to setup and surprisingly well supported | 350 | AskComputerScience |
ueiw3o | If I want a local data base just for me in my computer I need to create a local server. Why aren't there any local data bases programs/frameworks/libraries that I can access just like I access a .txt file.
I'm a math student solving a problem that requires a lot of memory usage and I find myself struggling with databases and I don't have too much coding experience, that is why this is a stupid question. | I think you are misunderstanding what 'server' means in this. Basically, in a client-server style architecture, you have your client, that requests data, and your server that sends data. It's and over simplification but it should give you the picture.
When these things say you need a local server, that just means you need to install the server side software on your system. You can then use a client to interact with it, like if you installed MySQL, you could use mysqlworkbench | 40 | AskComputerScience |
ueiw3o | If I want a local data base just for me in my computer I need to create a local server. Why aren't there any local data bases programs/frameworks/libraries that I can access just like I access a .txt file.
I'm a math student solving a problem that requires a lot of memory usage and I find myself struggling with databases and I don't have too much coding experience, that is why this is a stupid question. | They don't require a server. A .txt file absolutely can be a database. It's just at some point manipulating a text file directly is not an effective way to work with your data.
It's kinda like running a business. When it's small you might be able to do everything out of your home but as it grows eventually you rent an office suite. As it continues to grow you might need to buy a building and then multiple buildings. If sounds like you've outgrown working from home and think you need to buy a building when really you should be looking for a simple office suite.
If a simple .txt file doesn't have all the functionality you need then maybe look into using a spreadsheet. You can do a lot of basic database type stuff very easily/quickly with modern spreadsheet software. If your needs outgrow a spreadsheet then something like Microsoft Access (Open Office/Google Docs has similar tools) might be worth looking into. | 40 | AskComputerScience |
ueo719 | I'm looking for project ideas in AI and Software Engineering that can be done in a week.
They should be fun to do, solve a real-world problem (even though not necessarily perfectly) and finally should be generally doable in a week full-time by one individual. | An app that supports social justice/good cause like healthcare, homelessness, etc. | 40 | AskComputerScience |
uesv85 | What exactly is the reasoning behind learning more than one sorting algorithm, is it to teach concepts about how sorting algorithms work to better understand how to think?
Because I can imagine that learning one really fast algorithm would be a good way too, is there something im missing?
Thanks | In fact, you will never use any of those algorithms for sorting, and you will most likely only use the “built in” sorting algorithm of the language you are working with (which is usually some sort of hybrid sorting algorithm, such as Timsort for Java - that is not included normally in college curriculum).
The point of learning many sorting algorithm is the following:
1. It is a relatively easy and straightforward problem, that has many algorithmic solutions
2. It helps you in evaluating and comparing different algorithms
3. It helps you understand that sometimes more intuitive solutions can be improved upon
4. It is a quite didactic intro into some algorithm design strategies, like divide and conquer in the case of mergesort and quicksort.
5. EXTRA: knowing these sorting algorithms is part of the “common knowledge” of a Computer Scientist. Just like Calculus might not be the most useful subject it is just something that you should know to be in the club of engineers/scientists, the same is the case with these algorithms. Are they the most practically useful stuff? Not at all. Are they tradtionally part “Computer Scientist common mythology”? Definitely. | 790 | AskComputerScience |
uesv85 | What exactly is the reasoning behind learning more than one sorting algorithm, is it to teach concepts about how sorting algorithms work to better understand how to think?
Because I can imagine that learning one really fast algorithm would be a good way too, is there something im missing?
Thanks | yep. and to have bubble sort as your whipping boy in the future | 130 | AskComputerScience |
uesv85 | What exactly is the reasoning behind learning more than one sorting algorithm, is it to teach concepts about how sorting algorithms work to better understand how to think?
Because I can imagine that learning one really fast algorithm would be a good way too, is there something im missing?
Thanks | The first time I encountered the idea of a binary search tree was an epiphany to me. It taught me that *how data is arranged in memory has a direct impact on how quickly code can execute*. Up to that point, I only knew array and only thought of it as a general collection.
I think teaching several different ways of sorting accomplishes something similar. It is to generate an epiphany. I.e. *there are different ways to accomplish the same thing, but there are costs are consequences to all of them*. Such an epiphany will serve the student as he/she continues to learn algorithms and data structures.
----
A second thing though, is that different sorting algorithms may be adapted to solve not-quite-sorting problems.
For example, I was once asked in a job interview to write a function that counted the inversions (i.e. how far (or close) the array is from being sorted) in an array.
I wrote a naive O(n^(2)) solution.
But the winning solution was to adapt merge sort. | 100 | AskComputerScience |
uetubj | So I am 16 from the UK, and have just left school so have alot of time on my hands for a few months until I go to college. I started learning to code around 5 or 6 months ago but haven't really got that far because I keep dabbling around in different languages, I started off with Python but then I realised that I didn't really want to do Python anymore because it wasn't too good for what I wanted to do. I think I can get the basics down on a language pretty quickly so I guess thats good, but anyway I am now learning Java but I'm hearing Java isnt used as much or something, im not sure. Could anyone suggest what language would be good to learn (or should I stick with Java?) | What language do they use for the college course, and what kind of programming are you interested in doing? Websites? Apps? Embedded? Systems Programming? Etc | 40 | AskComputerScience |
uf9yy8 | I've been working with React Native for the last month or so. My question is, if I get decently good at it, will I be able to apply for Android/iOS engineering roles? | Only if they are using ReactNative as part of their tech stack. You won't have experience with Kotlin/Swift, so many roles will not be available. | 70 | AskComputerScience |
ufdu2w | Do you remember "personal ads" in the newspapers? I enjoyed reading the ads but didn't know anyone that placed one. In researching, I discovered ads from the 1800s, including whole newspapers devoted to them. | The Village Voice (an uber artsy liberal weekly newspaper based out of New York) had an (in)famous personal ad section.
In addition to the standard, Men looking for Women and Women looking for Men, they were one of the first that also carried personal ads for gays looking or love or a hookup. They popularized abbreviations that are common today such as, GAM (Gay Asian Male), BiBF (Bisexual Black Female) and so on.
Similar to Craigslist years later, the last section of the personals was an "anything goes" area. People looking for pretty pretty much any sort of kink involving 2 (or more) consenting adults would place ads there.
Ahhh the good old days. | 350 | AskOldPeople |
ufdu2w | Do you remember "personal ads" in the newspapers? I enjoyed reading the ads but didn't know anyone that placed one. In researching, I discovered ads from the 1800s, including whole newspapers devoted to them. | I'm old, so this was back in the 1980's. My divorced father in NY actually responded to an ad in Sheila Wood's Find a Friend column in one of those supermarket checkout rags. I'd always figured they were sketchy, but the woman (in Texas) responded, and they began a courtship over telephone. He owned a restaurant in a pretty remote area, and all we had was a pay phone. For the next year they called back and forth, until she moved up for their wedding. Not all telephone systems were automated at that time, and I remember the local operators giving them rolls of quarters as a wedding present. They stayed married until his death about a decade ago.
Seems pretty quaint now, with all the "swipe right" apps available these days.
(edited) | 350 | AskOldPeople |
ufdu2w | Do you remember "personal ads" in the newspapers? I enjoyed reading the ads but didn't know anyone that placed one. In researching, I discovered ads from the 1800s, including whole newspapers devoted to them. | Placing a personal ad in an alternative newspaper is how I met my current (and last, I hope) SO, been together for the last 28 years. | 270 | AskOldPeople |
uffgho | I would like to start schooling for a software engineering degree but I'm not sure about the prerequisites I need. I'm 34 years old and have been working as a chef for over 15 years. I am really interested in changing careers and software engineering really appeals to me but I don't have any background in computer tech. I also only have my GED; which I received months before I would've graduated high school if I hadn't dropped out. I guess I would like to know what I should do to get a head start. I would like to start classes by the beginning of next year. Any advice would help | GED is equivalent to hs diploma so they're interchangeable.if ur trying to get to cc just sign up and schedule meeting with a counselor and they can make you an Ed plan getting in to a uni after so long would be difficult but there's some here or there that take anyone with a pulse so it's not impossible.
But if ur just trying to do self taught get to work then start applying.
This is all assuming you're stateside.
Cc= community College for clarification | 30 | AskComputerScience |
uffgho | I would like to start schooling for a software engineering degree but I'm not sure about the prerequisites I need. I'm 34 years old and have been working as a chef for over 15 years. I am really interested in changing careers and software engineering really appeals to me but I don't have any background in computer tech. I also only have my GED; which I received months before I would've graduated high school if I hadn't dropped out. I guess I would like to know what I should do to get a head start. I would like to start classes by the beginning of next year. Any advice would help | In the US definitely I would recommend the community college pathway and finish at state university. You should first try out writing code, preferably for something that you have no vested interest in because a lot of software engineering is doing to be writing software that you don't care about, so make sure you enjoy the process not necessarily the end result. | 30 | AskComputerScience |
ufhpas | If you try to move, rename, or just generally modify a file in Windows while it's being used in another application, you get an error and the OS won't let you.
Why is this? Are there operating systems that *do* allow files to be modified in storage while still being used in memory? Or is there a fundamental problem with doing so? | That's a Windows thing, and can be worked around, but that's the default behavior. On Unix-style OSes, you generally *can* delete a file (or move it) while it is open in a program.
This is because on a typical Unix-style filesystem, an open file is just a reference to a block of data on disk, and does not have the filename associated with it. So, even if that block of data gets a different name associated, or gets removed from its enclosing directory (deletion), it still exists at the same location, until everything using it is done.
This is often how you do system upgrades while it is running. You might have lots of things using a dynamic library v1.0, then your upgrade deletes that and replaces it with v2.0. All the running programs still have open handles to v1.0, and thus keep functioning. All the new programs you run will open the v2.0 one, though.
In this [SO Post](https://stackoverflow.com/questions/43758975/can-i-read-a-file-in-windows-in-c-without-locking-folder-containing-the-file), it mentions a solution on Windows of creating a hardlink. On Unix, all files are hardlinks already, essentially. | 80 | AskComputerScience |
ufhpas | If you try to move, rename, or just generally modify a file in Windows while it's being used in another application, you get an error and the OS won't let you.
Why is this? Are there operating systems that *do* allow files to be modified in storage while still being used in memory? Or is there a fundamental problem with doing so? | In addition to what the other comment has said, one potential problem with the OS arbitrarily allowing users to modify files on disk while they are open in memory is that changes to the file do not necessarily write immediately to disk synchronously. Frequently the system will batch up changes and flush them to disk only once in a while.
If the underlying file gets changed on disk while some changes were made to the file in memory, then the system might end up in a conflict. The changes in memory and the new changes to the file in disk might contradict each other, and the system now has to guess at how to resolve that.
The warning helps prevent this from happening unintentionally. | 50 | AskComputerScience |
ufkbfl | I'm an assistant for my university in a research project where I have to access and manipulate really really large files and change the format (JSON to db). The thing is, it's so time consuming and I can't open these files on my computer because they're too big. I'm assuming that's a limitation caused by my RAM, right? I'm currently using a json streaming library through Python. It's so slow. Every new record has to be checked against the pre-streamed records for what we're trying to accomplish. I'm working primarily from a 600 mb JSON file so I know it's not because my computer is crap.
So if I were to pay for computing access through Amazon or Google Cloud, would that help my issue? Is this what Google Compute Engine is meant for? I'm a little vague on what exactly in my hardware is the limiting factor and what to look for in a paid cloud service. | what software are you using to open the file? are you trying to open a 600mb file in notepad or some other text editor? | 40 | AskComputerScience |
ufl8xy | At what event or occasion did you realize that you are “old”? | When I went to a big concert in 2010 or so of a rock band that topped the charts in the 1970s. I saw the people waiting in line and thought, "I didn't know old people liked this music." A nanosecond later it hit me that they were my age. | 1,800 | AskOldPeople |
ufl8xy | At what event or occasion did you realize that you are “old”? | Not wanting to get pets that will outlive me. | 1,270 | AskOldPeople |
ufl8xy | At what event or occasion did you realize that you are “old”? | 70 here. And I've never felt my age. I'd comment that 70 is the new 50. But in Feb, I severed my right quadracep. Fell on ice, leg buckled underneath and I heard the tendon snap. This is a fall that I would have taken easily in years past without injury. But now it was a major rupture and took surgery and months of recovery and Physical Therapy. This event has made me feel my age for the first time in my life. I can no longer prance around like a teenager, and any injury is going to take more time to hear. I've never felt so old until now. | 1,150 | AskOldPeople |
ufmsb8 | To those who struggled with anxiety young, how did you/your relationship with it change over time? | I left home at 18, and once I had control over my own life, that cut my anxiety down tremendously. I set up my adult life into something that minimized anxiety/stress (i.e., a career that I enjoy and that pays well, NO children, and waiting until my mid 30s to get married.) | 170 | AskOldPeople |
ufmsb8 | To those who struggled with anxiety young, how did you/your relationship with it change over time? | You learn to understand it. You know what it is and finally learn that nothing bad is going to happen if you push thru it | 140 | AskOldPeople |
ufmsb8 | To those who struggled with anxiety young, how did you/your relationship with it change over time? | Learning yoga - especially breathing and relaxation practices - has been the most effective way I've ever been able to combat anxiety. Luckily I found a good book at the library when I was a teen - and it made all the difference. | 100 | AskOldPeople |
ufozou | You live your life. learn. work. raise a family. grandkids...what's next? waiting for your final destination? seems like i'm missing something | For me, I coast through each day, doing what I want to do. Sometimes doing "nothing" . | 210 | AskOldPeople |
ufozou | You live your life. learn. work. raise a family. grandkids...what's next? waiting for your final destination? seems like i'm missing something | I skipped the family and grandkids part (not interested). I prefer to travel. The moral of the story being you can do with your life whatever you choose... You don't need to follow the script because everybody else is doing it. Unless you're independently wealthy, you probably do need to work, but you can find work that you enjoy doing. You figure out what your interests and passions are and pursue those when you can. You only get one shot... The goal is to spend the majority of it doing things you enjoy as opposed to those you don't and get out of the experience what you can. | 150 | AskOldPeople |
ufozou | You live your life. learn. work. raise a family. grandkids...what's next? waiting for your final destination? seems like i'm missing something | Lots of meditation. Not just 20 minutes in the morning but 5-minute sessions during the day, like 6 of them. I'm more interested in being in the vast present than tangled up in a bunch of thoughts about what's next. | 110 | AskOldPeople |
ufpbl6 | So 1 byte = 8 bits
2\^10 bytes = a killobyte, why couldn’t (wasn’t ?) there be 3 kB ram ?
It was always 4kb, 8, 64, now 1, 2, 4, 8 gigabytes
I really couldn’t find an answer for a long time because if we have 8 bits that’s 2\^8 states = 256 possible states, so if we have 3 kilobytes that’s 3072 bytes = (3072 \* 8) bits and thus 2\^(3072\*8) possible states. Im not missing anything, so why there is no ram capacities with odd number of bytes/kilobytes/gigabytes ? | There have been. They're just rare.
Memory is addressed by an address bus, meaning a set of wires that are each connected to ground or a voltage. Say you have two wires. That means there are exactly four memory locations: each of the wires can be connected to ground or voltage, making four unique combinations. So if you build a two wire memory chip, it makes sense to put four memory registers in it. You can't put any more, because you wouldn't be able to select them uniquely.
You _could_ put in less, if you wanted. If memory registers were super expensive and you only needed three of them, you could make a two-wire, three-register memory. But as soon as you started combining them, you'd be wasting pins. Suppose your project calls for seven memory registers. You'd need three of the 3-register chip, meaning 4 address lines (two that go into the chip and two to select between the three chips). Compare this to two 4-register chips, which can do the same job with just three lines. Your CPU only has a limited number of address lines, so wasting them like this is undesirable.
As a result, memory chips intended for general use are pretty much always "full" - every address they can decode is mapped to a register, without any addresses wasted. And this in turn means that memory chip capacities are always a power of 2. | 220 | AskComputerScience |
ufpbl6 | So 1 byte = 8 bits
2\^10 bytes = a killobyte, why couldn’t (wasn’t ?) there be 3 kB ram ?
It was always 4kb, 8, 64, now 1, 2, 4, 8 gigabytes
I really couldn’t find an answer for a long time because if we have 8 bits that’s 2\^8 states = 256 possible states, so if we have 3 kilobytes that’s 3072 bytes = (3072 \* 8) bits and thus 2\^(3072\*8) possible states. Im not missing anything, so why there is no ram capacities with odd number of bytes/kilobytes/gigabytes ? | Since the CPU address bus represents a binary number, the natural size for any memory block is a power of 2. If you had an 11-bit address bus, you could address 2,048 things. A 12-bit bus addresses 4,096 things. In terms of binary addressing, your example of 3,072 is an odd number, so to speak. | 70 | AskComputerScience |
ufpbl6 | So 1 byte = 8 bits
2\^10 bytes = a killobyte, why couldn’t (wasn’t ?) there be 3 kB ram ?
It was always 4kb, 8, 64, now 1, 2, 4, 8 gigabytes
I really couldn’t find an answer for a long time because if we have 8 bits that’s 2\^8 states = 256 possible states, so if we have 3 kilobytes that’s 3072 bytes = (3072 \* 8) bits and thus 2\^(3072\*8) possible states. Im not missing anything, so why there is no ram capacities with odd number of bytes/kilobytes/gigabytes ? | There are Xeon boards with 3 dimm channels per cpu. If you fill them with 1GB dimms, you can end up with 3, 6, or 9GB per cpu. | 50 | AskComputerScience |
ufs1kg | Bell-bottoms, silk shirts with art-deco patterns, platform shoes, vests and can't remember what else. | Clothes hadn't been invented yet. We didn't wear anything. | 40 | AskOldPeople |
ufs1kg | Bell-bottoms, silk shirts with art-deco patterns, platform shoes, vests and can't remember what else. | In the 70s (childhood), I mostly wore jeans, sneakers, and t-shirts.
I did the same in the 80s and 90s.
When the 21st century came about, I continued the trend.
Now, in my 50s, I mostly wear jeans, sneakers, and t-shirts.
The only real difference is that some of the jeans in the 1970s were bell bottoms or "cowboy cut." | 30 | AskOldPeople |
uftqwz | I'm 46, and I will never miss being forced to wear wool anything. What things from the past that are now gone will you also not ever miss? | Pantyhose whenever you wore a dress or skirt. Pads that required a belt before adhesives. Huge pads while you're at it that weren't compressed like now. Tampons with just cotton on the end and no rounded plastic tips, ouch. No cell phones and being able to call for help when you break down at night. | 2,390 | AskOldPeople |
uftqwz | I'm 46, and I will never miss being forced to wear wool anything. What things from the past that are now gone will you also not ever miss? | Wool isn’t gone, but I guess it is for you.
I don’t miss second hand smoke. | 2,340 | AskOldPeople |
uftqwz | I'm 46, and I will never miss being forced to wear wool anything. What things from the past that are now gone will you also not ever miss? | I'm 55. People whispering the word cancer. Hiding/ locking away people with disabilities or mental health problems. Marital rape being legal. Sexual harassment being the 'price' women paid to have a job.
And cigarette smoke, except vaping is making that an issue again. | 1,240 | AskOldPeople |
ufzuda | I'm a CS student who is currently feeling unmotivated to continue diving deep into the fundamentals of programming.
I already know how to build websites but I still consider the kinds of stack the project might need before considering doing it, just because I find it hard to switch from language to language.
To anyone here who already finds programming language/tools less scary, how does it feel? | It feels ok I guess. | 350 | AskComputerScience |
ufzuda | I'm a CS student who is currently feeling unmotivated to continue diving deep into the fundamentals of programming.
I already know how to build websites but I still consider the kinds of stack the project might need before considering doing it, just because I find it hard to switch from language to language.
To anyone here who already finds programming language/tools less scary, how does it feel? | My skills aren't so much my ability to remember various programming languages and produce algorithms, but more my ability to visualize all of the interactions and the knowledge that there exist algorithms to perform most of the mathematically challenging things.
And, my ability to use google. | 80 | AskComputerScience |
ufzuda | I'm a CS student who is currently feeling unmotivated to continue diving deep into the fundamentals of programming.
I already know how to build websites but I still consider the kinds of stack the project might need before considering doing it, just because I find it hard to switch from language to language.
To anyone here who already finds programming language/tools less scary, how does it feel? | It doesn't feel like anything. It's like asking how it feels to be able to read without struggling. You just ... do it. | 70 | AskComputerScience |
ug11np | I recently saw a story of a man who got out of prison after over 4 decades and thought to myself how the world is literally like an alien world to him and how homesick he must have been. In what ways for you is the world so different that it must feel like you’re in another universe? | I miss the days when the Main Street of small towns were full of shops. I miss the small businesses, usually owned by someone you knew, and the feeling of just visiting friends when running errands. I miss the soda counters in drug stores. I miss the train stations that used to be in every small town and the street cars that could be used to get around. You really didn’t need a car. I miss the community life which seems practically non existent now. No one has time for that because everyone is working all the time, just trying to make meds meet. | 2,730 | AskOldPeople |
ug11np | I recently saw a story of a man who got out of prison after over 4 decades and thought to myself how the world is literally like an alien world to him and how homesick he must have been. In what ways for you is the world so different that it must feel like you’re in another universe? | The lack of just being. Sure people veg out in front of the TV/screen etc. I miss the days when my grandfather would be sitting outside and neighbors would drop by and talk for awhile. Some would bring their guitar or banjo and they would play for a couple of hours, just being. No rush, no have to do, work day was done or it was Sunday afternoon. People just enjoyed being together. Talking and laughing or talking and consoling for a loss. People knew how to be together without ever seeing a screen. If the phone rang inside, a kid ran to check it or the person would call back later, no rush to interrupt the moment. I guess all that to say, people are too busy (even when not) to just enjoy the company of another human for a bit. I’m as guilty as the next person.
Oh and 6-8% interest earnings in my basic savings account. | 1,810 | AskOldPeople |
ug11np | I recently saw a story of a man who got out of prison after over 4 decades and thought to myself how the world is literally like an alien world to him and how homesick he must have been. In what ways for you is the world so different that it must feel like you’re in another universe? | All kinds of wildlife are DECIMATED where I live.
Birds. Bugs. Frogs. Deer. Rabbits. Wolves. Bobcats. Butterflies. Turtles. And that's just what's at the top of mind.
I'm in a very rural place, and the extreme decline in all sorts of wildlife is heartbreaking. | 1,200 | AskOldPeople |
ug7bsh | What decade of your life have you enjoyed most so far? | 40s. My career and that of my husband were going great, but no so great we had trouble finding time to take vacations. The deaths of close relatives and friends hadn't started en masse. I still got hit on at bars by guys young enough to be my kid. I could run 15 miles each Saturday just for fun, and hike in the desert sun for hours. | 80 | AskOldPeople |
ug7bsh | What decade of your life have you enjoyed most so far? | 1970-1991 when I was a flight attendant travelling around the world, seeing the sites others paid thousands to see & being paid for it. We stayed in 5-star hotels & resorts, ate exotic foods & experienced different cultures & "partied" on duty free booze and enjoyed life.
Now for the last 4 years, I live a completely live a different lifestyle in my 70's. I live in a small village in SE Asia, get up with the sun and go to bed soon after dusk, the same as my 6 cats do. Last night I helped a guy celebrate his 30th birthday, with some of his family & friends at the family house. We sat around with plenty of food from BBQ intestines, hotdogs & pork pieces, chicken in a sour tamarind broth, and other dishes I didn't recognise, a couple of crates of beer & a large bottle of Spanish brandy. It was relaxing sitting & sipping, with nibbling and good conversation and for me a short 800 metre walk home afterwards, although several people offered to drive me home, including a 9yo, with his parents tricycle. He was the one who brought my motorcycle back after his uncle had borrowed it earlier, and to invite me to the party. I would say now is also a great period of my life. | 50 | AskOldPeople |
ug7bsh | What decade of your life have you enjoyed most so far? | 30s
more money. good job. chill boss. having two little kids. much bigger house. | 40 | AskOldPeople |
ug9y9w | Hi, I have a situation where I need to do up to 5 http requests in parallel. I have some async functions that do the requests. The 5 requests are different data sources but all return Result<FeatureCollection> which is a geodata format.
However I don’t know in advance how many I will need to run, that depends on input.
How do I make sure that the requests run concurrently, and only those that I need?
I’ve looked into the join and join_all macros but they seem to either assume that you know which future/request will run, or that the output will be the same
I’ve also tried setting up a dummy async function that has the same result type as the actual function. However the compiler does not accept this, it complains that the functions have different opaque types even though they dont. This might have to do with the result trait
What’s a good way to solve this? | You can, for each future that needs to run call Box::pin on it and push it into a Vec::<Pin<Box<dyn Future<Output = YourResult>>>>. You can the use join_all on that.
Edit: Your Problem is that the futures associated with different async functions are different types (e.g. a future with more state that needs to be preserved will neccessarilly be larger). By using Box::<dyn Future>::pin() you move each future to the heap making it possible to store pointers to them in a vector and use *dyn* amic dispatch to distigush between the different future types. | 40 | LearnRust |
ugajyy | For educational purpouses I want to build an API that returns a random code fragment. To gather the data I'd like to scrape open-source projects on github, but I'm unsure which licenses forbit such actions. For example GNU GPL3.0 requires that I copy the license when I copy the source code. So here's the question: Projects with which licenses can I scrape for code? | This is really a legal question, not a computer science question.
You can redistribute code that's under any open-source license, but almost any license (not just GPL) will require that you include the original copyright notice and/or license. If you wanted to comply with this requirement, you could just make your API return that information as well. (You probably don't need to include the complete license text with every response; I would think naming the copyright owner and linking to the original repo is good enough. After all, even GitHub doesn't include the complete license text on every web page that it serves up.)
The major exception to this is if the code is in the public domain, or under a [public-domain-equivalent license](https://en.wikipedia.org/wiki/Public-domain-equivalent_license), such as CC0 or the Unlicense. In that case, it's as if the code was never copyrighted at all, and you can do anything you want with it. (At least, that's how it works in the USA. Some countries also recognize [moral rights](https://en.wikipedia.org/wiki/Moral_rights) which are separate from copyright, and may not be so easily waivable. See why this is such a complicated topic?)
The other exception would be if your API is considered to fall under [fair use](https://en.wikipedia.org/wiki/Fair_use), but that is an extremely tricky legal question that is definitely out of scope for this subreddit. | 80 | AskComputerScience |
ugav8y | I drove a maroon Chevy Vega with tan interior with poor transmission. The guys used to drive fast cars and souped up cars that they overhauled themselves. Novas, Mustangs, Firebirds, GTOs-Goats, Mach II's, Trans Ams, Jaguar's and Corvettes. | light mint green Ford Pinto - no, it never caught on fire.
edited to add that my parents had a "Grabber Orange" Ford Maverick | 140 | AskOldPeople |
ugav8y | I drove a maroon Chevy Vega with tan interior with poor transmission. The guys used to drive fast cars and souped up cars that they overhauled themselves. Novas, Mustangs, Firebirds, GTOs-Goats, Mach II's, Trans Ams, Jaguar's and Corvettes. | I drove VW Beetles and learned to do my own maintenance and repairs from [The Idiot Book.](https://www.bing.com/images/search?view=detailV2&thid=AMMS_601051f457153cf31f77ffaffc574482&mediaurl=https%3a%2f%2fimages-na.ssl-images-amazon.com%2fimages%2fI%2f61J1ZJE3TQL.jpg&exph=475&expw=361&q=how+to+keep+your+volkswagen+alive+john+muir&FORM=IRPRST&selectedIndex=0&stid=83ff2e8d-6e89-9924-def5-b9dc4fe3e2d1&cbn=EntityAnswer&idpp=overlayview&ajaxhist=0&ajaxserp=0) I got to the point where I could fix flats out on the road and swap engines in a couple of hours with a sheet of plywood, jacks and basic tools. I bought my best seventies car, a 1973 Porsche 914, in the eighties. | 70 | AskOldPeople |
ugav8y | I drove a maroon Chevy Vega with tan interior with poor transmission. The guys used to drive fast cars and souped up cars that they overhauled themselves. Novas, Mustangs, Firebirds, GTOs-Goats, Mach II's, Trans Ams, Jaguar's and Corvettes. | Never had a car until my 20s (1980s), but I had this in high school after I turned 16. ['74 Kawasaki F7 175cc enduro](https://i.imgur.com/pVKbkue.jpeg) If it was raining or too cold I got a ride from a classmate or my Dad dropped me off in his Jeep Wagoneer. | 60 | AskOldPeople |
ugddoc |
Hello everyone!
I am new to this sub and to the field of computer science. So please explain easy and simple as possible (treat me like 7-year-old kid and sorry for the bad English).
So, I am currently reading a book about computer science, and I've encountered a problem on computing system. The book's definition of computing system is "All basic hardware and software that work together to run program." At the end of the chapter, the book asked the question: "What is a computing system and provide examples of computing systems." I wrote CPU, GPU, RAMS and memory cards as examples of computing systems, but the answer from the book said, "A computing system is any kind of computing devices such as laptops, phones, and tablets."
To my understand, computing devices are things that have both hardware and software, however my answers are simply the hardware. But when I searched examples of computing systems on Google, there were keyboards, barcode scanner, and touchscreen and I don't think these are examples of computing devices which is not right to the definition from the book (isn't keyboard just input device (hardware)?)
So, can anyone explain what computing system is (if the book's definition is not good or if you have better definition) and examples of computing systems? Also do CPU, GPU, RAMS and memory cards can be considered as computing systems? Lastly, does "Computing System" the same thing as "Computer System"?
Any help would be appreciated.
Thank you! | No the book is right in both scenarios, but it wasn't a very well written question.
Think of a "computing system" as absolutely anything that involves a computer or computer network.
All of those items you were listing were hardware components of a computing system.
A web sever like "Apache tomcat" would be am example of a software component of a computing system.
A computing system could be the phone in your hand, the cell towers that make it connect to the world, the wires and network adapters and routers and everything I'm between.
It could also be the POS system in a restaurant.
The cash registers at your local deli.
The entire financial system.
Your bank.
Your car's ECU, and various sensors.
A gpu, cpu, ram, etc... those are hardware components that may or may not be used in a computing system.
Embedded software would also count by the way... embedded software is like... think...a child's fire truck toy, with lights and sirens. That is also a computer system. It has a small computer that plays the sound, and controls the lights, and listens for user input (the kid pressing the button). | 30 | AskComputerScience |
uge6w2 | Yeah I know this wasn't that long ago, but I'm too young to remember this event. How big was it really? Did it affect regular people? | If you were working for dot coms like I did it was a very big deal. The world ended. It was a litany of dot failures. Non web companies weren't hiring either. It was like a game of musical chairs ended and there were no chairs.
San Francisco went from being an unbearable boom town to a ghost town in a matter of months.
If you were not in tech you might not have noticed, however. I remember talking to folks in other parts of the country and they weren't affected at all. | 310 | AskOldPeople |
uge6w2 | Yeah I know this wasn't that long ago, but I'm too young to remember this event. How big was it really? Did it affect regular people? | It was terrible. I was in tech, but working for a university, so I thought I was safe. But with the stock market tanking, the endowment shrank. The university cut back and laid me off. And there were NO tech jobs. Nobody was hiring. And if they were you were competing with all the other laid off workers. I was in my mid 40s without the latest and greatest skills.
I sold everything and went from a luxurious 2br apartment to a tiny studio in a meh neighborhood, hoping to make my money last. I gave up on tech. Started volunteering for social service agencies, considered getting a degree in social work. Ended up getting a paying job at one - at 1/4 of my former salary. Relaxing, feel-good work, though. And I was kind of burned out on tech. If it hadn't been for the dot com crash I probably wouldn't have left. So it all worked out. | 180 | AskOldPeople |
uge6w2 | Yeah I know this wasn't that long ago, but I'm too young to remember this event. How big was it really? Did it affect regular people? | When looking back on it and hearing people talk about it, it sounds like it was a quick crash. It wasn’t. It was long and drawn out and businesses were trying their best to survive as long as they could, but eventually the layoffs started and didn’t stop until the majority of the tech startups had gone out of business. I was one of the last at the company I worked at. Eventually the last 8 or so of us were called to a meeting and told they were shutting down. | 110 | AskOldPeople |
ughqt2 | How do quantum computers processing power compare with the computing power of 3D chips of classical binary computers? | Classical computation fundamentally boils down to logic gates, with basic operations of AND, OR and NOT. Each of these takes one or two bits as input and returns one bit as output. A bit is a single value which is logically true or false, and may be represented in a physical computer by the presence or absence of a voltage.
Many of the classical logic gate operations are irreversible: for example, given the operation 1 OR 0 = 1, the inputs cannot be retrieved if you only know the output. Landauer's principle, which is proven experimentally, states that there is a minimum energy required for an irreversible single-bit operation. This establishes an upper bound on the amount of classical computation that can be performed using a given amount of energy. This limit is millions of times faster than any actual computers we know how to build, but it still establishes a theoretical "fastest possible computer" that can be used in, for example, estimating the strength of cryptosystems.
Quantum computers escape this limit by doing almost all of their work using reversible operations. There is no theoretical minimum energy required for this, so (as far as I know) we do not know an upper bound for the "fastest possible quantum computer." In order to do useful work using reversible operations, a different system is used. Instead of bits we have qubits, which are just probabilistic bits. A classical bit can only say "this is definitely 0" or "this is definitely 1" but a qubit can say things like "this has a 60% chance of being 1." There are a bunch of reversible gates with names like the Pauli gate, Hadamard gate, etc. The details won't fit into a reddit comment, but these gates allow you to construct algorithms - but they're _different_ algorithms than the ones we know using classical gates. One famous example is Shor's algorithm, which factors large numbers with asymptotic time complexity O((log n)^(3)) (or perhaps a little better). Cryptosystems that depend on the difficulty of factoring large numbers, like RSA, may become vulnerable after we succeed in building large enough quantum computers. Currently, the quantum computers we can actually build are very tiny - the largest number we have actually factored using a real quantum computer is 56153. There are also crucial technical limitations on current quantum computers, like noise, precision and so on. So RSA is safe for a while yet.
But even if we learn to build large-scale quantum computers, that doesn't mean they are "more powerful" than classical computers. They just do different things, and in some ways are far less powerful. They are _not_ universal Turing machines - quantum computers don't have looping, conditionals, etc. So there are many important classical algorithms that cannot, even in principle, be executed on a quantum computer, no matter how large. In the future there might be devices that combine the features of both classical and quantum computing, but we're nowhere close to this yet. For the immediately foreseeable future, quantum computers will only function as a coprocessor attached to a classical computer, with the classical computer handling everything except the actual parallel computation. (One example: nobody's crazy enough to try to write a TCP stack in quantum gate logic, and even if they were, it would be a monumental waste of qubits. So a classical computer will always be needed if we want our quantum computer to be accessible over a network. This means we can't combine quantum computers into distributed systems.)
It's a really interesting field that I wish I had more opportunity to be involved with. | 280 | AskComputerScience |
ughqt2 | How do quantum computers processing power compare with the computing power of 3D chips of classical binary computers? | [deleted] | 30 | AskComputerScience |
ugksmb | Hi, I have a program that interacts with a whole bunch of crates that have their own error types. I also have my own. In total there are like 4 or 5; the standard error, actix-web, reqwest, geojson parsing, xml parsing.
How do I let these errors bubble through the program? I get that I return result<T, Error> from function calls, but afaik I cannot mix error types right? Does that mean I have to 'convert' error types in different stages of the program?
I was hoping there was some kind of way to rely on the fact that they all implement the same trait | I would suggest using [thiserror](https://docs.rs/thiserror/latest/thiserror/) crate or [anyhow](https://docs.rs/anyhow/latest/anyhow/) crate - depending on the usage of the errors thrown by your project.
Is your project a library (and the errors should be usable for anyone using your lib) or do you want to react in a special way to some of those errors from other crates? If so, then use `thiserror` - it will help you build new error types (meaningful to you or users of your lib) by wrapping the errors from different crates.
There are a lot of attributes that you can add to your errors to make them more usable (e.g. include the sourcing error inside your error struct/enum variant).
If you're building a binary application (e.g. a CLI) and the errors should just be reported to the user and the application should stop working - use anyhow. This will wrap the errors thrown by other crates "automatically", you just need to specify that your result type is either `anyhow::Result<YourType>` or `Result<YourType, anyhow::Error>` (these are equivalent, anyhow's Result type is an alias for the latter). The `anyhow` can also give you the option to pass more context to the application user so they can try to figure out what to do to fix the error (e.g. point to them that some file named `config.yml` should exist, but it's not).
I'm a beginner in Rust but this is what I've seen being done so far and that's what I'm using in my projects.
Probably there is a way also to combine both of them, but I've never done something like this and I'm not quite sure if this is a good idea.
Based on the crates you've listed I assume you're writing some kind of backend service - for the start I'd use anyhow, just for simplicity's sake.
If you would see later on that you need to handle some of the errors differently, I'd move those errors to another error type using `thiserror`.
Edit: fixed typos | 50 | LearnRust |
ugl5z8 | I am looking for help understanding how to solve this. Not the answer. Thank you | Bunch of print to consoles would probably work, and if it works it works
I take it you're an absolute beginner? | 90 | AskComputerScience |
ugl5z8 | I am looking for help understanding how to solve this. Not the answer. Thank you | I am irritated that the pole is not at the middle | 70 | AskComputerScience |
ugl5z8 | I am looking for help understanding how to solve this. Not the answer. Thank you | Ask yourself how do I print a X , and how do I print a space ? And then go from there | 30 | AskComputerScience |
ugodyc | How did your injuries and near-death experiences from unsafe equipment make you the person you are today? | Tetherball wrapping around the pole and hitting me in the face . | 520 | AskOldPeople |
ugodyc | How did your injuries and near-death experiences from unsafe equipment make you the person you are today? | [deleted] | 460 | AskOldPeople |
ugodyc | How did your injuries and near-death experiences from unsafe equipment make you the person you are today? | The seesaw helped you figure out which of your friends could be trusted. | 390 | AskOldPeople |
ugpvex | So I'm still fairly new to Rust, I've worked on some projects but all of them were sync.
I've been hearing some opinions on async Rust and I wanted to see what the general consensus was - is it really more complicated and less ergonomic than the rest of the language, or am I just hearing a vocal minority?
Rust is an extremely elegant language in my opinion so wanted to hear more about this aspect.
I have played around with `tokio` and such a bit and apart from cases of `.x().await?.y().await?` which aren't a huge issue but are a bit less clean, I haven't seen anything to indicate an issue.
I'm aware of async traits not being stable but there are workarounds.
What do you think?
Thanks! | I believe async is *alright*, it's generally less polished and you will eventually run into confusing error messages if you work with async functions, because they are a bit too much magic.
As a backend developer I encounter async a lot in my daily job and these async-related wtfs come up once every two months or so, and are easy to resolve but YMMV.
Altogether I would not avoid async due to its issues, it can be very useful.
I remember cursing at the following off the top of my head:
- Using mutexes without care in an `async fn` can be a huge footgun
- `async fn`-s may implicitly capture all arguments, including `&self`, and `async fn foo(&self) -> usize { 2 }` will not be a `'static` future, this can be solved by rewriting the function to return a future and async block instead: `fn foo(&self) -> impl Future<Output = 2> + 'static { async { 2 } } `.
- Using `!Send` values across `.await` points when the future is expected to be `Send` will make the compiler go crazy, it will tell the problem but won't tell you where it is exactly.
Note that the lifetime issues might be caused by `async-trait`, and will not happen with regular `async fn`s, I don't remember. | 130 | LearnRust |
ugpvex | So I'm still fairly new to Rust, I've worked on some projects but all of them were sync.
I've been hearing some opinions on async Rust and I wanted to see what the general consensus was - is it really more complicated and less ergonomic than the rest of the language, or am I just hearing a vocal minority?
Rust is an extremely elegant language in my opinion so wanted to hear more about this aspect.
I have played around with `tokio` and such a bit and apart from cases of `.x().await?.y().await?` which aren't a huge issue but are a bit less clean, I haven't seen anything to indicate an issue.
I'm aware of async traits not being stable but there are workarounds.
What do you think?
Thanks! | I don't have a ton of experience with async code myself, but I see lots of examples where the solution to some problem is something like `Pin<Box<dyn Future<Output = ...>>>`. This combines several different language features that tend to be less familiar to beginners:
- Both `Pin` (edit: woops I meant `Unpin`) and `Future` are traits, and they both combine beefy APIs with relatively subtle documented requirements and guarantees. Understanding every last detail of `Pin` isn't necessary to write most async code, but it does sometimes come up.
- `Box<dyn Future<...>>` is a dynamic trait object. Often we just don't have to think about these, but they're another important moving part in Rust that comes with some nontrivial restrictions, like the concept of ["object safety"](https://doc.rust-lang.org/reference/items/traits.html#object-safety).
If you've already played around with traits and gotten familiar with associated types and generic bounds and things like that,`Future` and `Pin` might be no sweat. On the other hand, if you haven't yet gotten much exposure to traits, async Rust might force you to learn a lot all at once. | 30 | LearnRust |
ugqqox | How did the 2007 recession mold you financially? Did it change the way you saved? | Yes! I saw the downturn as a chance to dump a bunch of money into retirement investments, knowing that eventually it was going to turn around.
It was literally the “buy low (wait to retire) sell high” investment period. I gained years of retirement savings I wouldn’t have had if the market just stayed on slow growth. | 230 | AskOldPeople |
ugqqox | How did the 2007 recession mold you financially? Did it change the way you saved? | No. I sold my house at the top of the top of the market on the west coast and 6 months later bought a house at the bottom of the market on the east coast. In 2015, I sold the east coast house and bought a house in Arizona just before the market doubled here.
I turned $200K of equity in to $2M through a combination of dumb luck and good timing. | 140 | AskOldPeople |
ugqqox | How did the 2007 recession mold you financially? Did it change the way you saved? | It made me ignore the swings (both big and small) when it comes to investing. I was reading everything I could about the economy, the roots of the problems, how QE works, derivatives, what caused the housing crisis, etc. I found it absolutely fascinating however I also found out that it was easy to get into the doom & gloom mindset. Luckily that phase didn’t last long and I pretty much stayed the course and obviously my investments recovered.
Now, I’m pretty numb to the daily swings. I still enjoy reading about the markets but I take it all with a grain of salt and look at the overall picture. I see people worrying about how much they’ve lost this year but completely ignoring how much they’ve gained over the last 10. I’m still following the same path for the most part (401k, dollar-cost-averaging) but I am more aggressive with my personal investment accounts when I see the opportunity.
Another by-product of living through that. It probably helped me to handle world-wide issues better. When the pandemic hit, I didn’t rush out and panic. My family focused on what we could do rather than freak out about the outside world. From an investment perspective, I invested a lot more than normal in March of 2020 and that worked out well. | 130 | AskOldPeople |
ugsvmt | Hello,
Ther's a tiling window manager (based on Penrose library) written in Rust which I'm trying to make it run on Alpine Linux. However, after compiling when trying to run the binary I get a "Segmentation fault" error. From my basic undersating this must be compiled with "--target x86\_64-unknown-linux-musl" but I'm still getting the same error.
Can someone help me with this please?
thanks | You could share the logs for starters. Set RUST_BACKTRACE=full and run in debug mode.
Did you test the app on a different OS, or is this Alpine specific? Segmentation fault after the program compiled fine is suspect. | 40 | LearnRust |
ugtva6 | If you're a fresh Rust developer, here's a great mentorship opportunity | "The program requires a commitment of 170 to 340 hours for three to six months"
That big a commitment without any pay? That's ridiculous. | 150 | LearnRust |
ugtva6 | If you're a fresh Rust developer, here's a great mentorship opportunity | I may be wrong but it looks like an unpaid internship, isn't it ? | 60 | LearnRust |
ugtva6 | If you're a fresh Rust developer, here's a great mentorship opportunity | What’s the difference between this and an unpaid internship? | 60 | LearnRust |
uh61ji | Consider a complete graph with nonnegative weighted edges, arranged in a circle. A triangulation of a complete graph is a subgraph such that no edges in it are crossing, but adding any edge would cause edges to cross. I want to find an efficient algorithm to find a triangulation of maximum total weight.
It's clear that as you go around the edge of the circle each edge will be added since they are nonnegative and can never cause a crossing.
I initially thought of greedy algorithms but I don't think any of them work.
I also tried considering a divide-and-conquer algorithm, like taking any vertex and iterating through all of the edges that one could select containing it, finding the maximal triangulation of the subgraph on either side of the edge. However, when I analyzed the runtime of this it seemed exponential and therefore not efficient. | > I also tried considering a divide-and-conquer algorithm, like taking any vertex and iterating through all of the edges that one could select containing it, finding the maximal triangulation of the subgraph on either side of the edge. However, when I analyzed the runtime of this it seemed exponential and therefore not efficient.
Are you sure? I haven't worked out all the details, but it seems to me that with this approach there would be O(n^(2)) subproblems, each of which can be handled in O(n) time, which means you can use dynamic programming to get an overall time complexity of O(n^(3)). (Each subproblem corresponds to an interval between some starting and ending node on the circle, and its solution is the maximum total weight that can be obtained using only the nodes and edges within that interval.) | 30 | AskComputerScience |
uh8cxq | I love all The New Rascals songs, especially the song, How Can I Be Sure sung by Eddie Brigati. | There's just too many to name .......but easily one of the most underrated bands are The Kinks, the put out 5 or 6 straight great albums starting in 1966 and hardly anyone seemed to notice at that time. They had been banned from performing live in the U.S.
The Rolling Stones put out some damn good music on 4 straight albums starting in 1968: Beggars Banquet, Let it Bleed, Sticky Fingers, and Exile on Main Street. 2 great non-lp singles at the same time: Jumping Jack Flash and Honky Tonk Women.
Then there's Led Zeppelin, Pink Floyd, and those 3 great mid-70's Queen albums: Sheer Heart Attack, A Night at the Opera, and A Day at the Races. | 60 | AskOldPeople |
uh8cxq | I love all The New Rascals songs, especially the song, How Can I Be Sure sung by Eddie Brigati. | Not big into favorites - I find them too limiting - but you asked about what was a golden age of music for me:
Simon and Garfunkel, Beatles, Rolling Stones, Bob Seger, Motown, The Who, Creedence Clearwater, Three Dog Night, Guess Who, Eagles, Elton John, Led Zeppelin, Rod Stewart, James Taylor, Joni Mitchell, Crosby Stills Nash and sometimes Young. Kinks. Bee Gees before Disco, Alice Cooper. It goes on an and on and on. | 50 | AskOldPeople |
uh8cxq | I love all The New Rascals songs, especially the song, How Can I Be Sure sung by Eddie Brigati. | Early 60's was The Beach Boys Three Dog Night and the Byrds. Then The Who, Humble Pie, Grateful Dead, Allman Bros. Band, Dave Mason, Deep Purple, CCR, John McLaughlin and the Mahavishnu Orchestra, Jefferson Airplane/Starship, Steve Miller Band and a whole lot of other bands. I got in to "undergrand FM" in the L.A. area (KNAC, KPPC, KMET and KLOS). Lots of good music and concerts going around then. | 40 | AskOldPeople |
uhg8t1 | What was it like to be part of the fight for the right to obtain a safe legal abortion? | My beloved grandma - white, happily married, solidly middle class - almost died from blood loss while lying on her dining room table in the 50s following a "successful" abortion. She suffered for years afterwards.
My wife and I protested in DC in the late 80s to protect pro-choice laws.
It felt important then, it's just as important now.
America's slide into a white Christian fascist oligarchy has been depressing to experience. | 2,600 | AskOldPeople |
uhg8t1 | What was it like to be part of the fight for the right to obtain a safe legal abortion? | What's it like??
It's like being the smartest, most compassionate person in a room where the people with single digit IQs and allergies to facts are making decisions.
It's like knowing the shortsightedness of the GOP will backfire spectacularly, but not before innocent lives are lost *( not talking about the fetus).
It's like having someone tell me that I can't masturbate on Sunday because they think I should be at church.
It's like yelling into a void because you know that the people on the opposing team don't give two shits about babies once they're born, but they'll "fight for their right to live."
They want them BORN. Not HOUSED. Not FED. Not CARED FOR.
If they were *really* pro-life, then they'd give a shit after the baby was born.
They don't, however, and the policies of the party for which they vote clearly reflect this.
They just can't be bothered to give a shit, no matter how much lip service they pay to the topic.
Their actions speak clearly on their behalf. And their actions tell you that, as a woman , you have zero say in what happens while you are pregnant.
Any of you, whether you have a penis or a vagina, who is fine with your neighbors being able to dictate whether or not you carry a pregnancy, any of you who believe you deserve a say in another woman's choice to end a pregnancy, can go str8 to hell and take your beliefs with you.
The only person you get to make reproductive decisions for is the one in the mirror.
Disagree? You can die mad about it. | 1,470 | AskOldPeople |
uhg8t1 | What was it like to be part of the fight for the right to obtain a safe legal abortion? | As an older woman, I will tell you that I am terrified for my granddaughter. I'm afraid for the girls she will grow up with, I'm even scared for her idiot mother. People are going to die because of this ruling. I literally,as in dictionary definition, just saw a headline that said the SC said that the leaked draft is authentic, and that Roberts is launching an investigation into the leak. I find it pathetic that they are more concerned about punishing the person who leaked this information than the people who's lives will end because of this ruling. Our grandchildren will be the people dying.
Let that sink in. Someone reading this will attend a funeral caused by an unsafe abortion. | 1,240 | AskOldPeople |
uhgmwl | What degree complements computer science other than science degrees like math, physics, engineering, etc? | Linguistics, operations research. | 240 | AskComputerScience |
uhgmwl | What degree complements computer science other than science degrees like math, physics, engineering, etc? | Pretty much all of them.
The strength of Computer Science lies in it being able to be comboed with almost anything. That said, of course some are maybe a bit better than others. Mathematics, and the natural sciences (physics, biology, earth sciences, to a lesser degree chemistry) are obvious picks.
Philosophy is of course a very sensible combination as well, Oxford university offers a CS+Phil degree for example: [https://www.ox.ac.uk/admissions/undergraduate/courses/course-listing/computer-science-and-philosophy](https://www.ox.ac.uk/admissions/undergraduate/courses/course-listing/computer-science-and-philosophy)
If you are especially interested in the business side of CS, then of course business related degrees are great. Economics, business, finance, psychology, media and communication are all possible combos that can be useful in the business arena.
If you are most interested in AI/cognitive science, then psychology, linguisitics, neurobiology are all very desirable options. | 210 | AskComputerScience |
uhgmwl | What degree complements computer science other than science degrees like math, physics, engineering, etc? | Business, Management/Engineering Management, Psychology (for UX) | 140 | AskComputerScience |
uhhvv1 | I have a function like this
fn evaluate<T>(&self, s: &State, a: Option<T>) -> Option<T>
where
T: num::PrimInt + std::iter::Sum + WrappingAdd + WrappingSub,
And now I realize I need to know the width of the argument.
(For context, this is part of something which needs to emulate part of the [STM8 instruction set](https://www.st.com/resource/en/programming_manual/cd00161709-stm8-cpu-programming-manual-stmicroelectronics.pdf). This instruction set has many operations which can take either an 8-bit operand or a 16-bit operand, hence the Generics. But I'm particularly getting stuck on the SWAP instruction. The SWAP instruction takes two halves of the operand, and swaps them over. For example, 0x1f becomes 0xf1, but 0x1234 becomes 0x3412.)
I'm looking for something like `T::width()` or something that can tell me where to actually split the word, but I can't seem to find it. Does anyone here know? Or am I simply taking the wrong approach here?
EDIT: Apologies for the goofy title; I realized after I posted it there's probably a clearer way to phrase the problem | You could possibly use [std::mem::size\_of<T>()](https://doc.rust-lang.org/std/mem/fn.size_of.html) but that does return the aligned size rather than the raw size, however this is equal for most primitive number types so if that covers your use case then great.
The other option would be to define your own trait with a `width` function and implement that trait for all supported types, for example:
trait SwapArgument
{
fn width() -> usize;
}
impl SwapArgument for u16
{
fn width() -> usize
{
2
}
} | 90 | LearnRust |
uhhvv1 | I have a function like this
fn evaluate<T>(&self, s: &State, a: Option<T>) -> Option<T>
where
T: num::PrimInt + std::iter::Sum + WrappingAdd + WrappingSub,
And now I realize I need to know the width of the argument.
(For context, this is part of something which needs to emulate part of the [STM8 instruction set](https://www.st.com/resource/en/programming_manual/cd00161709-stm8-cpu-programming-manual-stmicroelectronics.pdf). This instruction set has many operations which can take either an 8-bit operand or a 16-bit operand, hence the Generics. But I'm particularly getting stuck on the SWAP instruction. The SWAP instruction takes two halves of the operand, and swaps them over. For example, 0x1f becomes 0xf1, but 0x1234 becomes 0x3412.)
I'm looking for something like `T::width()` or something that can tell me where to actually split the word, but I can't seem to find it. Does anyone here know? Or am I simply taking the wrong approach here?
EDIT: Apologies for the goofy title; I realized after I posted it there's probably a clearer way to phrase the problem | Since you have a well-defined universe of possible types, I would be inclined to implement the actual swap as a trait on `u8` and `u16`¹ and then have the generic bounded on that trait and call the trait method. This way your code would avoid an `if` branch on the static size and since the logic for an 8-bit value is going to be very different than the logic for a 16-bit value since the former needs to operate on bits while the latter on bytes (and may well compile to a single instruction in machine code).
E.g.,
trait Swap<T> {
fn swap(self) -> Self;
}
impl Swap for u8 {
fn swap(self) -> u8 {
self.rotate_right(4)
}
}
impl Swap for u16 {
fn swap(self) -> u16 {
self.swap_bytes()
}
}
⸻
1. Assuming of course that these would be the correct types and not `i8` and `i16`. | 60 | LearnRust |
uhhvv1 | I have a function like this
fn evaluate<T>(&self, s: &State, a: Option<T>) -> Option<T>
where
T: num::PrimInt + std::iter::Sum + WrappingAdd + WrappingSub,
And now I realize I need to know the width of the argument.
(For context, this is part of something which needs to emulate part of the [STM8 instruction set](https://www.st.com/resource/en/programming_manual/cd00161709-stm8-cpu-programming-manual-stmicroelectronics.pdf). This instruction set has many operations which can take either an 8-bit operand or a 16-bit operand, hence the Generics. But I'm particularly getting stuck on the SWAP instruction. The SWAP instruction takes two halves of the operand, and swaps them over. For example, 0x1f becomes 0xf1, but 0x1234 becomes 0x3412.)
I'm looking for something like `T::width()` or something that can tell me where to actually split the word, but I can't seem to find it. Does anyone here know? Or am I simply taking the wrong approach here?
EDIT: Apologies for the goofy title; I realized after I posted it there's probably a clearer way to phrase the problem | In case you do ever need to actually get the concrete type instead of just using the size, the trait bound you will need is the [Any Trait](https://doc.rust-lang.org/std/any/trait.Any.html) which allows down casting an opaque type to a concrete type, though it does require `'static` | 30 | LearnRust |
uhjd3h | We are announcing a temporary moratorium on posts related to abortion, the Supreme Court and the leaked draft. We will review this before the weekend, and may post a megathread, but our current expectation is that a moratorium outside a megathread will last until the full release of the *Dobbs v. Jackson Women's Health* order, or further news or statements from the Court provide a more complete story which will make us reconsider.
This is a historic moment, and we recognize that. There has not been a decision leak from SCOTUS in nearly 40 years, and never in history has a draft been leaked. Discussions about just this relatively apolitical event might have been welcomed.
However, adding in the very contentious issue of abortion, a draft that is months old, and lack of any official news or statements, the comments and posts we have seen so far are not constructive to the purpose of this subreddit.
We must stress that while this is a subreddit about our culture, it is *not* a current events, debate, political news or conspiracy subreddit. People are understandably having very strong responses to this, and looking to vent with like-minded others. We try to keep things civil here, and part of that is waiting until there is more information and people are less reactionary to this shocking event. | When discussing the matter from this point forward we have to refer to it as a "special operation". | 900 | AskAnAmerican |
uhjd3h | We are announcing a temporary moratorium on posts related to abortion, the Supreme Court and the leaked draft. We will review this before the weekend, and may post a megathread, but our current expectation is that a moratorium outside a megathread will last until the full release of the *Dobbs v. Jackson Women's Health* order, or further news or statements from the Court provide a more complete story which will make us reconsider.
This is a historic moment, and we recognize that. There has not been a decision leak from SCOTUS in nearly 40 years, and never in history has a draft been leaked. Discussions about just this relatively apolitical event might have been welcomed.
However, adding in the very contentious issue of abortion, a draft that is months old, and lack of any official news or statements, the comments and posts we have seen so far are not constructive to the purpose of this subreddit.
We must stress that while this is a subreddit about our culture, it is *not* a current events, debate, political news or conspiracy subreddit. People are understandably having very strong responses to this, and looking to vent with like-minded others. We try to keep things civil here, and part of that is waiting until there is more information and people are less reactionary to this shocking event. | I’ll make sure to have popcorn ready for sale in the megathread | 790 | AskAnAmerican |
uhjd3h | We are announcing a temporary moratorium on posts related to abortion, the Supreme Court and the leaked draft. We will review this before the weekend, and may post a megathread, but our current expectation is that a moratorium outside a megathread will last until the full release of the *Dobbs v. Jackson Women's Health* order, or further news or statements from the Court provide a more complete story which will make us reconsider.
This is a historic moment, and we recognize that. There has not been a decision leak from SCOTUS in nearly 40 years, and never in history has a draft been leaked. Discussions about just this relatively apolitical event might have been welcomed.
However, adding in the very contentious issue of abortion, a draft that is months old, and lack of any official news or statements, the comments and posts we have seen so far are not constructive to the purpose of this subreddit.
We must stress that while this is a subreddit about our culture, it is *not* a current events, debate, political news or conspiracy subreddit. People are understandably having very strong responses to this, and looking to vent with like-minded others. We try to keep things civil here, and part of that is waiting until there is more information and people are less reactionary to this shocking event. | But we can still discuss the weather, right? | 730 | AskAnAmerican |
uhm9c9 | Were you looking for it, just happened at random, was something “arranged” (like actually arranged or even a blind date)? | I was just 19 and was already sick of the kind of guys that were always ready to jump my bones but never put anything into any kind of real connection. I took a look at myself and honestly assessed the kind of guy that would be good for me and also the kind of guy I'm attracted to. And I was sure it would take forever to find him but I would persevere and ignore all the ones that would be no good.
He showed up about 2 weeks later although it took quite a few months for me to decide maybe he was the one. We've been married since 1980. No regrets. It's been a ride - not exactly first class but a lot more fun and never boring. I never really cared about having it all. I only needed enough and I have a lot more than that. Now if only we could actually retire... | 90 | AskOldPeople |
uhm9c9 | Were you looking for it, just happened at random, was something “arranged” (like actually arranged or even a blind date)? | \> Have you ever found love? If yes, when?
Multiple times.! Most recently with the wonderful woman I married several decades ago. Many years, six kids, and a bunch of grandkids ago, we're still very much in love and incredibly happy to be together. | 50 | AskOldPeople |
uhm9c9 | Were you looking for it, just happened at random, was something “arranged” (like actually arranged or even a blind date)? | I was (1970) 18. She was 16. My sister, with whom I was very close (J.D. Salinger "Franny & Zooey" close) introduced us. We have been married 47 years this year. She has put up with a lot of my shenanigans, but it has never been boring. We have three children who tell us their love lives were ruined because they cannot aspire to the relationship my wife and I have. We are old now and beginning to talk about what happens when one of us must go. | 50 | AskOldPeople |
uhma4e | Hi,
I'm slowly learning that comparing programming environments is hard and its almost impossible to say that one language will always be faster than another for certain use cases..
However I ran into something peculiar now.
I have an application where I need to calculate the Intersection between polygons as part of an actix-web server. I need to do this between two groups of polygons. For this case consider a group of 300 polygons and another group (about 50). so 15.000 comparisons. This is not atypical.
I have this application in Node, using the turf module. Results vary of course, but its not strange for this to happen in around 15 seconds in the Node version. Obviously I turned to rust to speed this up.
I rewrote a prototype for this in Rust with the Geo crate, and.. it takes 26 seconds on average.
First thing I checked: Am I building a debug build? Classic error. But I wasn't.
Can someone shed some light on this?
some hypotheses:
\- The turf module in Node is not actually javascript under the hood?
\- I still have some build setting messed up somewhere | Can you show some code? Try to run benchmarks with flamegraph https://github.com/flamegraph-rs/flamegraph
It's possible that the node library has better optimizations. | 80 | LearnRust |
uhma4e | Hi,
I'm slowly learning that comparing programming environments is hard and its almost impossible to say that one language will always be faster than another for certain use cases..
However I ran into something peculiar now.
I have an application where I need to calculate the Intersection between polygons as part of an actix-web server. I need to do this between two groups of polygons. For this case consider a group of 300 polygons and another group (about 50). so 15.000 comparisons. This is not atypical.
I have this application in Node, using the turf module. Results vary of course, but its not strange for this to happen in around 15 seconds in the Node version. Obviously I turned to rust to speed this up.
I rewrote a prototype for this in Rust with the Geo crate, and.. it takes 26 seconds on average.
First thing I checked: Am I building a debug build? Classic error. But I wasn't.
Can someone shed some light on this?
some hypotheses:
\- The turf module in Node is not actually javascript under the hood?
\- I still have some build setting messed up somewhere | > First thing I checked: Am I building a debug build? Classic error. But I wasn't.
Next big gotcha areas are memory fragmentation and zillions of unnecessary copies. Putting all of you polygons in a contiguous array will likely be much much faster than putting them behind something like a hash table (where they can be strewn about the memoryspace) because of how caches work and the batch nature of your problem. If things are contiguous, make sure you're traversing your arrays in a memory-friendly way such that the "next" thing you're processing is the next thing _in memory_ as much as possible. And making unnecessary copies is...unnecessary. Double check that you're not `clone()`ing things you could pass by reference. | 50 | LearnRust |
uhma4e | Hi,
I'm slowly learning that comparing programming environments is hard and its almost impossible to say that one language will always be faster than another for certain use cases..
However I ran into something peculiar now.
I have an application where I need to calculate the Intersection between polygons as part of an actix-web server. I need to do this between two groups of polygons. For this case consider a group of 300 polygons and another group (about 50). so 15.000 comparisons. This is not atypical.
I have this application in Node, using the turf module. Results vary of course, but its not strange for this to happen in around 15 seconds in the Node version. Obviously I turned to rust to speed this up.
I rewrote a prototype for this in Rust with the Geo crate, and.. it takes 26 seconds on average.
First thing I checked: Am I building a debug build? Classic error. But I wasn't.
Can someone shed some light on this?
some hypotheses:
\- The turf module in Node is not actually javascript under the hood?
\- I still have some build setting messed up somewhere | I had to make this kind of thinks to create a tile server in rust I used https://github.com/georust/rstar | 30 | LearnRust |
uhss9t | Anyone got bruised up using Click Clacks? | Yes. Bruised forearms. Bruised foreheads. Bruised cheekbones. I don't know any kid who mastered them like the ones in the TV commercials. That was before CG, so the little monsters must've really learned how to do it. | 180 | AskOldPeople |
uhss9t | Anyone got bruised up using Click Clacks? | Oh yes. We used to bring those to school and have contests to see who could move their hand in and out of their path unharmed. I used those until they shattered little pieces into my eyes or the string broke! Good times. | 120 | AskOldPeople |
uhss9t | Anyone got bruised up using Click Clacks? | Of course...downright black and blue forearms at times as a kid.
Sometimes more painful places like a forehead and I have a memory of clacking myself in a thoroughly double-over painful way down where the delicate bits are parked: Though I can't figure out quite how that happened 50 years later.
And when the resin ball shattered, I remember there being blood. Both my red clackers and orange clackers eventually shattered with projectile flesh damage. Again, hard to remember if it was a Kid's version of blood where a pinprick looks like a garden hose or whether it was a bit more than that. | 100 | AskOldPeople |
uhtfb8 | How many friends do you have and how often do you see them? | Actual friends I enjoy? 3.
I see them less often than I’d like, but we text every day.
Acquaintances bore me now. I’d rather keep the circle small. | 150 | AskOldPeople |
uhtfb8 | How many friends do you have and how often do you see them? | 1 ..My wifes good friends husband. We have met 3 or 5 times? exchanged polite small talk about sports and the yard and the weather and went on our seperate ways. I dont know his name and i dont think he knows mine. We both are happy as can be with it. If i see him again in 5 months or so its good. | 110 | AskOldPeople |
uhtfb8 | How many friends do you have and how often do you see them? | I have very few people who I'd rather be with, than be alone. It's nobody else's fault, I just like being alone. | 90 | AskOldPeople |
uhvegr | [Duncan Yo Yo's 1976](https://www.youtube.com/watch?v=dfqykR14O3Y) | Never did. I couldn't do a single thing wih a yoyo. | 50 | AskOldPeople |
uhvegr | [Duncan Yo Yo's 1976](https://www.youtube.com/watch?v=dfqykR14O3Y) | I could do "around the world" and "walk the dog". Get a good quality yo-yo. You basically fling it strongly off the top of your palm downwards, and it should stay spinning there. Take it on a walk. Give it a light yank, it comes back up. | 30 | AskOldPeople |