I have never done anything programming based but what to get into it. I was looking through code academy .Out of curiosity, which is the best programming languages to begin with if I am a beginner with no experience in programming ? This way I can pick a course from code academy.
Computer programming lounge
@lucario In my opinion, you should start with Ruby. It's a powerful high level language with great support. I'm following an online free software program called the Odin project. It guides you from beginner to professional in ruby/ruby on rails and/or js/jquery. I'm half way through and it's just the right guidance.
Quote: (12-18-2016 01:31 AM)Lucario Wrote:
I have never done anything programming based but what to get into it. I was looking through code academy .Out of curiosity, which is the best programming languages to begin with if I am a beginner with no experience in programming ? This way I can pick a course from code academy.
In the grand scheme of things, what language you choose does not matter. This is because all languages follow the same general programming control flow concepts (statements, loops, etc). Your first language will be the hardest because you have to learn the general programming semantics and control flow as well learning a language specific syntax.
Syntax = what constitutes a valid "line" of code. Semantics is what the code does. For example, creating a new variable in two separate languages:
Python: "feminist = false"
Java: "boolean feminist = false;"
Both of the lines do exactly the same thing at the hardware level; that is they both create s new space in memory equal to size of the type of variable needed, assign the value of that Boolean to that space, and create a reference to that spot in memory so every time you call the feminist variable the program knows what spot in memory it needs to go to find the value. That is semantics I.e. The meaning or the purpose of the code. Syntactically they are different, but they are both valid statements in their respective languages.
You can throw a dart at a dart board covered in programming languages and just pick whatever it hits. You will still learning basic semantics and the languages syntax.
That being said, that still doesn't help you decide on a language to start. Here's my two cents.
-You want a language that is known for being syntactically easy to read. This will help reduce the learning curve of the syntax portion.
-You want a language with high level of online support for debugging purposes
-you want a language with useful error messages for debugging purposes
-You want a language with easy to access and easy to follow documentation. Learn to read a languages documentation.
-You want an object orient language.
I would recommend two. They are both the midst widely used languages in university computer science departments: Java.
1. Java - Java is harder than Python because it is a typed language. That means your variables can not change types. Our feminist variable above is a Boolean (a true/false value), in Java I can not take that variable and make it an Integer. This an The static keyword give people some trouble.
2. Python - Python is probably one of the easiest languages to learn. It is untyped language, it tons of online support, the syntax is very user friendly. It's help keyword is fantastic and the documentation is fantastic as well. It has an Python interpreter so you can run your code line by line manually entering it, this is useful sometimes for playing around and debugging what's going on or some simple testing.
As far as what is the most in demand language from an employers point of view: Java is huge. Python is a rising star. And many people say JavaScript (not related at all to Java) is going to the king of the hill in the next 5-10 years. I can't comment much on JavaScript because I have very little experience in it. It was the first language I used and I made a fun little "Drug Wars" style browser based game, but I haven't touched it since then.
In conclusion: it really doesn't matter what language you start with. Just go start slinging code.
God'll prolly have me on some real strict shit
No sleeping all day, no getting my dick licked
The Original Emotional Alpha
A small correction:
Quote:Quote:
Python: "feminist = False"
Quote: (12-21-2016 11:51 PM)FretDancer Wrote:
A small correction:
Quote:Quote:
Python: "feminist = False"
Yeah I noticed that after the post. I was on my phone, there's tons of little misspellings/grammar errors in there.
I also wanted to add a portion on the OPs desired route.
Is it phone apps? If so Java would be a great start as that's what Android uses. Not sure what apples uses, swift or something this is similar to C?
Is it embedded systems/DIY tech using androids or similar microcontrollers? I would say Python in that case to get some experience with programming and playing with a raspberry Pi. But could jump into the arduino off the bat using c++/c.
Is it web development? JavaScript would be great due to the NodeJS stacks. Python is great due to the Django framework. Ruby is great for the Rails framework.
So many options, each with their own pros and cons. That's why I said just pick a language and start crushing it.
Do the courses online first and then push yourself to do your own stuff. I do a lot of my work in coffeee shops, so My first step was to develop a website for the coffee shop if I was learning some web stuff or maybe a textual UI POS system (obviously just a fake one on my laptop). TIc Tac Toe game is a prettt simple starting program in most languages. Use print statements to draw the board on the screen, ask for user input to place pieces, check on every placement for a winning combination. Then when it's done, develop an AI so the human can play against the computer.
God'll prolly have me on some real strict shit
No sleeping all day, no getting my dick licked
The Original Emotional Alpha
As someone who career switched 18 months ago, and took up code 2.5 years ago, it really doesn't matter which language you pick. More importantly is the concepts of programming. I'd suggest 1 of the popular web languages, unless you are in a niche or academic environment in which a lower level language is the norm/method of instruction.
Java is great because Android and enforces good OOP, but don't discount Javascript. Many mobile apps are being built in pure JS on top of a native layer. I did this, built an simple app on Ionic2 a few months ago, and its a good convo starter and displays value instantly if job hunting.
Java is great because Android and enforces good OOP, but don't discount Javascript. Many mobile apps are being built in pure JS on top of a native layer. I did this, built an simple app on Ionic2 a few months ago, and its a good convo starter and displays value instantly if job hunting.
Quote: (12-22-2016 12:51 PM)jj90 Wrote:
I'd suggest 1 of the popular web languages, unless you are in a niche or academic environment in which a lower level language is the norm/method of instruction.
Not always. I work as a lecturer and I can confirm that it's not the case. It is true that lower level languages are being taught, but this is only for the 1st year students because a good part of them are completely newbies to programming and think that if you can successfully log in to Facebook, then you're a programmer. There we have logical schemes and Pascal because the main focus is to teach them how to correctly think and write a program. Thinking comes first at this stage.
The next years, more difficult concepts are taught: OOP, basics of Windows programming, UI design etc. To follow suit, the visual languages are being used. I know about Delphi and Visual C++ being used here (don't know if C# was introduced, but I think not, because it's much more complicated). The graduates (4th year) have solid knowledge of both lower and higher level languages.
The main obsession of my students is that they don't learn languages that are fashionable today, forgetting that a) programming basics are much more important and b) they can study any language they like in their spare time, c) because a language is fashionable now, doesn't always mean it's superior or appropriate for a task and d) fashion comes and goes and perhaps C# won't be in 10 years as fashionable as it is now.
Make Romania Great Again
Has anyone here heard of anyone from the US getting a US-based client/employer who let them work virtually from SEA (like Manila, Bangkok, etc.)?
I am 42, have an MBA (not from a top tier school), work in a sales-type job, and know a little bit about computer science. I'd love to move to Manila (to bang younger women), but with the way my finances are, my earliest retirement there would be by age 60. But I'm wondering if I learned a particular computer language/framework in the next couple of years and found a good niche that I could work in, perhaps I could afford to move to SEA earlier by making my money virtually? Do you guys think such a strategy would be feasible?
Would being an American freelance programmer who happens to live in SEA and has some business and sales skills, help in getting US based clients or would the other "foreign" freelance competition be more attractive because of lower costs? There is a lot of competition on Freelance.com & Fiverr, and I don't think I could do very well financially while competing with them.
I am 42, have an MBA (not from a top tier school), work in a sales-type job, and know a little bit about computer science. I'd love to move to Manila (to bang younger women), but with the way my finances are, my earliest retirement there would be by age 60. But I'm wondering if I learned a particular computer language/framework in the next couple of years and found a good niche that I could work in, perhaps I could afford to move to SEA earlier by making my money virtually? Do you guys think such a strategy would be feasible?
Would being an American freelance programmer who happens to live in SEA and has some business and sales skills, help in getting US based clients or would the other "foreign" freelance competition be more attractive because of lower costs? There is a lot of competition on Freelance.com & Fiverr, and I don't think I could do very well financially while competing with them.
@Dumb genius: Yes, but you need to be in a position in your career and life where that company is going to be able to trust you to do so. Can you learn to code? Sure. Are you going to experience massive discrimination? Absolutely.
Most developers in their 40s have years of experience corporate side and usually are at mid-senior level. I'm speaking purely from a corp gig standpoint.
If you want to go indie, then it's less of an issue and your background actually helps. However the trade off is you are competing against every other freelancer in the world. It's not a job then, it's a business. Hell, you could just oversee the project/work being done and outsource to other local developers to do the actual dev work, but then you'd still need to be able to understand the code you are staring at before you ship it.
Most developers in their 40s have years of experience corporate side and usually are at mid-senior level. I'm speaking purely from a corp gig standpoint.
If you want to go indie, then it's less of an issue and your background actually helps. However the trade off is you are competing against every other freelancer in the world. It's not a job then, it's a business. Hell, you could just oversee the project/work being done and outsource to other local developers to do the actual dev work, but then you'd still need to be able to understand the code you are staring at before you ship it.
I taught myself to code a few years ago and have made my living working remotely as a software developer since then.
I wrote a post on my blog about how to learn to code in 6 months:
February 4, 2017 by Rafael D
When learning to code, there is no such thing as the easy way. There is only the right way, and the right way is to power through the hard way as quickly as possible.
– Rafael D
✅ DO pick one popular language and stick with it
I see beginners ask this question a lot – which language to choose?
In the beginning you should pick a popular language with a lot of demand, because there will be plenty of help available online and any problem you run into will probably have an online solution already.
At the time of writing I would recommend JavaScript because there is so much demand for JS developers. It will be very easy to get a job if you are good. Plus you get to see your code working in your browser right away which is fun and motivating.
Other good beginner choices are Ruby or Python. Both are powerful languages with a relatively easy learning curve.
Pick one language and stick with it for at least six months.
❌ DO NOT “language hop”
Language hopping is when you spend a couple of weeks on one language, decide it’s too hard and move on to another one instead. It’s caused by the fear that the language you are learning is the “wrong one” and you are “wasting your time”.
The real waste of time is to keep switching between languages so that you never stick around long enough to learn anything.
When you switch languages the moment it becomes difficult you skip the step that would cause you to actually learn something. The process of pushing through the difficulty is what causes you to learn the language.
If you go back to square one with another language it will only be a matter of time before you run into the same roadblock again and all that time will have been wasted.
Learning a popular language is never a waste of time as long as you stick with it.
Once you learn your first language well enough, you can branch out and try others. But in the beginning you need laser focus on just one.
✅ DO learn by rote typing to build example apps
Find an example of a good program, then type it out and run it. There are thousands of online tutorials and books available for any popular language. Find one that takes you through building a simple app in your chosen language. Work through the examples in there and build the app yourself.
If you run into a problem, debug it yourself.
Here’s a secret most coders won’t tell you: a huge part of your job is figuring out why something is not working. So it pays to start learning these skills early on in the game.
If you give up trying to fix a bug and “cheat” by downloading the working version instead, you are really cheating yourself. You will waste your time and learn nothing this way.
✅ DO learn from doing drills and exercises.
Try rubymonk, codeacademy, clojurekoans… there are many websites out there with coding drills. These are an excellent way to sharpen your skills.
❌ DO NOT try to “learn” by copying/pasting code from examples
Copying/pasting code from examples may seem like you are saving time but in actual fact you are wasting time because you will learn precisely nothing from doing this.
When working from an example, you must read the example, then type the code out with your own fingers. I cannot stress how important this is. You must learn the feeling of creation, which can only happen when the code comes from your own fingers.
✅ DO pick the right OS for your language
If you want to build games, you should probably use Windows and the Microsoft toolchain. If you want to build iOS apps, get a Mac. If you want to develop in Python or Ruby, you’ll have a much easier time on a Unix system (linux or OS X).
Do not make things even harder for yourself by going against the flow and using a language that is not designed to work well on your OS (e.g. Ruby on Windows).
✅ Stack Overflow is your friend
Programmers spend at least 50% of their time googling how to solve problems. Learn to get good at Googling for solutions to why your code isn’t working, and learn to love Stack Overflow for showing you the way.
✅ DO read good code
Find a great program in your chosen language and spend time reading random parts of it.
We live in a wonderful world where all the best programs are open source. It doesn’t matter if you don’t understand what it is doing, just looking at the shape of how the language is laid out on the page, the names chosen, the comment styles – these things will all teach you the essence of good style.
Here are a few examples of great code:
Postgres (written in C)
Rails (written in Ruby)
Django (written in Python)
Luminus (written in Clojure)
React.js (written in JavaScript)
Shop around for a project you like, there are thousands of examples out there on github.
✅ DO learn about databases
Relational databases are boring, but they power a huge portion of the software you see and interact with every day. They are here because they work and they will still be here in twenty years time.
Learn as much as you can about SQL and how databases work, because this will always be useful knowledge.
Forget about NoSQL for now. You must learn the meat and potatoes of relational databases before you can have an educated opinion on the benefits of NoSQL databases and when they are the right/wrong choice.
✅ DO spend time learning the scaffolding
Scaffolding is all the little tedious jobs that surround and support the actual act of coding. These are things like
Setting up databases
Figuring out which version of Ruby to use
Setting up your terminal properly
Configuring your text editor to properly syntax-highlight your code
Debugging networking issues
Learning to use docker
Understanding provisioning (for iOS)
etc…
These tedious tasks are the nitty gritty of your profession and you’ll spend a large portion of your professional career dealing with this stuff, so learn to do it properly.
You cannot skip over this step because it is an inescapable part of your job.
✅ DO give yourself a reason to succeed, and a deadline
I “tried” to learn code for years before I finally decided I was going to learn no matter what, and that pushed me over the hump.
I spent years spinning my wheels and making no real progress because I didn’t have a clear, compelling reason to succeed.
Then one day I quit my job and decided I would make my living writing code, and that pushed me over the edge.
I only had a few months of savings and during that time I sat in my house every day and fought my way through programming books. I did not go out and party. I did not take days off, except for Sundays. I did not spend time on Facebook or Instagram. I did not work another job and learn to code on the side. I did not look to either side of me, only straight ahead. I had tunnel vision.
When my cash ran out I went to my local co-working space and asked everyone in sight if they needed a developer. Lo and behold, somebody did (somebody always does…) and I built a site for them.
I worked 18 hour days to learn on the job and deliver what they needed. After that I hopped from one job to another, getting paid more and more each time and it was pretty much plain sailing from there.
When looking for your first clients, I recommend early stage startups. You can find them at incubators and co-working spaces.
Startups are great for learning to code. They don’t pay much but they are willing to accept less experienced coders to save money. They are more tolerant of mistakes and willing to accept a sub-standard product (and your first effort will be sub-standard). Look at it like a paid apprenticeship.
❌ DO NOT give up
If you’re feeling demoralized, take a break and come back again the next day. You will get it eventually if you stick at it, that’s a promise.
✅ DO write code for at least an hour every single day
You must write code every day. You are allowed one day off per week, other than that there are no excuses.
If you do not write code every day, you are not a coder. You are someone who wishes they could code but is actually destined to remain stuck in their shitty office job forever instead.
--
Original post is here: http://fireandforget.co/2017/02/04/teach...ix-months/
I wrote a post on my blog about how to learn to code in 6 months:
February 4, 2017 by Rafael D
When learning to code, there is no such thing as the easy way. There is only the right way, and the right way is to power through the hard way as quickly as possible.
– Rafael D
✅ DO pick one popular language and stick with it
I see beginners ask this question a lot – which language to choose?
In the beginning you should pick a popular language with a lot of demand, because there will be plenty of help available online and any problem you run into will probably have an online solution already.
At the time of writing I would recommend JavaScript because there is so much demand for JS developers. It will be very easy to get a job if you are good. Plus you get to see your code working in your browser right away which is fun and motivating.
Other good beginner choices are Ruby or Python. Both are powerful languages with a relatively easy learning curve.
Pick one language and stick with it for at least six months.
❌ DO NOT “language hop”
Language hopping is when you spend a couple of weeks on one language, decide it’s too hard and move on to another one instead. It’s caused by the fear that the language you are learning is the “wrong one” and you are “wasting your time”.
The real waste of time is to keep switching between languages so that you never stick around long enough to learn anything.
When you switch languages the moment it becomes difficult you skip the step that would cause you to actually learn something. The process of pushing through the difficulty is what causes you to learn the language.
If you go back to square one with another language it will only be a matter of time before you run into the same roadblock again and all that time will have been wasted.
Learning a popular language is never a waste of time as long as you stick with it.
Once you learn your first language well enough, you can branch out and try others. But in the beginning you need laser focus on just one.
✅ DO learn by rote typing to build example apps
Find an example of a good program, then type it out and run it. There are thousands of online tutorials and books available for any popular language. Find one that takes you through building a simple app in your chosen language. Work through the examples in there and build the app yourself.
If you run into a problem, debug it yourself.
Here’s a secret most coders won’t tell you: a huge part of your job is figuring out why something is not working. So it pays to start learning these skills early on in the game.
If you give up trying to fix a bug and “cheat” by downloading the working version instead, you are really cheating yourself. You will waste your time and learn nothing this way.
✅ DO learn from doing drills and exercises.
Try rubymonk, codeacademy, clojurekoans… there are many websites out there with coding drills. These are an excellent way to sharpen your skills.
❌ DO NOT try to “learn” by copying/pasting code from examples
Copying/pasting code from examples may seem like you are saving time but in actual fact you are wasting time because you will learn precisely nothing from doing this.
When working from an example, you must read the example, then type the code out with your own fingers. I cannot stress how important this is. You must learn the feeling of creation, which can only happen when the code comes from your own fingers.
✅ DO pick the right OS for your language
If you want to build games, you should probably use Windows and the Microsoft toolchain. If you want to build iOS apps, get a Mac. If you want to develop in Python or Ruby, you’ll have a much easier time on a Unix system (linux or OS X).
Do not make things even harder for yourself by going against the flow and using a language that is not designed to work well on your OS (e.g. Ruby on Windows).
✅ Stack Overflow is your friend
Programmers spend at least 50% of their time googling how to solve problems. Learn to get good at Googling for solutions to why your code isn’t working, and learn to love Stack Overflow for showing you the way.
✅ DO read good code
Find a great program in your chosen language and spend time reading random parts of it.
We live in a wonderful world where all the best programs are open source. It doesn’t matter if you don’t understand what it is doing, just looking at the shape of how the language is laid out on the page, the names chosen, the comment styles – these things will all teach you the essence of good style.
Here are a few examples of great code:
Postgres (written in C)
Rails (written in Ruby)
Django (written in Python)
Luminus (written in Clojure)
React.js (written in JavaScript)
Shop around for a project you like, there are thousands of examples out there on github.
✅ DO learn about databases
Relational databases are boring, but they power a huge portion of the software you see and interact with every day. They are here because they work and they will still be here in twenty years time.
Learn as much as you can about SQL and how databases work, because this will always be useful knowledge.
Forget about NoSQL for now. You must learn the meat and potatoes of relational databases before you can have an educated opinion on the benefits of NoSQL databases and when they are the right/wrong choice.
✅ DO spend time learning the scaffolding
Scaffolding is all the little tedious jobs that surround and support the actual act of coding. These are things like
Setting up databases
Figuring out which version of Ruby to use
Setting up your terminal properly
Configuring your text editor to properly syntax-highlight your code
Debugging networking issues
Learning to use docker
Understanding provisioning (for iOS)
etc…
These tedious tasks are the nitty gritty of your profession and you’ll spend a large portion of your professional career dealing with this stuff, so learn to do it properly.
You cannot skip over this step because it is an inescapable part of your job.
✅ DO give yourself a reason to succeed, and a deadline
I “tried” to learn code for years before I finally decided I was going to learn no matter what, and that pushed me over the hump.
I spent years spinning my wheels and making no real progress because I didn’t have a clear, compelling reason to succeed.
Then one day I quit my job and decided I would make my living writing code, and that pushed me over the edge.
I only had a few months of savings and during that time I sat in my house every day and fought my way through programming books. I did not go out and party. I did not take days off, except for Sundays. I did not spend time on Facebook or Instagram. I did not work another job and learn to code on the side. I did not look to either side of me, only straight ahead. I had tunnel vision.
When my cash ran out I went to my local co-working space and asked everyone in sight if they needed a developer. Lo and behold, somebody did (somebody always does…) and I built a site for them.
I worked 18 hour days to learn on the job and deliver what they needed. After that I hopped from one job to another, getting paid more and more each time and it was pretty much plain sailing from there.
When looking for your first clients, I recommend early stage startups. You can find them at incubators and co-working spaces.
Startups are great for learning to code. They don’t pay much but they are willing to accept less experienced coders to save money. They are more tolerant of mistakes and willing to accept a sub-standard product (and your first effort will be sub-standard). Look at it like a paid apprenticeship.
❌ DO NOT give up
If you’re feeling demoralized, take a break and come back again the next day. You will get it eventually if you stick at it, that’s a promise.
✅ DO write code for at least an hour every single day
You must write code every day. You are allowed one day off per week, other than that there are no excuses.
If you do not write code every day, you are not a coder. You are someone who wishes they could code but is actually destined to remain stuck in their shitty office job forever instead.
--
Original post is here: http://fireandforget.co/2017/02/04/teach...ix-months/
My blog: https://fireandforget.co
"There's something primal about choking a girl. I always choke a girl as soon as possible after meeting her, it never fails to get the pussy juices flowing."
Good post rafaeld.
Another tip I would like to give is to get used to start solving programming/mathematical problems using your favorite language or any language you are interested in learning.
My two favorite places for solving problems are Project Euler and Exercism.
What I like about Exercism is that other people will review your code and point out bad practices you might be making in your code, as well as giving tips on how to improve your code (readability, good practices, performance, speed, etc.)
A good solid habit would be to solve (or at least try to) one of these problems every day.
DO NOT Google for the answers. On some problems in Project Euler you will be required to Google or read about a certain topic that the problem is based on (Prime numbers, certain sequences, sorting algorithms). This is fine and encouraged, you should start getting familiar with the theory of these topics, so that you can implement them on your own using a programming language. This is one of the beauties of programming.
Good luck everyone.
Another tip I would like to give is to get used to start solving programming/mathematical problems using your favorite language or any language you are interested in learning.
My two favorite places for solving problems are Project Euler and Exercism.
What I like about Exercism is that other people will review your code and point out bad practices you might be making in your code, as well as giving tips on how to improve your code (readability, good practices, performance, speed, etc.)
A good solid habit would be to solve (or at least try to) one of these problems every day.
DO NOT Google for the answers. On some problems in Project Euler you will be required to Google or read about a certain topic that the problem is based on (Prime numbers, certain sequences, sorting algorithms). This is fine and encouraged, you should start getting familiar with the theory of these topics, so that you can implement them on your own using a programming language. This is one of the beauties of programming.
Good luck everyone.
Code Abbey and Rosalind are worthwhile as well.
I spent some time doing Project Euler problems last summer and it was both fun and very, very helpful in honing my problem solving approach and ability to build efficient algorithms. But I ran out of math before I ran out of programming skill. I solved about 55 problems over a couple weeks, almost all in regular Python adhering to the < 60 second limit--I'd switch to PyPy or Go on rare occasions if I couldn't see how to simplify the algorithm, and I'd never check an answer if I didn't have at least one solution running under 60 seconds--but I just don't have the hard math skills to do most of the problems over 100. The only problem I solved over 100 was 301, which was trivial.
As I recall, higher level problems at Project Euler often rely on knowing math shortcuts that few programmers will ever have to apply. 301 is a good example. The algorithm is not obvious but if you already know it, as I did, it's simple. It took less than 15 lines of code in Go and returned the correct answer in < 3 seconds on my first try. I never did figure out how to do it quickly in Python, though, because the method I used in Go is not available in Python in any sort of efficient manner (that I know of). I'd probably need to write a new C extension to handle the math, and at that point, I might as well have just done it in Go to begin with. Which is what I did when my Python solution was running 40 minutes, and PyPy was taking 2 1/2 minutes.
I'd like to learn more math and I'm sure lots of the Project Euler problems are nifty if you know how to solve them elegantly, but my time is finite, and I'll wait until I actually need to know more math for a specific real-world problem to put the time in. I got what I wanted out of Project Euler, so I don't care about solving a bunch more problems solely for bragging rights.
I spent some time doing Project Euler problems last summer and it was both fun and very, very helpful in honing my problem solving approach and ability to build efficient algorithms. But I ran out of math before I ran out of programming skill. I solved about 55 problems over a couple weeks, almost all in regular Python adhering to the < 60 second limit--I'd switch to PyPy or Go on rare occasions if I couldn't see how to simplify the algorithm, and I'd never check an answer if I didn't have at least one solution running under 60 seconds--but I just don't have the hard math skills to do most of the problems over 100. The only problem I solved over 100 was 301, which was trivial.
As I recall, higher level problems at Project Euler often rely on knowing math shortcuts that few programmers will ever have to apply. 301 is a good example. The algorithm is not obvious but if you already know it, as I did, it's simple. It took less than 15 lines of code in Go and returned the correct answer in < 3 seconds on my first try. I never did figure out how to do it quickly in Python, though, because the method I used in Go is not available in Python in any sort of efficient manner (that I know of). I'd probably need to write a new C extension to handle the math, and at that point, I might as well have just done it in Go to begin with. Which is what I did when my Python solution was running 40 minutes, and PyPy was taking 2 1/2 minutes.
I'd like to learn more math and I'm sure lots of the Project Euler problems are nifty if you know how to solve them elegantly, but my time is finite, and I'll wait until I actually need to know more math for a specific real-world problem to put the time in. I got what I wanted out of Project Euler, so I don't care about solving a bunch more problems solely for bragging rights.
Quote:Quote:
It took less than 15 lines of code in Go and returned the correct answer in < 3 seconds on my first try. I never did figure out how to do it quickly in Python, though, because the method I used in Go is not available in Python in any sort of efficient manner (that I know of).
I cannot program in Go, but I am curious of this method you say? Would like to know why you say it is not available in Python.
Quote:Quote:
I'd like to learn more math and I'm sure lots of the Project Euler problems are nifty if you know how to solve them elegantly, but my time is finite, and I'll wait until I actually need to know more math for a specific real-world problem to put the time in. I got what I wanted out of Project Euler, so I don't care about solving a bunch more problems solely for bragging rights.
Solving Project Euler problems can sure be time consuming. It's been a while since I've visited the site. However I feel that instead of tackling the more difficult problems, it is a good idea to go back to the first easier problems and refactor your code.
When I solved the easy problems I would take a quick peek at other people's solutions that show in the list, and I would just laugh at how horrible their solution's code was.
Quote: (02-07-2017 03:47 AM)FretDancer Wrote:
Good luck everyone.
The great thing about programming is that you don't need luck, you just need persistence and a hard-headed determination to "get it".
My blog: https://fireandforget.co
"There's something primal about choking a girl. I always choke a girl as soon as possible after meeting her, it never fails to get the pussy juices flowing."
Another great way to hone your skills if you're a newbie is to apply a drill used by writers of short stories. First time you write your program just focus on getting it done. Then go back and attempt to make it 10 lines shooters. Then go back and do it again. So and so forth until you look at you're code and can't see a single line that could be removed or a single method that could be simplified without breaking the program.
Doing this helps you learn valuable tricks in your language or choice but it more importantly make you really think about what the code is doing and how it actually gets there.
Super simple example would be reducing a method that returns a Boolean based on a pramter being an odd number.
pass 1 you go with the basic if/else flow with the modulus operator.
Pass 2 maybe you realize that the else is pointless, and you go with "If X return True; return False". That's one less line!
Pass 3 maybe you go with ternary operator, now you're at one line.
Pass 4 maybe you get annoyed with ternary operators lack of readability and decide to bit shift on the input parameter, because obviously any odd integer will have a 1 in the first bit.
Pass 5 maybe you're at a loss of how to simplify the logic down below the bit shift. You can go crazy and remove as much white space as possible. Now you went from measuring the length of your program by lines to measuring by individual characters.
It's a great exercise when learning how to properly structure a class as well.
Doing this helps you learn valuable tricks in your language or choice but it more importantly make you really think about what the code is doing and how it actually gets there.
Super simple example would be reducing a method that returns a Boolean based on a pramter being an odd number.
pass 1 you go with the basic if/else flow with the modulus operator.
Pass 2 maybe you realize that the else is pointless, and you go with "If X return True; return False". That's one less line!
Pass 3 maybe you go with ternary operator, now you're at one line.
Pass 4 maybe you get annoyed with ternary operators lack of readability and decide to bit shift on the input parameter, because obviously any odd integer will have a 1 in the first bit.
Pass 5 maybe you're at a loss of how to simplify the logic down below the bit shift. You can go crazy and remove as much white space as possible. Now you went from measuring the length of your program by lines to measuring by individual characters.
It's a great exercise when learning how to properly structure a class as well.
God'll prolly have me on some real strict shit
No sleeping all day, no getting my dick licked
The Original Emotional Alpha
Quote: (02-07-2017 09:31 PM)FretDancer Wrote:
Quote:Quote:
It took less than 15 lines of code in Go and returned the correct answer in < 3 seconds on my first try. I never did figure out how to do it quickly in Python, though, because the method I used in Go is not available in Python in any sort of efficient manner (that I know of).
I cannot program in Go, but I am curious of this method you say? Would like to know why you say it is not available in Python.
That was misleading, "not available" isn't correct. I used a simple bitwise XOR solution and it's just amazingly slow in Python. I tried four or five different Python ways of doing bitwise XOR and never got it under 150 seconds or so (PyPy). In Go, I presumably was able to benefit from optimization during compilation.
Thinking about it now, I could probably have tweaked the algorithm and logic to dramatically speed it up in Python if I'd wanted to put in the time. Maybe there's already some boutique solution I don't know about. But that's sort of the real lesson of some of these problems for me: learning when to switch tools. If I'm doing a one-off problem and it doesn't matter if I run it in another language, it's a lot more time-efficient for me to just use another tool than to spend a ton of time making it work in Python. I'm not a fan of premature optimization.
I really like Go, so it's too bad I don't have more uses for it. As it is, Python, JS and C cover my needs quite well, and I'd need to go out of my way to find a project where Go makes more sense. But I do keep it in mind. I'm really looking forward to the day Go is more useful on Android because I hate everything about Java.
Quote:Quote:
Quote:Quote:
I'd like to learn more math and I'm sure lots of the Project Euler problems are nifty if you know how to solve them elegantly, but my time is finite, and I'll wait until I actually need to know more math for a specific real-world problem to put the time in. I got what I wanted out of Project Euler, so I don't care about solving a bunch more problems solely for bragging rights.
Solving Project Euler problems can sure be time consuming. It's been a while since I've visited the site. However I feel that instead of tackling the more difficult problems, it is a good idea to go back to the first easier problems and refactor your code.
When I solved the easy problems I would take a quick peek at other people's solutions that show in the list, and I would just laugh at how horrible their solution's code was.
I've done the refactoring from time to time. I like to use PE to learn new languages, to see how they differ from the languages I already know and if there's any clear benefit to the new language. Some of my early solutions definitely get the "what the hell is this mess?" reaction.
I tried to avoid looking up Project Euler problems because it's pretty hard to avoid stumbling over the answers. Even looking up the generic problem often leads right to PE answers. I won't say I never looked for minor hints when I was completely stuck though. I just wanted hints more along the lines of "use combinatorics" or "check out the ____ theorem", not actual code examples.
Quote: (02-08-2017 06:24 AM)AntiTrace Wrote:
Another great way to hone your skills if you're a newbie is to apply a drill used by writers of short stories. First time you write your program just focus on getting it done. Then go back and attempt to make it 10 lines shooters. Then go back and do it again. So and so forth until you look at you're code and can't see a single line that could be removed or a single method that could be simplified without breaking the program.
Doing this helps you learn valuable tricks in your language or choice but it more importantly make you really think about what the code is doing and how it actually gets there.
Super simple example would be reducing a method that returns a Boolean based on a pramter being an odd number.
pass 1 you go with the basic if/else flow with the modulus operator.
Pass 2 maybe you realize that the else is pointless, and you go with "If X return True; return False". That's one less line!
Pass 3 maybe you go with ternary operator, now you're at one line.
Pass 4 maybe you get annoyed with ternary operators lack of readability and decide to bit shift on the input parameter, because obviously any odd integer will have a 1 in the first bit.
Pass 5 maybe you're at a loss of how to simplify the logic down below the bit shift. You can go crazy and remove as much white space as possible. Now you went from measuring the length of your program by lines to measuring by individual characters.
It's a great exercise when learning how to properly structure a class as well.
Good exercise, but when people start actually coding that way it makes me want to strangle them. I see it all the time online, bullshit one liners with single letter variables that only an expert in the language will be able to read without parsing it out.
We're not sending spaceships to the moon using core rope memory; we can afford to be a bit verbose in the name of clarity these days.
Quote: (02-08-2017 02:09 PM)weambulance Wrote:
Quote: (02-08-2017 06:24 AM)AntiTrace Wrote:
Another great way to hone your skills if you're a newbie is to apply a drill used by writers of short stories. First time you write your program just focus on getting it done. Then go back and attempt to make it 10 lines shooters. Then go back and do it again. So and so forth until you look at you're code and can't see a single line that could be removed or a single method that could be simplified without breaking the program.
Doing this helps you learn valuable tricks in your language or choice but it more importantly make you really think about what the code is doing and how it actually gets there.
Super simple example would be reducing a method that returns a Boolean based on a pramter being an odd number.
pass 1 you go with the basic if/else flow with the modulus operator.
Pass 2 maybe you realize that the else is pointless, and you go with "If X return True; return False". That's one less line!
Pass 3 maybe you go with ternary operator, now you're at one line.
Pass 4 maybe you get annoyed with ternary operators lack of readability and decide to bit shift on the input parameter, because obviously any odd integer will have a 1 in the first bit.
Pass 5 maybe you're at a loss of how to simplify the logic down below the bit shift. You can go crazy and remove as much white space as possible. Now you went from measuring the length of your program by lines to measuring by individual characters.
It's a great exercise when learning how to properly structure a class as well.
Good exercise, but when people start actually coding that way it makes me want to strangle them. I see it all the time online, bullshit one liners with single letter variables that only an expert in the language will be able to read without parsing it out.
We're not sending spaceships to the moon using core rope memory; we can afford to be a bit verbose in the name of clarity these days.
Exactly. Also brevity of code <> efficiency of code.
When you are coding professionally, in most cases (not all, but probably 95% for most people) making your code maintainable is the most important thing, because for most things more time will be spent maintaining it than you spent developing it, and often under more difficult circumstances. (Meaning, you might be developing it during a project with relatively light time pressure and plenty of help testing, etc, and a couple of years later some sap is going to be trying to understand and fix something at 2 am that is causing a production system outage and looking at your code and saying WTF is that doing???)
Again, not to say that trying to make it brief isn't a fun and sometimes worthwhile exercise ... and sometimes brevity makes things more maintainable, if you removed unnecessary complexity or cleaning out stuff that you thought you needed initially but turned out you didn't, etc.
Quote:Quote:
Good exercise, but when people start actually coding that way it makes me want to strangle them. I see it all the time online, bullshit one liners with single letter variables that only an expert in the language will be able to read without parsing it out.
We're not sending spaceships to the moon using core rope memory; we can afford to be a bit verbose in the name of clarity these days.
Good point. Though I feel that this one liner issue really varies depending on the language. For example, it is more tempting to do more one-liner solutions in Ruby than doing it in Python. I feel Python really helps in this regard.
Quote: (02-08-2017 06:24 AM)AntiTrace Wrote:
Super simple example would be reducing a method that returns a Boolean based on a pramter being an odd number.
pass 1 you go with the basic if/else flow with the modulus operator.
Pass 2 maybe you realize that the else is pointless, and you go with "If X return True; return False". That's one less line!
Pass 3 maybe you go with ternary operator, now you're at one line.
Pass 4 maybe you get annoyed with ternary operators lack of readability and decide to bit shift on the input parameter, because obviously any odd integer will have a 1 in the first bit.
Pass 5 maybe you're at a loss of how to simplify the logic down below the bit shift. You can go crazy and remove as much white space as possible. Now you went from measuring the length of your program by lines to measuring by individual characters.
It's a great exercise when learning how to properly structure a class as well.
If I was going to optimize from pass 1, I'd rather make it:
Code:
Code:
def is_odd(n):
return n % 2 != 0
I'm working on a very simple Python web app (using Bottle as usual) that needs to maintain a small nested list between views. I've known about the pickle module in Python for a long time but never had reason to use it. It seemed like a good solution to this simple need for data persistence, so I tried it out.
I started having problems right off the bat. I kept getting these goddamn EOFError exceptions when loading my data back into a variable from the file, which seemed to be caused by the lack of a newline character at the end of the pickle file. I searched and searched online trying to figure out why that would be, since I followed the example code in the docs exactly. It was writing, but not reading.
I tried cPickle, tried all kinds of different variations of the code, and then, when I was rewriting my open() call a different way thinking that would somehow help--I was out of good ideas--I realized...
...that I'd left the parentheses off the .close() method I needed to call on my pickle object before I could do anything else with it, like read from it.
![[Image: tenor.gif]](https://media.tenor.co/images/14ea51941609cffcfa5ad79e2ce6d714/tenor.gif)
Goddammit. I spent like an hour trying to figure it out--assuming I was missing some key parameter because I've never used pickle before--and it was just a typo in my code.
What's really annoying is I wasn't getting an error that would indicate the mistake. It's a syntax mistake; it seems like it would show up in the traceback info. Right? Well, it's not an error per se. It's fine syntax, it just didn't do what I meant it to do. If you call a method but forget the parentheses, you get the method object back. But since I was just trying to internally modify the state of the pickle object, I wasn't getting any obvious feedback about what was wrong.
Some days...
I started having problems right off the bat. I kept getting these goddamn EOFError exceptions when loading my data back into a variable from the file, which seemed to be caused by the lack of a newline character at the end of the pickle file. I searched and searched online trying to figure out why that would be, since I followed the example code in the docs exactly. It was writing, but not reading.
I tried cPickle, tried all kinds of different variations of the code, and then, when I was rewriting my open() call a different way thinking that would somehow help--I was out of good ideas--I realized...
...that I'd left the parentheses off the .close() method I needed to call on my pickle object before I could do anything else with it, like read from it.
![[Image: tenor.gif]](https://media.tenor.co/images/14ea51941609cffcfa5ad79e2ce6d714/tenor.gif)
Goddammit. I spent like an hour trying to figure it out--assuming I was missing some key parameter because I've never used pickle before--and it was just a typo in my code.
What's really annoying is I wasn't getting an error that would indicate the mistake. It's a syntax mistake; it seems like it would show up in the traceback info. Right? Well, it's not an error per se. It's fine syntax, it just didn't do what I meant it to do. If you call a method but forget the parentheses, you get the method object back. But since I was just trying to internally modify the state of the pickle object, I wasn't getting any obvious feedback about what was wrong.
Some days...
When do you guys recommend I start applying for jobs? I've been learning front-end web development for the past two months using Team Treehouse (which I highly recommend, by the way. The quality is top-notch.) and books. *So far I think I have a solid grasp of HTML, CSS, JavaScript/jQuery. I've built a few websites too, as well as a few games using a framework (I've been using Craftyjs).
*Although I'm new to web development, I am not new to programming. I used to make games using Game Maker and Unity, so I already had a good understanding of programming logic prior to learning web development.
*Although I'm new to web development, I am not new to programming. I used to make games using Game Maker and Unity, so I already had a good understanding of programming logic prior to learning web development.
I'm hiring for a full-time developer position right now. In the interest of privacy I will keep the description vague and then you guys can PM me. I will say that you need a few years of web development experience (or just be a skilled problem solver. Be comfortable using the Google Developer Tools debugger to debug Javascript and CSS. We are 80% javascript with some server side APIs written in Java. It is very cutting edge stuff.
Would love to work with a guy off the forum.
G
Would love to work with a guy off the forum.
G
Anyone here familiar with creating bots? I could use some pointers on how to start creating one or if you want to collaborate in making one that would be cool too. PM me and I can give you more details as to what I'm aiming for its purpose to be and where it would be hosted.
Alpha Hunter Zero - PM me.
My blog: https://fireandforget.co
"There's something primal about choking a girl. I always choke a girl as soon as possible after meeting her, it never fails to get the pussy juices flowing."
Still trying to get around to posting my hardware/software datasheet. But I just wanted to add that C++ is still a solid choice, particularly for mobile devices and embedded. There aren't many reasons to futz with straight C anymore, IMO.
C++11 standard and later has improved the situation enormously. It's not like the bad old days where you had to constantly worry about memory leaks - "smart pointers" are there to manage most of it for you.
Give it another look if you haven't lately! Go for the newer tutorials and books only, don't even bother with any of the old learning material that isn't teaching the new hotness.
C++11 standard and later has improved the situation enormously. It's not like the bad old days where you had to constantly worry about memory leaks - "smart pointers" are there to manage most of it for you.
Give it another look if you haven't lately! Go for the newer tutorials and books only, don't even bother with any of the old learning material that isn't teaching the new hotness.
« Next Oldest | Next Newest »
Users browsing this thread: 3 Guest(s)