Jump to content

Crabtr

Member
  • Posts

    237
  • Joined

  • Last visited

Everything posted by Crabtr

  1. Since the order is always going to be the same just use some basic string parsing to get what you want. I'm not sure what this would look like in PHP but in Python you'd do: text = "KBOS 280454Z 21009KT 10SM CLR 20/16 A3004 RMK AO2 SLP171 T02000156 40228014" text_split = text.split() date = text_split[1] winds = text_split[2] visibility = text_split[3] clouds = text_split[4] temp = text_split[5] alimeter = text_split[6]
  2. No, I know how it works very well. Like many (if not most) universities, my university's computer science program taught it to us very extensively. When I said "I hate object-oriented programming" and "OO already sucks" I didn't mean to imply that OOP is inherently bad (they were unnecessarily ambiguous statements so I've since corrected them). Rather, I meant that the current implementations of OOP are bad. I absolutely agree that the concept behind objects is great and forward-thinking but the implementation of the concept comes at costs far higher than it ever should have been. Objects should have been implemented as an extension of structs and not a completely separate thing. Perhaps more over though, programmers today are being taught and encouraged to write all of this boilerplate code even when they're creating tiny little static objects but a struct would have gotten them what they wanted with far less code and far less complexity. If I can cheerlead for Golang for a bit, I think they've done objects almost perfectly. Copying from sp13: type rect struct { width int height int } func (r *rect) area() int { return r.width * r.height } func main() { r := rect { width: 10, height: 5 } fmt.Println("area: " , r.area()) }
  3. I don't like C++ either but it's because I hate object-oriented programming. OO already sucks but all of the obnoxious boilerplate code that comes with it makes it suck a lot more. Edit: I don't hate OOP because I hate objects. Rather, I hate OOP because I hate the current implementations. See: here
  4. Echoing this. I started off learning Python but it wasn't until I started learning C++ that I really got a grasp of what exactly I was doing. Certainly a bit harder but definitely worth it.
  5. It doesn't have a first-class, built-in ORM like Django does but it does have really great support for SQLite and SQLAlchemy. For templating, it defaults to Jinja2 but you can use Django, Mako, and Chameleon as well.
  6. I only have experience making smaller websites and APIs and that's exactly why I use it. All of the routes and logic can be built into a single file. In that respect, it's very barebones and puts the dependence on you to implement the extra stuff you might need. I think it might also be lighter and easier to run but I'm not 100% sure. Miguel Grinberg has a pretty wonderful "hello world" series that covers a lot of Flask's strengths: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world This is an example of a fully functioning website with a JSON API. from flask import Flaskfrom flask import jsonifyapp = Flask(__name__)@app.route('/')def index(): return 'Hello World!' @app.route('/api')def api(): return jsonify(response='Hello world!')if __name__ == '__main__': app.run()
  7. Personally, I prefer Flask. It's lighter weight and much more simplistic to use.
  8. C and/or C++ coupled with QT (preferably) or GTK. Linux doesn't have an official user-interface library that's as first class as you're going to get. Java works but it's incredibly annoying to use a Java program.
  9. OS X comes with Clang pre-installed. Install Sublime text or Vim and start learning C and/or C++
  10. This is from my into to CS class freshman year so it's pretty rough but it works. Add in some validation loops and make it less crappy. def convert_13(): isbn = input("Enter ISBN-13: ") isbn2 = isbn isbn = isbn.replace("-", "") # Remove "978-" and check digit isbn = isbn[3:-1] total = 0 # Calculate the check digit for i in range(len(isbn)): char = int(isbn[i]) multi = i + 1 total += char * multi remainder = total % 11 # Roman numeral stuff if remainder == 10: output = x else: output = str(remainder) # ISBN-10 correct_isbn = isbn2[4:-1] + output return correct_isbn
  11. Since you're using Sublime I would suggest look into snippets! They're like key macros in terms of functionality but the total number you can have isn't limited to the number of key combinations you can make with your keyboard (so you can use a 60% or 40% like a real programmer ). Once setup snippets allows you to type a string, say "fun()," and then you either get a list of options to complete to or it'll autocomplete to something more valuable like "function() { }" with your cursor inside the parenthesis. You can also setup snippets which automatically inject the output from a command into a portion, it's a really wonderful and powerful tool. This video's directed towards Vim but everything covered can be done in Sublime text. http://vimcasts.org/episodes/meet-ultisnips/
  12. Python and Bash were were my first languages, then I learned Java and C++.
  13. Add-ons I can't live without: uBlock Origin Lastpass (Transitioning to Keepass though) BetterTTV RES (Reddit Enhancement Suite) Twitch Now Steam Enhanced JSON and XML formatters
  14. I prefer implicit. It's nicer looking, makes the code easier to traverse, and it allows you to much more easily hit those 80 character line limits. That being said though, I'm not going to really complain about being explicit if being implicit would be against the style guide; consistency is much more important. No space between the conditional and the open curly brace? You heretic!
  15. There's a lot of stuff it can be used for but the area where it really shines is scientific computing. Python fills a really big gap for scientists that want to use computers for computing but don't want to spend months or years learning how to program. NumPy, SciPy, Matplotlib, NLTK, and PIL/Pillow are a few of the really popular libraries that brings them to the language.
  16. Well, the big reason for getting a Raspberry Pi is the GPIO pins. After you get a solid, basic understanding of Python I'd start playing around with powering LEDs, getting sensor data, etc. After that I'd learn C and C++ and try to replicate everything you did before.
  17. I think one of the biggest things is that as you progress through your degree you shouldn't be focusing on the why but rather the how. Learning how to program is important and any good computer science course will teach you along the way but you need to make sure you're really soaking in the theories and ideas you're being taught and not their specific implementation. I'd say that you should be trying to maintain a nice 60/40 split or perhaps even closer to 75/25 in favor of theory over programmatic implementation. Also don't allow yourself to form bad habits. I'd really encourage you to follow an industry standard style for the languages you use and use proper source control (Git, Mercurial, etc.). Also register for Github's student pack! Functionality > aesthetics
  18. This is the git repo that that picture pulls from but it has some other ideas that weren't mentioned. https://github.com/keplr/programming-projects-for-n00bz
  19. Depending on what you're doing you can use exit() or sys.exit(), the latter likely being the one you want to use.
  20. A script would certainly work but rsync was built (and very well might I add) specifically for this task. https://rsync.samba.org/
  21. Heroku has a free version which works well enough. https://www.heroku.com/ If you have a valid student email (not necessarily still a student) then you can apply for Github's student pack and get a $100 Digital Ocean credit. https://education.github.com/pack https://www.digitalocean.com/
  22. I'd try and find or think of a project you could work on and devote a lot of your time towards over the summer and ideally into the next school year. You learn the best when you're genuinely interested in something and even more so when you're having fun. +1 for K&R
  23. There's 2 posters from /g/ that have 100 great exercises. Bonus points for picking the project based on a random number generator you made.
  24. The issue with finding projects for the Raspberry Pi is the vast majority of them already have prebuilt solutions and that's no fun. I want something that hasn't been made yet and I have to make myself. Think of something in your life that you could automate and go from there. I've been toying around with the idea of creating a digital assistant of sorts. It would be comprised of either a really large LED matrix or several medium sized ones and it would display stuff like the time, the weather, events from my calendar, what shows are coming on tonight, and cycle through the people I'm following on Twitch that are live. Assuming the Github api has the functionality, it could also display a notification when somebody I follow on Github starts a new project as well. I also want it to have alarm clock functionality and play a new song every morning as well as play a few internet radio stations when I get home from school (Monstercat, Fixt, 6forty radio, etc.).
  25. Yup. Kali is just a re-branding of Backtrack to appeal to those in the professional/enterprise fields. It was a really good move too, they gained a lot of popularity and subsequential support from the pivot.
×