Hmuh, this is intimidating. I was gonna pick up some PHP but to actually use it for a project I’ll need MySQL and for that I’ll need to set up an Apache web server of some kind… which is intimidating, and I’m probably approaching this the wrong way, especially as I’m not sure yet what I’d even be scripting for. Also I feel alienated as a Windows user; I have Ubuntu but it’s frickin’ annoying sometimes. How do most people get started with this whole hacker thing?
EDIT: Eff it, I’ll switch to Linux and play with Django, it seems easiest. Stupid Linux.
There is essentially no reason to bother with PHP these days. It’s a relic and you’d end up having to learn all sorts of arbitrary distracting things.
I can empathise with the intimidation. There was a whole heap of linux administration stuff that I had to pick up to get started. Fortunately, you don’t need to do anything like that any more and it can be even easier on windows! You can install the whole stack (ie. Ruby, Rails, apache and mysql) all at once. From there you can just find a tutorial to follow then start copy and pasting stuff from similar applications till you have one that does what you want. (You didn’t hear ‘develop by cut and paste and google’ from me! ;))
RubyStack is one option. The one I have used is InstantRails. I think that one is getting out of date (about a year old) but it probably doesn’t make any difference for your purposes.
I don’t know what the options are for other web development frameworks. I’m sure there is something simple out there for Python somewhere but I just haven’t had reason to look into it.
So if you wanted to get started it is easy enough. Depends on your interest.
How do most people get started with this whole hacker thing?
When I have something I want to do I go do it. Sometimes that means learning stuff like programming. Sometimes it means learning pharmacology. That’s probably the underlying spirit behind the ‘hacker’ mindset.
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!
I am not a web developer, but as a Linux user of 15 years let me explain why it might not be as bad as you think.
Get any old computer and put Linux, Apache, MySQL on it. (Those softwares require very little in the way of hardware resources unless you are serving 100s or simultaneous users.) Network the Linux machine with your Windows machine. Even better if your Windows machine has enough memory, run Linux on a virtual machine on Windows. I do not know what the cool kids are using these days in the way of virtualization software, but VMWare would work.
Use a web browser on Windows to test your web app of course.
Editing of text files (mostly config file for Apache, etc) on the Linux box or Linux virtual machine can probably be done using whatever text editor you already use on Windows though I do not know the details of how to set that up in any editor other than Emacs. (For Emacs I would probably use the FTP protocol. The SMB and NFS protocols are alternatives.)
True, you will probably need to interact with a shell on the Linux box or the Linux virtual machine occasionally (using something like PuTTY on Windows), but this way saves you the trouble of having to learn anything about Linux’s graphical user interfaces. The good thing about the shell is that it lends itself very well to textual tutorials, with the result that there are 10s of 1000s of blog posts and web pages describing in exact detail how to do stuff in the shell. I would be happy to answer questions by email about the shell, but I do not know about Apache or MySQL.
This way of working with Linux—by establishing connections to it with browsers, text editors, FTP clients and ssh clients like PuTTY on Windows is very common.
Everything I have described is the worst-case scenario. You can probably either install Apache, MySQL, etc on Windows like wedrifid says or avail yourself of some online service that will host the software for you and allow you to configure and administer it using a web interface.
It’s a lot of fun. Now you’re making me whimsical! ;)
Hmuh, this is intimidating. I was gonna pick up some PHP but to actually use it for a project I’ll need MySQL and for that I’ll need to set up an Apache web server of some kind… which is intimidating, and I’m probably approaching this the wrong way, especially as I’m not sure yet what I’d even be scripting for. Also I feel alienated as a Windows user; I have Ubuntu but it’s frickin’ annoying sometimes. How do most people get started with this whole hacker thing?
EDIT: Eff it, I’ll switch to Linux and play with Django, it seems easiest. Stupid Linux.
There is essentially no reason to bother with PHP these days. It’s a relic and you’d end up having to learn all sorts of arbitrary distracting things.
I can empathise with the intimidation. There was a whole heap of linux administration stuff that I had to pick up to get started. Fortunately, you don’t need to do anything like that any more and it can be even easier on windows! You can install the whole stack (ie. Ruby, Rails, apache and mysql) all at once. From there you can just find a tutorial to follow then start copy and pasting stuff from similar applications till you have one that does what you want. (You didn’t hear ‘develop by cut and paste and google’ from me! ;))
RubyStack is one option. The one I have used is InstantRails. I think that one is getting out of date (about a year old) but it probably doesn’t make any difference for your purposes.
I don’t know what the options are for other web development frameworks. I’m sure there is something simple out there for Python somewhere but I just haven’t had reason to look into it.
So if you wanted to get started it is easy enough. Depends on your interest.
When I have something I want to do I go do it. Sometimes that means learning stuff like programming. Sometimes it means learning pharmacology. That’s probably the underlying spirit behind the ‘hacker’ mindset.
I rather like PHP. Examples of “arbitrary distracting things”?
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!
I am not a web developer, but as a Linux user of 15 years let me explain why it might not be as bad as you think.
Get any old computer and put Linux, Apache, MySQL on it. (Those softwares require very little in the way of hardware resources unless you are serving 100s or simultaneous users.) Network the Linux machine with your Windows machine. Even better if your Windows machine has enough memory, run Linux on a virtual machine on Windows. I do not know what the cool kids are using these days in the way of virtualization software, but VMWare would work.
Use a web browser on Windows to test your web app of course.
Editing of text files (mostly config file for Apache, etc) on the Linux box or Linux virtual machine can probably be done using whatever text editor you already use on Windows though I do not know the details of how to set that up in any editor other than Emacs. (For Emacs I would probably use the FTP protocol. The SMB and NFS protocols are alternatives.)
True, you will probably need to interact with a shell on the Linux box or the Linux virtual machine occasionally (using something like PuTTY on Windows), but this way saves you the trouble of having to learn anything about Linux’s graphical user interfaces. The good thing about the shell is that it lends itself very well to textual tutorials, with the result that there are 10s of 1000s of blog posts and web pages describing in exact detail how to do stuff in the shell. I would be happy to answer questions by email about the shell, but I do not know about Apache or MySQL.
This way of working with Linux—by establishing connections to it with browsers, text editors, FTP clients and ssh clients like PuTTY on Windows is very common.
Everything I have described is the worst-case scenario. You can probably either install Apache, MySQL, etc on Windows like wedrifid says or avail yourself of some online service that will host the software for you and allow you to configure and administer it using a web interface.