Thanks! Ruby looks good, but I know more Python/Django folk, so it’s tempting to leave Windows for a bit. I guess I’ll start with the RubyStack and see what I can build. I’m guessing a lot of the basic skills I need are transferable to Django development anyway.
I’m a rails developer myself and i shudder to think of developing in Windows. It really is pretty simple in Ubuntu, just open Synaptic and download anything that says ruby.
If you want to go with heroku you don’t even need apache.
I wonder if there is a “DjangoStack” for windows about someplace. Maybe your friends would know? Not that I’m saying linux is bad, just that you’ve already got enough stuff to be absorbing without cramming in two languages and frameworks at once. (But you are right, the fundamental concepts are the same.)
I downloaded RubyStack and the install process doesn’t do anything; not sure why. It flashes a BitNami logo and then goes blank, but the process is still sitting there in my task manager… maybe it doesn’t play nice with 64 bit Windows 7. At any rate BitNami also has a DjangoStack! So I’ll try that instead. :/
I downloaded RubyStack and the install process doesn’t do anything; not sure why. It flashes a BitNami logo and then goes blank, but the process is still sitting there in my task manager… maybe it doesn’t play nice with 64 bit Windows 7. At any rate BitNami also has a DjangoStack! So I’ll try that instead. :/
...and that also didn’t work, so it looks like Ubuntu for me, where my problems will be even greater. I hate computers.
So the good news is, you need none of these “stacks”. Really. What you’re trying to do here is run before you’ve learned to walk.
Web programming is as simple as writing a program that does
puts "<html>Hello World</html>"
and redirecting the output to “index.html” when you run this from shell. This gets you a dynamic Web site generated from a program that you wrote.
If that’s too simple for you, congratulations: you’ve mastered enough of the fundamentals to get on to the next step. Something like parametrize the Web page to greet you by your name.
You may be protesting at this point that running the program whenever you want to update the Web site wasn’t your idea of “Web programming”—you want a Web site that updates on the fly.
Now we’re talking about Web frameworks. But still you don’t need a “stack”, you need to build up an understanding of how Web servers work, and maybe study a few architectures of historical interest:
CGI (the way Web programming was done for years, basically a hack to get the “invoke program from command line and redirect output to a Web connection” idea to work on-the-fly)
PHP as an Apache module, or what happened when the Web server coders realized the hacks weren’t going away anytime soon
frameworks like Sinatra, a gentle introduction to Web frameworks in a modern language without excessive baggage
With something like PHP or (if you lean toward Ruby) Sinatra, you’re reaching the point of building up arbitrarily complex Web pages in response to HTTP requests, on the fly. At this point you’d better have a solid understanding of how the dance unfolds between Web clients (typically browsers, but not just) and Web servers. What are requests and responses, headers, parameters.
Rewrite your Hello World example in Sinatra. The next exercise is to orchestrate a simple interaction where your Web app displays a form with a text box asking for your name, and a Submit button which takes you to a page greeting you by name. Just this little loop requires you to stay on top of a surprisingly large number of abstractions spanning several layers.
Note that at this point you still don’t need a database, knowledge of CSS is superfluous, and client-side scripting very much not even on the agenda. Discussion of design patterns like MVC should be deferred until you have experienced for yourself the issues that these patterns are supposed to solve. (That way, you can judge for yourself to what extent the big frameworks like Rails actually solve the issues. Affective Death Spirals are just as deadly in programming as in the rest of your intellectual development.)
When you feel comfortable with this kind of program (check that by writing a more complex one like a calculator or a tic-tac-toe game), you can move on to one that handles arbitrarily large sets of data. By now if you feel like tackling MySQL, go ahead and do that, but you could also focus on your learning programming (as opposed to learning technology). Get your data from a text file, maybe YAML which is like XML, only much more friendly.
Anyway, that’s the kind of learning that works for me: instead of getting in way over my head, I try to cut it down into chunks that I can master one at a time.
Get your data from a text file, maybe YAML which is like XML, only much more friendly.
I’m confused, you’re talking about data for a tic-tac-toe game, which should be stored in YAML? I got a tad confused because YAML sounds like HAML and I’d just been reading about HAML, then I realized I’d never used XML and didn’t even realize what it was for, so I tried to see if it was related to HTML which I’ve used a lot of, but it looks like it’s not, it’s just a way to format text files so that programs/scripts can import data from them. HAML on the other hand is a prettier version of ERB which is a way/template to use Ruby to make HTML use variables. So HAML is this thing I shouldn’t be using yet because it’s complicated and I should be focusing on Sinatra/Ruby whereas YAML I should start using eventually because it’s a way to format data for easy interpretation by ruby scripts and the like. Or did you mean YAML should be used for other things? Am I totally off?
No, something like tic-tac-toe has a bounded set of data to keep track of, no database or other long-term storage required.
Once you’ve mastered tic-tac-toe or the like the next kind of Web app you’re likely to tackle is one with an unbounded data set: for instance, a list of user accounts, or a list of posts and comments. Data like this should survive shutting down and restarting your server.
The traditional approach is to use MySQL to store this kind of data, but I would advise against getting a premature interest in MySQL, as there’s a risk that doing so will warp your thinking. YAML is an alternative for storing such data that would keep you more in the Ruby world.
All four of HTML, XML, YAML and HAML share the two initials ML—they’re all “markup languages”. It’s easy to get confused because the differences between them are minute, in the grand scheme of things, and only relevant to people who care so deeply about what tools they work with that it magnifies the differences.
The one you can’t do without is HTML, so it makes sense to use only that for a little while. (Actually in the past few years HTML has been redefined as a dialect of XML, so using it means you’ll also be using XML.)
Using HAML makes a lot of sense, but there’s also a bias it (and ERB, and every similar templating language) induces that you want to be aware of. When you start using these things you start thinking of your generated Web pages as “documents with Ruby variables”.
This is fine for some class of features but it will wreck your design skill if you generalize the approach too eagerly. Some (indeed many) portions of a significant Web app should be thought of as Ruby objects with the ability to output a HTML representation of them. Things like row/column tables; menus; data entry forms; recursively nested structures like LW comment threads; and so on.
I think I’m limited to just playing around with Ruby on Windows for now; my wireless card doesn’t work in Linux. And the thing that might work to fix that is in a package that I need the internet to download. I hate Linux so much, it’s seriously a horrible operating system. GRUB actually knocked out access to all of my partitions once, meaning I couldn’t even get to GRUB and therefore Windows 7; there’s no way I would’ve been able to fix that without SIAI folk. I’m also running it in VMWare and the internet works there but Gems doesn’t: the paths are messed up somehow so that gems don’t run, and the internet isn’t helpful in fixing that. Stupid stupid operating system. No wonder everyone owns a Mac.
Yeah, I was interested in familiarizing myself with Sinatra but without gems working I guess I’ll… uh… play with Python/Ruby and see which I like more until I can afford a Macbook? I feel like it’s a little ridiculous that web programming is so limited on Windows. I must be missing something?
For some reason the whole Web thing had historically much more traction in Unix family OSes. Windows has to do extra work to make it look to the server programs as if they’re running on something Unix-like. Like making its non-Unix paths make sense to programs that are mostly coded with Unix in mind.
So what kind of error messages are you getting when you run gem commands?
″ installing to ~./gem /var/lib/gems/1.8 and /var/lib/gems/1.8/bin aren’t both writeable ” and since /var/lib/gems/1.8/bin isn’t in my PATH gem executables won’t run.
I tried doing what it says here to no avail; it did nothing as far as I can tell. I’m not sure if this is a VM problem or an Ubuntu problem.
We’d need to go to a real-time convo to get anywhere with this, I think. I’m about to have dinner now but I can swing by the LW IRC channel later if that suits you, PM me in that case.
I got gems and therefore Sinatra working. :) I also think I got Rails 3 working but I haven’t tried messing with it yet… Everything seems really spotty; the ‘heroku’ command worked but then it stopped existing so I reinstalled it… Did I just install it in two different places or something? Or did I need to ‘load’ it somehow? This all seems kind of magical in a bad way. Oh well. I’ll take your advice and stick to Sinatra for now. Thanks!
Thanks! Ruby looks good, but I know more Python/Django folk, so it’s tempting to leave Windows for a bit. I guess I’ll start with the RubyStack and see what I can build. I’m guessing a lot of the basic skills I need are transferable to Django development anyway.
I’m a rails developer myself and i shudder to think of developing in Windows. It really is pretty simple in Ubuntu, just open Synaptic and download anything that says ruby.
If you want to go with heroku you don’t even need apache.
I wonder if there is a “DjangoStack” for windows about someplace. Maybe your friends would know? Not that I’m saying linux is bad, just that you’ve already got enough stuff to be absorbing without cramming in two languages and frameworks at once. (But you are right, the fundamental concepts are the same.)
I downloaded RubyStack and the install process doesn’t do anything; not sure why. It flashes a BitNami logo and then goes blank, but the process is still sitting there in my task manager… maybe it doesn’t play nice with 64 bit Windows 7. At any rate BitNami also has a DjangoStack! So I’ll try that instead. :/
I downloaded RubyStack and the install process doesn’t do anything; not sure why. It flashes a BitNami logo and then goes blank, but the process is still sitting there in my task manager… maybe it doesn’t play nice with 64 bit Windows 7. At any rate BitNami also has a DjangoStack! So I’ll try that instead. :/
...and that also didn’t work, so it looks like Ubuntu for me, where my problems will be even greater. I hate computers.
So the good news is, you need none of these “stacks”. Really. What you’re trying to do here is run before you’ve learned to walk.
Web programming is as simple as writing a program that does
and redirecting the output to “index.html” when you run this from shell. This gets you a dynamic Web site generated from a program that you wrote.
If that’s too simple for you, congratulations: you’ve mastered enough of the fundamentals to get on to the next step. Something like parametrize the Web page to greet you by your name.
You may be protesting at this point that running the program whenever you want to update the Web site wasn’t your idea of “Web programming”—you want a Web site that updates on the fly.
Now we’re talking about Web frameworks. But still you don’t need a “stack”, you need to build up an understanding of how Web servers work, and maybe study a few architectures of historical interest:
CGI (the way Web programming was done for years, basically a hack to get the “invoke program from command line and redirect output to a Web connection” idea to work on-the-fly)
PHP as an Apache module, or what happened when the Web server coders realized the hacks weren’t going away anytime soon
frameworks like Sinatra, a gentle introduction to Web frameworks in a modern language without excessive baggage
With something like PHP or (if you lean toward Ruby) Sinatra, you’re reaching the point of building up arbitrarily complex Web pages in response to HTTP requests, on the fly. At this point you’d better have a solid understanding of how the dance unfolds between Web clients (typically browsers, but not just) and Web servers. What are requests and responses, headers, parameters.
Rewrite your Hello World example in Sinatra. The next exercise is to orchestrate a simple interaction where your Web app displays a form with a text box asking for your name, and a Submit button which takes you to a page greeting you by name. Just this little loop requires you to stay on top of a surprisingly large number of abstractions spanning several layers.
Note that at this point you still don’t need a database, knowledge of CSS is superfluous, and client-side scripting very much not even on the agenda. Discussion of design patterns like MVC should be deferred until you have experienced for yourself the issues that these patterns are supposed to solve. (That way, you can judge for yourself to what extent the big frameworks like Rails actually solve the issues. Affective Death Spirals are just as deadly in programming as in the rest of your intellectual development.)
When you feel comfortable with this kind of program (check that by writing a more complex one like a calculator or a tic-tac-toe game), you can move on to one that handles arbitrarily large sets of data. By now if you feel like tackling MySQL, go ahead and do that, but you could also focus on your learning programming (as opposed to learning technology). Get your data from a text file, maybe YAML which is like XML, only much more friendly.
Anyway, that’s the kind of learning that works for me: instead of getting in way over my head, I try to cut it down into chunks that I can master one at a time.
This comment inadvertently recalls to my mind Perlis’s epigram: ‘most people find the concept of programming obvious, and the doing impossible’.
:)
ETA: I remained torn for a while, but I’ve edited the grandparent to fix the mistake.
I’m confused, you’re talking about data for a tic-tac-toe game, which should be stored in YAML? I got a tad confused because YAML sounds like HAML and I’d just been reading about HAML, then I realized I’d never used XML and didn’t even realize what it was for, so I tried to see if it was related to HTML which I’ve used a lot of, but it looks like it’s not, it’s just a way to format text files so that programs/scripts can import data from them. HAML on the other hand is a prettier version of ERB which is a way/template to use Ruby to make HTML use variables. So HAML is this thing I shouldn’t be using yet because it’s complicated and I should be focusing on Sinatra/Ruby whereas YAML I should start using eventually because it’s a way to format data for easy interpretation by ruby scripts and the like. Or did you mean YAML should be used for other things? Am I totally off?
No, something like tic-tac-toe has a bounded set of data to keep track of, no database or other long-term storage required.
Once you’ve mastered tic-tac-toe or the like the next kind of Web app you’re likely to tackle is one with an unbounded data set: for instance, a list of user accounts, or a list of posts and comments. Data like this should survive shutting down and restarting your server.
The traditional approach is to use MySQL to store this kind of data, but I would advise against getting a premature interest in MySQL, as there’s a risk that doing so will warp your thinking. YAML is an alternative for storing such data that would keep you more in the Ruby world.
All four of HTML, XML, YAML and HAML share the two initials ML—they’re all “markup languages”. It’s easy to get confused because the differences between them are minute, in the grand scheme of things, and only relevant to people who care so deeply about what tools they work with that it magnifies the differences.
The one you can’t do without is HTML, so it makes sense to use only that for a little while. (Actually in the past few years HTML has been redefined as a dialect of XML, so using it means you’ll also be using XML.)
Using HAML makes a lot of sense, but there’s also a bias it (and ERB, and every similar templating language) induces that you want to be aware of. When you start using these things you start thinking of your generated Web pages as “documents with Ruby variables”.
This is fine for some class of features but it will wreck your design skill if you generalize the approach too eagerly. Some (indeed many) portions of a significant Web app should be thought of as Ruby objects with the ability to output a HTML representation of them. Things like row/column tables; menus; data entry forms; recursively nested structures like LW comment threads; and so on.
YAML, and pretty much every data serialization method is overkill for Tic-Tac-Toe—you can store a game just as a few integers if you represent the board as a magic square: http://www.reddit.com/r/programming/comments/9904e/interesting_alternative_to_captcha_pic/c0bw41g
Neat!
I think I’m limited to just playing around with Ruby on Windows for now; my wireless card doesn’t work in Linux. And the thing that might work to fix that is in a package that I need the internet to download. I hate Linux so much, it’s seriously a horrible operating system. GRUB actually knocked out access to all of my partitions once, meaning I couldn’t even get to GRUB and therefore Windows 7; there’s no way I would’ve been able to fix that without SIAI folk. I’m also running it in VMWare and the internet works there but Gems doesn’t: the paths are messed up somehow so that gems don’t run, and the internet isn’t helpful in fixing that. Stupid stupid operating system. No wonder everyone owns a Mac.
It helps that Ruby is installed on Macs out of the box :)
Being able to get gems is kind of a big deal in Ruby, but I as I said above you don’t need the big guns like Rails yet.
Yeah, I was interested in familiarizing myself with Sinatra but without gems working I guess I’ll… uh… play with Python/Ruby and see which I like more until I can afford a Macbook? I feel like it’s a little ridiculous that web programming is so limited on Windows. I must be missing something?
For some reason the whole Web thing had historically much more traction in Unix family OSes. Windows has to do extra work to make it look to the server programs as if they’re running on something Unix-like. Like making its non-Unix paths make sense to programs that are mostly coded with Unix in mind.
So what kind of error messages are you getting when you run gem commands?
″ installing to ~./gem /var/lib/gems/1.8 and /var/lib/gems/1.8/bin aren’t both writeable ” and since /var/lib/gems/1.8/bin isn’t in my PATH gem executables won’t run.
I tried doing what it says here to no avail; it did nothing as far as I can tell. I’m not sure if this is a VM problem or an Ubuntu problem.
We’d need to go to a real-time convo to get anywhere with this, I think. I’m about to have dinner now but I can swing by the LW IRC channel later if that suits you, PM me in that case.
I got gems and therefore Sinatra working. :) I also think I got Rails 3 working but I haven’t tried messing with it yet… Everything seems really spotty; the ‘heroku’ command worked but then it stopped existing so I reinstalled it… Did I just install it in two different places or something? Or did I need to ‘load’ it somehow? This all seems kind of magical in a bad way. Oh well. I’ll take your advice and stick to Sinatra for now. Thanks!
Welcome down the rabbit hole!