Ok, I'll comment in ogged's thread. Is ogged switching careers? I thought he was making traction as a professional blogger. Case of writer's block?
Algorithms in C by Sedgewick. I liked Stevens' Unix book a lot, very helpful in thinking through a bunch of IPC issues. I don't know that either would help in writing an IOS app though.
For me, there's a tradeoff between just trusting some complex API and thinking about what the machine is doing. I always feel that this is a weakness, it should be possible to manage both perspectives simultaneously.
Have a look at the Python tutorial. It covers most of the things you'd want to know about, coming from another language, so looking at the topics it discusses should help you figure out the abstractions that make up most programming languages.
I will say that, at the level you're at right now, and given what you probably want to do, looking at algorithms is a waste of time. Once you've been coding for a while, it'll be worth it to go back and look at them so that you understand the underlying principles of the tools you've been working with (same with design patterns), but for right now you almost certainly don't need them.
don't know that either would help in writing an IOS app though
Doesn't matter! On the contrary, being able to do other stuff is part of the point.
4 gets is exactly right. Your workflow should almost always be to have a file open in one window and a REPL in another. It's like interactive debugging before you ever actually try to run your entire programming.
I don't think they exist for Objective-C, though I could be wrong about that.
being able to do other stuff is part of the point.
I suppose in a similar vein learning to program might give you something to write about, if you're lacking.
My programming style is to google what it is
I want to do and then cut, paste, and tweak what I find. I've written fairly large and complicated bits of code this way. The key is to add a buttload of comments to the borrowed code so that you can figure out what you're trying to do when you come back to it six months later.
In a sort of answer to your question I've heard "C by example" is helpful. Plus it has lots of code you can steal borrow.
I'm not sure I ever knew the REPL term but yeah, do things that way. Much harder with compiled languages.
Definitely for app development in objective C (assuming you aren't doing something that's incredibly high performance) maximizing stealing is going to be important.
Oh yeah, and if you're going to be working in a compiled language, find a good IDE and use it. It will save you massive amounts of time and energy, from automatic code generation to code browsing.
And possibly the most important bit of advice I can give you: FIND A CODE STYLE AND STICK WITH IT. There is *nothing* worse than trying to read inconsistently-formatted code, and it will make your life hell when you're trying to debug things later. (Most IDEs will do code style checking for you.)
to square
repeat 4 [forward 50 right 90]
end
The key is to add a buttload of comments to the borrowed code so that you can figure out what you're trying to do when you come back to it six months later.
Possibly as important as having a consistent code style.
This might be too baby school even for ogged but informative variable names and consistently applied version tracking (however you do it) are of course teh vital.
informative variable names
I have lots of strong opinions about variable names. Informative, yes, but only reasonably so. For years after SAS started allowing longer names, I still tried to keep them all to eight characters. I don't do that anymore, but I still get annoyed when somebody calls a variable something like "The_one_where_we_recoded_by_Jones_criteria."
Informative program and output names are helpful too.
I've sifted through way too many emails in my inbox at work with attachments labeled "code.sas" or "report.xls", trying to find one particular thing someone sent me..
FIND A CODE STYLE AND STICK WITH IT
I've modified so many other people's code, I've forgotten what my style used to be.
Find a linter and use it -- this may not apply if you're using XCode, which I think has one baked in. Check out things like Project Euler or Rosetta Code as bite-sized problems for learning a language and figuring out idiomatic ways in language $foo for solving common problems.
Learn to use a version control system, probably git.
I'm identifying what needs to be done, dimly recalling that my Objective C book had something that sounded relevant, checking the index or googling, and then figuring out how to apply the method to my situation.
This is a huge part of my development workflow, and has been for years. The only thing that really changes with time and practice is the breadth of topics and resources that you have a dim recollection of, and the number of times you've been burned by various pitfalls, which helps you to weed through the options a bit more effectively.
Just today I did call a variable "Not_at_all_lit", but one can't let general principles get in the way of puns.
Is there not some math-y/logic-y/theory-y stuff I should know?
Find a linter and use it
See, what should I have read/learned about, that I would have known what a linter is?
Two other things you must hammer into your head:
1) Premature optimization is the root of all evil.
2) Before you do something inside a loop, ask yourself if it really needs to be done every time through the loop.
Is there not some math-y/logic-y/theory-y stuff I should know?
You're not at that point yet. I've been doing this professionally for more than a decade and I'm barely at that point.
(I mean, yeah, if you want to go get a job as a production developer somewhere, sure. But I don't think that's what you want to do, is it?)
Re-factor mercilessly. Code isn't any good until its been re-written three times.
Further to 25: But if you really really want to get into the theory, read this.
When you start naming your variables things like "shitball" and "fucker_3", its time to go get some coffee.
See, what should I have read/learned about, that I would have known what a linter is?
Linter. It's a tool that analyzes your code and flags it for things that look problematic. ("Static analysis" is the general term.) The one for python is called "pyflakes". It looks like Clang, which is the compiler used by XCode, has much of that sort of behavior built in.
Use Stack Overflow! Lots! I've been doing a ton of that in the last month because I got hastily drafted to do some front-end engineering work, which is definitely not a core strength of mine.
Actually, here's a good collection of reading lists for the kind of stuff you seem to be interested in.
(Boy I have a lot of opinions about this stuff. I should really get a job.)
The one for python is called "pyflakes".
Pylint 4ever!
SICP is a great book! I have heard good things about How To Design Programs as well.
Use Stack Overflow! Lots!
Do I ever.
("Static analysis" is the general term.)
Not to belabor a point, but how do you know (or how would I learn) what the general term is? I feel like I'm narrowly focussed on whatever specific issue I'm trying to solve, but don't have a broad view of the activity, at all, and that surely must cost me time/efficiency somewhere.
Also add Stackoverflow to your list of oh, snarkout got there first.
here's a good collection of reading lists
Aha! Super helpful; thank you.
Not to belabor a point, but how do you know (or how would I learn) what the general term is?
Research? Time? Follow links if you're online, read things on wikipedia and follow links there. Click around; read around.
Coders at Work is a book based on a bunch of interviews with famous developers. Some good stuff in there.
Stack Overflow, yes, but also the Stack Overflow Podcast. Listen to the early episodes, when it was Joel Spolsky and Jeff the Coding Horror Dude, discussing a lot of the technical considerations and philosophies that went into building Stack Overflow, as well as a bunch of other development-related topics.
Not to belabor a point, but how do you know (or how would I learn) what the general term is?
Find a meetup group in your area, or a mailing list. Or hop on Stellar and look for links to posts/presentations/etc. Or, hell, just keep posting questions here. The best way to find this stuff out is to talk to other developers.
The Lambda Papers are super great (though not in the good buttsex way).
Actually, do not start there remotely.
Further to 39: If you're not reading Lambda the Ultimate, you're barely a developer.
I assume "an entire undergraduate program in CS" is not the answer you're looking for? From that, you could steal the ideas of SICP-or-similar-introduction (it's good because it's different! broadening!), algorithms/data structures stuff, heuristic problem solving, and then replace the lab sort of classes with the development you're doing now, where Google-leading-to-StackOverflow fills in for the role of the helpful TA.
For what it's worth, I didn't take CS classes -- this was all stuff picked up from reading/mailing lists (because I am old)/asking idiot questions as a junior-level dev/frantically Googling because something blew up.
I had to teach myself SAS, which is pretty much like programming. I got by on books and pestering some guy who knew more than I did. I gave him my Weber grill when I moved.
It also helps if you spent ages 8-12 banging away in Basic on an Apple IIc.
That's probably my problem. I didn't get an Apple IIc until I was 13 or so.
Well there's the problem. You got to discover computers before you discover girls.
In high school I had one class in BASIC and another in Pascal. Unless Pascal doesn't exist and I just invented it to repress a memory of more BASIC.
I liked that article in 47, which someone put on Facebook. Other than that I haven't programmed anything other than I guess making the "turtle" move in Logo more than 25 years ago, but that hasn't stopped me from writing this comment.
(1) Don't just use StackOverflow to answer specific questions; subscribe to the RSS feeds for the language or languages you're learning and spend a little time each day browsing the questions and answers. It's the most efficient way I've found to learn the idioms and basic techniques of a new language, and you'll get to see a parade of horrible code in other peoples' questions, which is both educational in its own right and a good check on the tendency to self-doubt that comes along with self-study.
(2) Find complete, digestibly-sized programs and try to understand them in their entirety. If you're learning Python, smaller modules in the standard library are great; if C, try the smaller programs in GNU coreutils. (I don't know what an equivalent for Objective-C would be.) This will help develop your sense of how to organize code, and also provide some familiarity with the extra touches production code requires that are omitted from textbook and tutorial examples.
I suppose this is the correct thread to note the The Professor is no longer with us.
but how do you know (or how would I learn) what the general term is?
Oh, yeah, knowing the general terms is super useful, good point. That helps enormously when picking up a new language, since you can google "general term + langname".
Coconuts are hard enough, I guess.
At my high school computer lab there were (if I'm rememberging correctly) two terminals. They were taken over by a few computer nerds. Theoretically, students taking computer programming class would get to sign up for time on the terminals. What actually happened was that the nerds would offer to do your homework for you, if you would let them use the terminal. It was clearly too good an offer to refuse, so I never learned programming.
Man I have such a total paucity of useful advice to offer ogged. Hang around other people who know how to program, and listen to them. Try building shit. Google what breaks. It all seems so ad hoc and non-magical.
You people learning programming in the age of search engines.
God the ability to just dump the whole error string into google has completely reshaped the world.
When I was a kid, if you wanted a game, you used to have to meticulously copy pages of Basic code from 321 Contact magazine. Then it wouldn't work, and you would be fucked because there was no way to Google the error message. Then your dad came and yelled at you to play outside.
I was amused that in searching for some insight on an assignment from a programming class my daughter found someone asking about the exact same assignment but from an earlier semester. And further, that in the responses someone had said something like, "Ah, taking Professor Xyzzy's class in foo, I see."
God the ability to just dump the whole error string into google has completely reshaped the world.
Yeah, there's nothing like having Google confirm that you are, in fact, the only person to have ever encountered this particular error.
Actually one thing that's really useful, ogged, is an intuition for which parts of your exact error message can be usefully replaced with wildcards in your google search (or alternately, which substring you should use to maximize generality while finding the same error).
62: What are you implying about my search skills?
Why don't you try googling substrings of Sifu's comment to see if someone else knows what the implication is?
51 Irwin Corey? Damn!
Though he was almost 100 so not so surprising.
The gold standard is "The Art Of Computer Programming" by Donald Knuth.
https://en.wikipedia.org/wiki/The_Art_of_Computer_Programming
It also helps if you spent ages 8-12 banging away in Basic on an Apple IIc
Yeah, around 18 for me. And I've forgotten everything to boot.
58: It is interesting/weird to recall the IBM "manual rooms" with shelves of loose-leaf binders with every one of the 20 gazillion carefully-numbered System/360 system and error messages described (this stuff). It was a regular task for someone to update the changed pages on a regular basis. But I will say I never got a code or message that was not listed, unlike every other thing I've ever worked with in my life. Of course the cost of that was 1) lots of actual cost and 2) utter lack of agility or flexibility.
Another suggestion: watch this lightning talk. Understand why it's funny.
IEH102I
THIS VOLUME DOES NOT CONTAIN DATA SET dsname
Explanation:
The data set specified in the LISTVOC or LISTPDS statement is not contained in the specified volume's table of contents.
In the message text:
dsname
The data set name.
System action:
The request is ignored. The return code is 8.
Application Programmer Response:
Probable user error. Ensure that the data set name and volume are specified correctly. (If a volume was not specified, the system residence volume is assumed.) If the volume and data set name are correct, insert a LISTVTOC statement for the other system volumes to determine where the data set resides.
System programmer response:
If the error recurs and the program is not in error, look at the messages in the job log for more information. Search problem reporting data bases for a fix for the problem. If no fix exists, contact the IBM Support Center. Provide the JCL and all printed output and output data sets related to the problem.
Source:
DFSMSdfp
There is all sorts of good advice on this thread that I'm never going to follow.
74 But I've bookmarked it all the same.
65 Relieved to hear that the world's foremost authority is alive and, at 99, presumably well.
||
Gswift/Bostoniangirl/others bleg:
A friend's roommate just tore the thermostat off the wall and opened all the windows, saying "I will decide when the heat needs to go back on!" (It is cold here.) Heating has been a point of contention in this household.
What's the thing to do here vis-a-vis talking to the cops, etc? Sounds like, from other behavior (walking around the apt kicking kid's toys, etc.) that he is indeed having some kind of psychotic break or just short of that. Concerned for friend's safety, but she is not in good with the landlord. Thankfully, she is safe at a coffeeshop right now.
This is all such a mess.
||>
I'm identifying what needs to be done, dimly recalling that my Objective C book some resource had something that sounded relevant, checking the index or googling, and then figuring out how to apply the method to my situation.
I'm pretty sure this is 100% of all I ever do.
The C Programming Language, by K&R. That is the single best book I've read on the topic. I've returned to it on multiple occasions.
Programming Perl, by Larry Wall, Et al. Even if you don't care about Perl, it is awesome, and really funny at times, something hard to pull off in technical documentation.
Choice and Consequence, by Shelling. There is nothing about programming there, but it is useful.
ESR's various rants are useful as well. He's an insane egomaniac, but very competent. you'll run in to that sort of thing in this industry.
Reading K&R is pretty good, if you're programming in anything remotely C-derived. It's a good and brief book (that's part of why it's good). "The Practice of Programming" by K & Pike is a good followup, less about language detail and more about approach and style.
One of the list pages referenced above mentioned "The Mythical Man-Month", which is also a great read, and helps to explain 72 - his ideal programming team, admittedly in the 1970s, had about as many documentation/typist/secretaries on it as programmers.
Also, The Design and Implementation of the 4.4 BSD Operating System. I loaned that to someone and didn't get it back, so I don't have authors on hand, but Bostic and McKusick were some of them. If you're serious, it is a must-read, even if you don't want to build an operating system.
If you do wind up wanting to take classes, I've been getting an online CS degree from Oregon State University for the past year. The first two programming classes were in Java, but I'm told that they're now being taught in C.
Programmers are going to be myopic. That is what we do, after all. Good ones pay attention and provide a feedback cycle when management has lost their collective minds.
To sum up, to begin to get a basic understanding, become intimately familiar with the superset of material that a dozen or so people working across a broad swath disciplines over many years have encountered and found valuable. Do that and then come back for further guidance.
ogged,why won't you reveal what your app is?
It's like Grindr but for women interested in masturbating dogs.
Actually, its much simpler. Just virtual dog penis you can rub.
If you do wind up wanting to take classes, I've been getting an online CS degree from Oregon State University for the past year. The first two programming classes were in Java, but I'm told that they're now being taught in C.
Liz, that program looks interesting. Any further impressions you could share?
83: Right, this is like the bike or cooking threads.
83: I still have a huge backlog of books I intend to read because people have mentioned them favorably in threads here. I did recently get through The Rest is Noise, and now I'm reading the one about shipping containers.
Oh, and also the one about rocket fuels.
83: Just like planning to build a house of cob.
76: President Taft, I have no good advice. It all varies so much by state. Usually the standard is imminent threat to self or others for truly involuntary commitment. Often after an evaluation people will sign themselves in. Most of my experience with this is with people who are clients of our state's department of mental health, and once people are already "in the system" things are different.
It takes 10,000 hours to learn to blather about how everyone should spend 10,000 hours learning to code.
2) Before you do something inside a loop, ask yourself if it really needs to be done every time through the loop.
Also good advice for Congress.
This is really very helpful, all. Thanks.
One book I found very useful, as a complete beginner, was this one. Very clear, engaging, lots of useful information.
95: If you found that useful, you might also look at the Python Cookbook. (And you should look closely at the list of contributors.)
FWIW, O'Reilly has an outstanding online library. I have the $25/month subscription and it's totally worth it.
87: It's a pretty good program if you want to truly learn CS. There are easier programs if your goal is simply to get some kind of CS degree. For example, Western Governor's has a MS degree that requires no prior knowledge of CS. OSU gives you a BS degree, but it's designed for people who already have a BS degree so the classes are only CS degrees.
I'm taking one class at a time and it's pretty demanding. Most people are unemployed or stay-at-home parents that tend to take four classes at once, which I can't even imagine. For the first two Intro to CS classes, I studied two hours every weekday night and 15 hours over the weekend.
The format of the classes is to read from a textbook, view lectures online, and take tests online. We use Blackboard, which has been fine except for a few hiccups in the beginning.
I used a tutor for Intro to CS and Data Structures because the feedback didn't include helpful comments like critiquing my coding style. The TAs just tell you whether it compiled correctly. When I showed the tutor one of my programs, he laughed for awhile about how poorly it was coded and showed me how to fix it in ten minutes when it took me a weekend to write. I'm hoping to do the Assembly Language course without a tutor since it's less about coding.
Any more questions?
Any more questions?
No, that was very helpful, thanks. It sounds like one of those worthwhile things that ambitious people do.
Man, do I ever wish I'd studied CS in college. Ironically, I didn't because I'd spent so much time dicking around with computers as a teenager that I thought I knew something about them, and I wanted to spend college learning about new things, to, like, expand my intellectual horizons or something. What a moron I was. I don't know shit about computers.
I really want job security and not everyone is convinced that me working with software patents for seven years is sufficient. This way no one can question my credentials. We'll see if I can keep it up after the baby is born, though.
Okay, I do have another question: taking one class at a time means you'll finish the program in how many years??
I didn't major in CS because my dad said I didn't think like a computer programmer (he was a programmer). I really wish I hadn't listened to him.
101 It takes 3.75 years to complete in total (17 classes, one per quarter). I'm one year into it and I'm taking off next quarter because of the baby, so I expect to finish at the end of 2016.
66: The Art of Computer Programming was the text for my Analysis of Algorithms course that I took with Sedgewick, but honestly, one of Sedgewick's books (either Algorithms or Algorithms in C) will be much more approachable for 99.9% of the working programmers out there, for 99% of the work they need to do. To be fair, Sedgewick hadn't written them at the time I took the course from him. Lots of TAoCP requires some pretty hard-core math analytic skills that you will rarely use directly, especially when working with modern computer systems. Most of the value I got out of it is meta stuff about "things to think about with respect to certain kinds of problems" rather than directly applicable techniques. It still has an honored place on my bookshelf, but I hardly ever go to it for solutions to a specific problem.
In contrast, one book I think nearly every programmer in my subfield should read is Working Effectively with Legacy Code by Michael C Feathers. (It helps to be fluent in either C++ or Java to follow most of the examples.) Over a 35-year career in software development, I've only had a handful of occasions when I was developing a new program completely from scratch, and one of those was my thesis project. Most of the time I've been working to extend a significant body of existing code, and understanding how to test, characterize, and manipulate such code is the point of Feathers' book.
I judge this bleg to be not completely OT because Bay Area.
Getting from Sausalito to Santa Cruz and back (flexible times and not necessarily return on same day) via public transit. Any viable options? Asking for an offspring.
Prez Taft, assuming you are who I assume you are, I'd say your friend's first concern needs to be to keep the young child out of a situation where there's a good likelihood the state will take the kiddo into foster care. Your assumed state is notoriously foster-friendly which is not the same as family-friendly and both keeping a little one in a cold apartment and getting into a domestic disturbance with the roommate could lead to a removal. I realize that's not very helpful, but that's what I hear from the other side of things.
105: Have you checked the transit option in Google Maps? That's where I generally start. I just checked for "leaving now" options, and they have some suggestions that would take around 3 1/2 hrs one way.
105: My knowledge of Bay Area transportation is out of date, and I don't know what you mean by public transit (Greyhound?), but I assume Sausalito ferry to SF and then something from SF is the likely way to go. In high school, I and some friends got to Half Moon Bay from Berkeley and back on the same day via public transit.
If your offspring can take a long time getting there, I think an option would be ferry-BART-switch to Amtrak in Emeryville-switch to bus in San Jose. There may well be better routes on Caltrain, which runs down the Peninsula, but I don't know them. Public transit for that trip is possible, though not smooth.
Dave W.'s suggestion is better.
The bus is much faster than the ferry from Sausalito to SF.
Although maybe I should suggest the ferry on the off chance the ferry gets rammed and he gets plucked from the water by an outbound ship and is offered a position as a crew member.
Google lacks the human touch. Anyway, I'd take the ferry rather than the bus if I had any flexibility.
That can happen, or so I've read.
Yeah, the routes I was finding were basically bus-to-bus-to Caltrain in SF, Caltrain to San Jose, bus from there to Santa Cruz. The Capitol Corridor (Amtrak) in the East Bay goes to the same station in San Jose, but would probably take more time getting across the bay, plus the Corridor only runs around every 90 minutes at peak times, and less than that midday (I'm not sure how often Caltrain runs).
Obviously, you might get different results depending on when you were travelling and the specific addresses involved.
The only reasons I'd take the bus for that part of the route:
1. strict schedule
2. rapid onset seasickness
3. taken the ferry before; didn't enjoy it
4. hatred of everything that's good in the world.
Seriously, you get to take a boat across (part of) the bay. How often do you do that?
The only reasons I'd take the bus for that part of the route:
1. strict schedule
2. rapid onset seasickness
3. taken the ferry before; didn't enjoy it
4. hatred of everything that's good in the world.
5. Lack of red suit.
Taft, was your friend there at the time he ripped the thermostat off the wall? Was it part of a dispute? Because here and in many states that's domestic violence because they're living together. If she called the cops here we would book him into jail and served him with a temporary protective order at jail which would prevent him from coming back to the apt. for at least a few days.
And if you do want to take the ferry, I'd be looking into a ferry to Jack London Square, where you can catch the Capitol Corridor. You can do that from SF; I'm not sure whether there are any direct options from Sausalito or if you would do ferry to SF; ferry from SF to Jack London.
Further to 118, if there's a kid who was present during that it would be an additional charge. If the laws are at all like here calling the cops is the way to go. If it meets the criteria for a DV the arrest is mandatory here and having the charge be under that umbrella usually means better access to things like victim advocates and such.
Taft, if you're the person I assume you are, and your friend also lives in H. County, she can call the mental health crisis line to request services for another adult who is having issues. Google COPE or FB message me if you need the number. The line was set up to be an alternative to calling the police, though it does necessarily get the county involved, and could lead to police or CPS intervention if warranted.
119, cont: If your offspring wants to go for cool offbeat touristy points instead of just "get me there ASAP", there's another advantage to the Ferry->Ferry->Jack London->Capital Corridor->San Jose->Santa Cruz route, and that is that the Corridor is one of the few ways to see the Bay Area's only ghost town, Drawbridge CA, which is about halfway between the Fremont and the Great America stations. They don't tell you about it, and it doesn't look like all that much to see (a few decaying wooden buildings on both sides of the train), but it's got an interesting history that you can Google, and there were people living there up to the 1970s. It's only accessible by boat or rail, and is now part of a wildlife refuge.
I would love to move back to the Bay Area. Maybe I should learn more of this thing people are calling "code."
I'm late. Ogged, The C Programming Language is as useful as everyone says, especially since your iOS app, at the end of the day, gets turned into vanilla C by gnomes very deep in the Xcode caverns. It's a short book, but the sort you go back to over and over, understanding slightly more each time. My co-developer (who, like me, had to learn all this shit from scratch about four years ago) kept it in his bathroom for a year, with good results.
I highly recommend Cocoa Design Patterns, which fleshes out a lot of those "concepts that programmers in general know how to use" with Cocoa-specific examples.
Learning Xcode is a project unto itself but worth the effort. Xcode has no real REPL function, because compiled language etc., but the interactive debugger console gives you some of the same help: http://www.informit.com/articles/article.aspx?p=1829415&seqNum=6
The "Cocoa With Love" blog isn't updated any more, but the archives are good. "Cocoa is My Girlfriend" (why these names) also worth following.
Algorithms and such, like everyone else says, don't always come up day-to-day; especially in iOS you really are trusting the framework to handle that most of the time. The hardest part for me early on was getting my head around good object-oriented design. See, again, recommendation for Cocoa Design Patterns Above.
Does playing Minecraft help? There are objects and you have to orient yourself.
I'm not sure if there are any ferries between Marin and the East Bay (or even any that do not have SF on one end). But the Capitol Corridor is a nice ride; it has wifi now.
Man, every day at breakfast there are objects and I have to orient myself, but they told me to leave it off the resume.
They may be a little dated now, but Code Complete and Writing Solid Code taught me a lot about avoiding avoidable coding mistakes.
Maybe this is the thread to ask: what's the deal with the run the terminal as a "login shell" to get Ruby (or maybe the issue is RVM) to load correctly on Linux? I know there's ways to not have to run terminal as login shell, but I can't figure out what the "recommended" thing to do is.
This is an iteraction between RVM and bash (I'm assuming your default shell is bash): On Linux opening a terminal from within a gui session starts a non-login shell, which doesn't read ~/.bash_profile, which is where RVM installs its initialization code.
Right, but the advice I've seen online for how to deal with that has said:
1. You should run a login shell.
2. You should not run a login shell (even though you could) [because reasons], but should instead edit a different bash configuration file [I think there may be two possibilities].
3. Run the RVM initialization script after starting bash.
It's not clear to me as someone new to Ruby if one of those options or some other option is better or worse than the others. I don't like using the login shell because I lose the multi-color highlighting, although I guess I could turn it on for that mode.
This is also the kind of minor thing that probably ends up being a barrier to beginners. It's something I'd rather not think about at all until I know more Ruby, but the default Ruby that comes with Ubuntu is too old so you have to use RVM or something like it.
So I guess my question is just how do people using Ruby on bash usually set things up?
"was there a book (or books) or lecture series, that made programming itself clear enough to you that writing code was much easier after them?"
Nope. 10,000 hours.
131: I use your 2 (under zsh on a Mac, so the specifics are different, but same deal). I always forget which shell configuration files do what, but if you experiment with moving the RVM code out of ~/.bash_profile and into one of the others, you should be able to get it to fire on a non-login shell.
Alternatively, if you don't have to regularly switch between different Ruby versions, you could ditch RVM (which is a pain anyway) and just install the new Ruby from a package: http://leonard.io/blog/2013/10/installing-ruby-2.0.0-on-ubuntu-13-10-saucy-salamander/
Honestly? I think the overwhelming majority are on OS X, where the terminal starts a login shell by default, so the issue doesn't arise in the modal case.
If you don't want to use a login shell, you'll probably be ok moving the RVM initialization code to ~/.bashrc. This is fairly common, I believe. Some caveats: Make sure you don't have BASH_ENV set to ~/.bashrc, or that file will be sourced every time you start a non-interactive shell (i.e., every time you run a shell script). Also, this will run RVM initialization whenever you use `su', which I bet can cause problems.
Alternatively, you can set up a login shell to get the colored output you like. If the code setting up the colorization you like is in your ~/.bashrc, you can move that to ~/.bash_profile, or even just source ~/.bashrc from ~/.bash_profile. This last expedient is common, and not just for people doing Ruby development.
And yeah, this sort of thing is a huge barrier to learning to code, and also a huge barrier to not swearing and throwing things in the office. The amount of time one spends fighting one's tools.
I mean practical programming is 1% knowledge and 99% fighting one' stools, let us not mince what needn't minced.
My code has been compared to minced stool more than once...
134, 135: Thanks. If there's no problem with the login shell except for the colors, I might try 135.last. I haven't had much reason to switch versions, mostly because I've been dragging my feet, but there's some Ruby-based stuff that I'm trying to use for learning Ruby that comes with a bunch of warnings about versions and it seems like I need to have 1.9.2, 1.9.3 and 2.0.0 just in case something is still on an earlier version. But it might only matter for people developing on the project rather than just doing the tutorials.
I always have a .bashrc that just sources .bash_profile, or something along those lines. Presumably this is deprecated for some reason involving security or something that I never paid attention to.
On fighting tools: It took so long for me to set up a working environment to be able to do Python-based exercises* in that original Udacity statistics MOOC that I'd decided to drop the MOOC** by the time I got the environment set up. Ok, that was only a few hours, I think, but still.
*I think it later became clear that I could have installed a science-oriented python and gotten everything at once, but I already had python installed and didn't want to start over and lose the other things I'd installed for other purposes. Much later, as a step on the way to getting that laptop dual-booting with Linux, I wiped out that Windows install completely. And I still don't really know much python. So.
**This was the one that got so completely trashed by an actual math professor that they had to revise a lot of it.
141: I think it is! One thing I've learned about configuring things is that everything is always wrong to someone. Realizing that has helped me push on at times because if that's how it's going to be you might as well just pick something and not worry about it.
One thing I've learned about configuring things is that everything is always wrong to someone.
Loads of good advice here. I would only add that I find it very useful to step away from the computer every hour or so to reorient myself. Smoking has been very beneficial to me in this regard, but you could get a cup of coffee or whatever; the point is to give yourself an opportunity to think about the project without staring at particular lines of code. I tend towards obsession with minutiae, and this practice interrupts that.
Listening to experienced programmers argue/troubleshoot/discuss their code (or legacy code) with each other was very useful for me. Users' group, maybe? Following comments on checkins?
I doff my hat to 46. Also, SICP is great.
143, meanwhile, yes, this is the annoying thing about Python. We have several different ways of distributing modules, all of which claim to be "easy". None of them work anywhere near as well as any given Linux package manager, and annoyingly, if you use pip/easy_install/whatever to get python modules, they're outside the package manager's remit and therefore you won't get updates for them. A lot of python stuff is available via your friendly local package manager, but nowhere near enough to manage everything through it like you would the rest of your system.
143:
I had that same issue when I was starting out with python, but eventually solved it by installing the Enthought python distribution (includes basically everything and several kitchen sinks). It has some nice features so you can re-install it every now and then and it will only install the new packages that you're missing.
We have several different ways of distributing modules, all of which claim to be "easy".
Oh god. This. I've been seriously considering putting together my own Python distribution with all the packages I want, so I only have to have one install that I can use on all my various computers. But that turns out to be a lot of work, especially if I want to run all the compilers, instead of just taring a bunch of binaries together.
Then I found WinPython, which has most of the packages what I want, and is 3.x based, so I can finally put years of shitty 2.x unicode support behind me. Still not happy about the installer and distribution mess, though, but being able to run iPython Notebook on Python 3.3 has me satiated for the moment.
One of the best introductions to a language I've read is Python for the Impatient http://abiens.snv.jussieu.fr/mv448/python_for_impatient.html
Which is very short and gives a fairly good idea on the bare bones things somewhat experienced programmers look at when dealing with a new one ...
143: I was almost at the point of dropping my latest class because of how hard it was to install Visual Studios. We're supposed to use VS2010 so I tried to install the software and it requires that you burn the software to a disc and load from the disc. My laptops don't come with optical drives because this is 2014 so I tried three different programs for mounting the image and they each had different types of failures. I pivoted to trying VS2012, which uses a web installer, but it was missing an essential package. I couldn't use VS2013 because the class doesn't have the appropriate libraries for it. After three days working simultaneously on two different laptops, I finally got an extractor to properly extract the files and install VS2010. Ridiculous.
I downloaded Python which already has a GUI. Then I downloaded iPython which said it couldn't install. Then I downloaded "Setuptools" to let me install iPython, and it said I still can't install because I have to be logged in as an administrator, which apparently I am not normally on my own laptop. Then I managed to open iPython but it just looked like a normal command line, so I'll hold off on that for now.
This requires a lot of backtracking. It's hard enough just to figure out which installer to download. I spent about 2 hours typing away in the basic Python GUI anyway.
Cryptic ned: oo, play with ipython a little -- so much cooler than the usual commandline. THere are good tips-and-tricks teasers about.
Or Enthought. I'd be all over Canopy if it had emacs keybindings (maybe magically now supported? I should go look).
iPython does look like a regular command line tool, though it does have some cool improvements. Its iPython Notebook that has the revolutionary GUI. e.
But its a huge pain in the ass to install if it doesn't already come with your Python distribution. Too bad its not
The GUI that comes with Python is crap, and has been for a very long time.
nb, iPython looks like any commandline, but is more stateful. Useful if you like that sort of thing. I don't know why I don't adore Notebooks... no, I do: I think they take people close to doing what makefiles used to and then leave them in misleading states. (This is based on seeing people use them at Software Carpentry workshops.)
156: What does that mean exactly?
Not that I used anything but the command line anyway so far. But somehow I am more comfortable with something that looks like a Window than something that looks like my dad's computer circa 1991.
SAS has a horrible GUI. I always assumed somebody in marketing told them they needed to advertise that they had a graphical interface. The only thing I ever used it for was the blackjack game.
158: If you're on Windows, get the Python for Windows extensions. It's got a better IDE than IDLE. iPython's pretty great but really only makes sense if you're used to working in a Unix environment IME.
What does that mean exactly?
IDLE was the second best IDE I could find when I started with Python fourteen years ago, and it hasn't changed since then. I'm all for keeping it simple, but simple shouldn't mean ugly and not extensible.
The iPython Notebook linked in 155 looks weirdly Mathematica-like.
Yes, its called IDLE, after Eric Idle. The early Python community had an obsession with Monty Python, which is also why all the variables in early Python sample code are named "spam".
This is the kind of shit ogged needs to know.
I've never used Mathematica, but it doesn't surprise me. iPython comes from the Scientific Python tradition, which draws on a heavy Mathematica influence.
The early Python community had an obsession with Monty Python, which is also why all the variables in early Python sample code are named "spam".
Is that also why the language itself is named "Python"?
I really need to just switch everything to iPython Notebook. For one thing, it might mean I'd actually keep a rationally organized, singular lab notebook. And all this matlab can't be buying me anything good in the end.
Python comes with a GUI?Yes, its called IDLE, after Eric Idle
If the answer to essear's question is "yes", then it's called tkinter.
IDLE being an interactive development environment written using tkinter as its GUI toolkit.
That's some fine pedantry right there, that is.
iPython comes from the Scientific Python tradition, which draws on a heavy Mathematica influence.
Really? I haven't noticed much commonality. The numpy stuff is mostly modeled on Matlab.
Oh, wait. I didn't realize "Scientific Python" is something different from scipy, so I might be missing the point.
if you want to really learn to program and not just hack and cut till something works the best books to go through are Yale Patt's "Introduction to Computing" (he also has a lot of good architecture papers with his students,) Robert Sedgewick's "Algorithms," and thirty years into my career Knuth still is awesome. If you really spend 3-4 months reading through these and doing exercises then picking up a language specific book is pretty easy.
Cutting and pasting code you google is a pretty good way to develop shitty code that will get you in trouble if you claim it as yours.
Don N.
Entirely due to my own fault, my home wi-fi is suspended until my recent payment goes through. Meanwhile I have
3G on my phone so I can still while away my current winter virus on the Internet, albeit more expensively. I notice however that I can't get on to Crooked Timber but it doesn't seem as if it's down. Can anyone think of a reason why this should be?
Are you trying to put in a comment that mentions Ghana?
Make sure you're trying to get to crookedtimber.org and not www.crookedtimber.org. For some reason whoever hosts them doesn't advertise the latter.
Don N.
177 is true. Incidentally this means that the link from here no longer works (I realise that the norms of this place preclude ever updating the blogroll, but them's the breaks; if you want to, you can go to ObWi from here, and their link works.)
Also avoid www.crookedtimber.org. It's porn for people with a fetish for penis bending.
I was trying both without and with the www. Neither works not can I follow the links. Can't try through Google cache either as it now hides them and refuses any option to switch from mobile to classic search page.
It makes me sad when I entirely miss threads like this.
20 is terrible advice for someone who is struggling with basic programming. Git is probably the equivalent of an MIT weeder class for professional programmers. I love it (I do!) but it's all sharp corners.
ogged, are you using anything for source version control? I think SVN is easy to set up, though it's considered very old-fashioned. Mercurial has a reputation for being simpler than Git, but I'm not sure if it's simpler in ways that would matter to a beginner.
124: The C Programming Language is as useful as everyone says, especially since your iOS app, at the end of the day, gets turned into vanilla C by gnomes very deep in the Xcode caverns.
I don't really have any idea, but I'd be surprised if this is true. Doesn't Objective C have a proper front-end emitting LLVM IR? Is it still a bolted-on cfront-style translation layer?
181.2: you're terrible at trolling ogged.
are you using anything for source version control?
I didn't for my first app, but was planning to for the next. Git and Subversion are both built into xcode, but I hadn't much looked into which to use.
174, your attempt to dissuade people from trying to learn by saying it's too complicated would only work if you were a known member of the community.
167: If you're using matlab and considering ipython notebook, how about ijulia notebook? I'm pretty biased, but I much prefer julia to python, especially for matlab-y things.
As a language, julia doesn't reject functional programming, as optional type annotations, etc.
But the real reason is that when I run into a performance issue I'm not forced to write C (and I say this as someone who's spent the majority of their career writing C, assembly, microcode, or Verilog). Python is slow enough that all the interesting numpy/scipy stuff is written in C. That's great if it does exactly what you want already, but you often end up writing C if you're experimenting with new things.
ogged should go through a Haskell tutorial and come back and tell us if it all Just Makes Sense to someone whose brain isn't damaged by the Von Neumann model. Like maybe http://book.realworldhaskell.org/read/
181: git's fine for a beginner as long as they're working on their own. All of the really tricky stuff only becomes an issue when you're working with other people.
It makes me sad, though, to realize that of all the VCS's out there Perforce is far and away the best. 'Cause Perforce sucks.
188.2: Your brain has been damaged by the Von Neumann model, clearly.
I keep meaning to try julia. A friend of mine periodically asks me whether I've played with it yet. Or did, before he disappeared into a finance job and stopped being able to talk about what he's working on.
For learning git, what I did was go through the git classes on codeschool.com (which also has iOS, front-end, and Rails stuff) in junction with
They're both command line oriented, though.
186: the nice thing about matlab is that everybody in my subfield uses it. Python there is at least a substantial minority of people who understand it, and are working in it. Julia would... limit collaboration.
Matlab is the universal language in my area as well. In principle I should be able to use Octave as a substitute, but very few people seem to do that.
Although, speaking of weird languages, I have fond memories of ML. I like to imagine that the ML runtime system is actually a tiny Robin Milner, who carefully figures out the types of all your variables and lets you know if anything is wrong.
source version control
I should have said that I used nothing designed for that purpose, but even now, I have half a dozen textedit windows open with known good snippets of code for various functions in the app.
I guess if you're mostly working in Xcode who cares but you should pick a fancy (i.e. useful) text editor horse, it's fun.
198 gets it exactly right. This guide should come in handy.
I'm trying very hard not to get sucked into obsession with the tools of the trade. Most things are good enough, I tell myself. But if there's a compelling reason, and I don't have to fiddle too much to get something better, sure.
199: Code completion and syntax highlighting, mostly. Code exploration is also useful.
I'm trying very hard not to get sucked into obsession with the tools of the trade.
I thought you wanted to eventually be a real developer?
I use the SAS editor even for things that aren't SAS. The ability to cut and paste columns comes in very handy and sometimes it's nice to see everything after a quotation mark turn purple.
202: I would add regexp support/quality find-replace and maybe project support. But textedit doesn't even have line numbers! I would be lost without line numbers.
200 Thanks for posting that. That was a fun thread too.
Sure, ok. Xcode has all this stuff, and seems pretty nice to me. When I start coding in another language, I'll revisit. Textedit was just used to dump bits of code, not to edit them.
200: I remain sad the editor I use isn't in there.
208: I would not have figured you for a pico diehard.
Hah! I totally used pico long past when I should have stopped, actually. But no. I use vim a fair bit but that's not what I mean either.
I don't use a text editor. I just redirect commands from the shell to into text files.
182: Doesn't Objective C have a proper front-end emitting LLVM IR?
By all means! But when I was first learning the language, and learning basic C at the same time, it was much easier to conceptualize one as being built on top of the other, rather than worrying too much about what the compiler was doing. Technically, of course, I should have referred to dwarves and not gnomes.
181 on git is a good point too. But Xcode has git baked in these days, and I think creates repositories by default. As annoying as it is to depend on one company's ecosystem, Apple's is at least well made, and if Ogged plans to stick with iOS for a while, getting one of those books on just finding one's way the fuck around Xcode wouldn't be a bad idea.
back to the original Q.
the three things:
1. a computer isn't just dumb, it doesn't even care. if it's doing something wrong, it's because you told it to.
2. when it gets hard to find the problem, put printf's (or equivalent) everywhere. fancy word for this is 'logging'.
3. it's probably been done before. learn how to express your problem in the most abstract way possible, because that will help Google find the answer for you.