Computer Science Lounge - [Too Many Idea Men Edition]

There’s lookahead/lookbehind that PCRE does that RE2 that’s faster does not, I guess you could have a negation over a lazy .* concatenated with ab

!(?[abc]*ab)[abc]* something like this … but I mostly work in go these days which has RE2 where this wouldn’t work

A big idea about with regexes IMHO is that they’re supposed to be readable, if your regex is complicated, don’t use them (use yacc to build a state machine on top of regexes, or if it’s just some simple configuration, build a parser by hand)

Probably the fastest way in code to do your problem in code would just be to use strstr to look for ab which would end up using SSE under the hood and the CPU wouldn’t even have to bother with branch prediction.

1 Like

cute program lol… i shouldnt taunt though… theres very few with knowledge like us on assembly

Its been a while since I wrote that. I think it would have been around one year ago. The thing with assembly is I have never needed to use it apart from a class so I am not sure where I could become a better assembly programmer.

I know thats why i said it was cute… the TA should have given you partial credit because its mostly working and you have the concept correct

from what I recall its missing like a return or something.

yes lol

1 Like

Personally I have found myself lately liking theoretical computer science for some reason. I dont know why but I enjoy sitting down and writing down some proofs.

I also enjoy c and c++ way more than any other language so maby for that reason I should devote some time to learn assembly again for some architecture.

2 Likes

Yes oh my god. thats the best thing you can do for yourself

^ This lol. I have found myself enjoying C way more than i did in python. Something about it makes it feel like your actually doing programming

If you have a SNES and a copy of SMW that might be a good place to start.

2 Likes

I will put that on my list of things to do.

Not sure if this is the appropriate place for this but, like I stated before, I am currently in uni for EE/CS.

I have a problem that I could use some help with, my CS class has no book and the lecture part is not meshing with me i.e. my teacher rambles making it hard for me to take notes, doesn’t explain much and always starts rushing at the end of class, so far ends up not completing the lecture every class.

3 in classes and I am already thinking I am falling behind, I have rented “Starting Out with C++: Early Objects (8th Edition)” and “The C++ Programming Language, 4th Edition” to try and catch up (these were recommend by the instructor, we are use c++)

I guess what I am trying to say, do any of you have some tips or any go to sources to help brute force this? I’m guessing my professor will be like this for the whole time, so I am getting ready to basically teach myself as I am not confident that I will pass this class otherwise.

1 Like

Stack overflow is your friend. Phrase your question as “<language> how to <problem>” and you will likely get stack overflow as a top result.

  • Ex. “c++ how to make a stack”

Do you have specific questions? Do you understand data types, data structures, methods, and classes?

1 Like

C++ is a complex beast, some people have been writing it since age 10 on their own, some people learn it at the uni, some people never have any formal education.

Most large organizations tend to come up with style guides and use a subset of c++ in their day to day - doing anything outside of that subset is frowned upon. This is also a major point of contention for the language standard to move forward and why things like boost or abseil exist… to create a common subset and make it easier to mix and match code.

Which subset are you supposed to be learning, I don’t know. It would be good if you could practice writing running code in something like a text editor until you’re used to the syntax you’re expected to be using.

In eastern Europe, there’s this concept of a type of book called “collection of problems”, it’s kind of like a workbook you may remember for maths but for programming languages or algorithms and datastructures these are meant to drill down syntax into your fingers. First chapter for c++ would be called something like “input/output”, going through it, you’d be writing code for a hundred short programs that read stuff in, and write it out. Next chapter you’d have loops, next chapter you’d have functions, and so on. They tend to work mostly universally across programming languages as well. Your ta, would pick some of those problems out, and analyze in front of students what makes a particular solution good or bad.

I’m sure you’ll be able to find something similar to help you bootstrapped with the basics.

https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list will get you through the language feature stuff

My cousin did a CE degree whereas I did more of a CS/SwE , and I happened to do algorithms and datastructures more in depth. In for years at the uni, nobody ever explained to him or his friends what a ring buffer is, as trivial a datastructure as it is, it was expected he’d pick it up on his own in order to do stuff with it.

Beyond classes and templates and operators, you might need to understand roughly what maps and vectors are, and eventually if/when you get to concurrency (we had 4 semesters of it of subjects with different names) you might be expected to know the basics of how to use mutexes and queues and threads and callbacks end executors and futures. Won’t have to design your own, but in this day and age of 16c/32t Threadripper, it’s more than likely to come up.

Ask your colleagues what they’re doing, ask them whenever you have small concrete questions about stuff, exchange/get someone’s lecture notes, there’s always one super organized person who has great notes around, spend more time studying and practicing.

2 Likes

Never looked there, started to poke around. Looks like a very helpful place, thank you!

I was mainly was look for a starting point. I had gotten some books and went on to youtube, but thought asking people who seem to be actively learning or using skilles learned would be helpful.

I must admit that while I did some coding when I was younger, darkbasic, python and “hello world” in c++, I have not coded in a decade+. I have an interest in coding and how computers work, however my knowledge is very superficial. I’m not the only one who is having an issue in this class, many people don’t take notes and most I talked to are saying they too are a little lost.

I really like this idea, never would have thought of looking for that. Going to find one.

These have all been really great answers and a good launching point, thank you very much!
Hopefully in future I’ll have something interesting to contribute, or at lest have a more compelling question other than “I’m new and don’t know what to do”

I am a TA for a C++ and C course actually.

If you are just interested in programming, then I would highly suggest reading a book. Pick a language (probably based on a project you think might be cool, or other context) and read the most suggested book (or take a look at a few).
If you want to lean how to ‘program’ there are several starter books (with more exercises etc.), usually suggested by the author of one of the books below, or others online

I highly recommend:
The C Programming Language (amazon, pdf)
The C++ Programming Language (amazon, pdf)
Dive Into Python 3
Python Data Science Handbook (O’REILLY, Online/JN)

Here is something I made for a class.

That’s pretty cool! We never used JavaScript/Node/Express/NPM in my school :frowning:

What made you go with html vs ejs and MySQL vs NoSQL (MongoDB, for instance)?

I had limited time and the goal wasnt to make it look nice. It just needed to be functional.

Network Administration count?