PDA

View Full Version : Noob giving it a go at coding




ohla313
Apr 25, 2011, 11:21 PM
I am a complete newb to programming or anything and want to get my feet wet. I am following the w3schools and lifehacker videos to make some sense of this all.

I have a small question though, I am using TextEdit to try out my code (am too cheap to pay for TextMate, $60?! wow..) and I want to be able to see how my code is shown in a browser. I saved my file as an .html file but when I open it in Safari I see all my tags and not links being clickable. How do I change this to make it clickable?

Thank you for your help!



jiminaus
Apr 25, 2011, 11:30 PM
Check out TextWrangler either in the AppStore or http://www.barebones.com/products/textwrangler/.

When you used TextEdit, this won't work.

1. Enter HTML code
2. File | Save
3. File Format: Web Page (.html)

The procedure above is meant to create an HTML rendering of a Rich Text Document. So you meant to use the WYSIWYG features to make a document and then let TextEdit create the necessary HTML code to replicate your formatting in a web browser.

If you want to code HTML directly in TextEdit.

1. Format | Make Plain Text. (You shouldn't see any formatting bar at the top of your document window).
2. Enter HTML code
3. File | Save and enter a filename ending .html
4. In the "warning" dialog box, click Use .html (or just hit return).

ohla313
Apr 26, 2011, 12:07 AM
Great! Thanks a lot that did the trick!

Do you have any suggestions in how I should go about learning to code and if the resources I listed above are adequate?

EDIT: Why are Text editors so expensive? TextMate at $60 and BBEdit at $100?? Will look at TextWrangler

thejadedmonkey
Apr 26, 2011, 12:13 AM
I use textwrangler. It's amazing, and free :)

(at least the version from 2 years ago was, IDK about now)

jiminaus
Apr 26, 2011, 12:19 AM
Why are Text editors so expensive? TextMate at $60 and BBEdit at $100?? Will look at TextWrangler

While you could code your own GUI text editor in about 5 minutes, these editor go way beyond basic text editing.

The strange thing though is that I have TextMate and use it as my primary editor (outside of XCode). And yet, I know vim well, and could do everything I do in TextMate (and probably more) in vim, vim is free, and it even comes pre-installed.

As an infamous Australian politician once was renowned for saying, "Plz eksplane". (Sorry to the non-Ozzies, you won't get this).

ohla313
Apr 26, 2011, 12:43 AM
While you could code your own GUI text editor in about 5 minutes, these editor go way beyond basic text editing.

The strange thing though is that I have TextMate and use it as my primary editor (outside of XCode). And yet, I know vim well, and could do everything I do in TextMate (and probably more) in vim, vim is free, and it even comes pre-installed.

As an infamous Australian politician once was renowned for saying, "Plz eksplane". (Sorry to the non-Ozzies, you won't get this).

How is TextMate? What is the learning curve like? i'll probably get Text Wrangler first to see where it goes. VIM pre-installed? I don't see it..

and i get the joke, "Please explain" lol

lloyddean
Apr 26, 2011, 12:50 AM
whereis vim

jiminaus
Apr 26, 2011, 02:08 AM
How is TextMate? What is the learning curve like? i'll probably get Text Wrangler first to see where it goes.

There's a zero learning curve for the basic of functions of TextMate. The intermediate functions are intuitive, they'll behave just you'd expect them to, assuming you're used to Mac editors. You don't need to worry about the advanced functions for now.

But I'd say just start with Text Wrangler because it's free. If you find yourself needing more than Text Wrangler provides, then look towards paying for an editor.


VIM pre-installed? I don't see it.

You won't find VIM in the Applications folder because only the text version is installed. You've got to run it from the Terminal. You can get a GUI version from http://code.google.com/p/macvim/.

mufflon
Apr 26, 2011, 02:10 AM
whereis vim

You need to use the command line (e.g. the terminal)

balamw
Apr 26, 2011, 06:25 AM
You need to use the command line (e.g. the terminal)

Learning how to use the CLI is actually very useful when learning programming beyond JavaScript. So don't be afraid of it.

B

ohla313
Apr 26, 2011, 12:09 PM
Thanks everyone for the help thus far. a couple questions though..

Can I screw up my Mac through Terminal or is it pretty much a stomping ground to check things out?

I'm learning basic HTML in w3schools site and JavaScript from LifeHacker, is this a good start?

notjustjay
Apr 26, 2011, 01:15 PM
You need to use the command line (e.g. the terminal)

Pssst. "whereis vim" is a terminal command ;)

Cabbit
Apr 26, 2011, 01:18 PM
Thanks everyone for the help thus far. a couple questions though..

Can I screw up my Mac through Terminal or is it pretty much a stomping ground to check things out?

I'm learning basic HTML in w3schools site and JavaScript from LifeHacker, is this a good start?

Yes you can deleted absolutely everything on your mac just by typing in "rm -f -r *" in the wrong place. You get no dialog or warning, it just goes right for the delete.

Though once you learn the basic commands its very easy, perhaps try a linux or bsd virtual machine to learn the terminal on first.

notjustjay
Apr 26, 2011, 02:05 PM
Can I screw up my Mac through Terminal or is it pretty much a stomping ground to check things out?


Yes, you absolutely can screw things up, however, if you're careful, you should be just fine.

You will do absolutely no harm exploring your file system using commands like "cd" and "ls", and probably can't do any harm by copying files using "cp".

You do want to be very careful once you start playing with "mv" (move or rename files) and "rm" (to delete files). "rm" has a few switches that are very useful but can be tragic if not used carefully. "rm -f" will delete a file without asking you to confirm and overriding any "read only" attribute set on the file. "rm -r" will delete recursively everything in the folder tree you specify. "rm -rf" is a particularly potent combination -- it will recursively delete everything in the folder tree AND do it without asking you for confirmation. Apply that combination in the wrong place and you can end up with a LOT of files missing!

jiminaus
Apr 26, 2011, 03:41 PM
The Terminal can be a dangerous place because the commands you run in it assume you know what you're doing. Don't let it scare you, just be careful. Before you hit return, always check two things. Check you've typed the command correctly. Check that you're in the right directory.

But the usual mantra applies. Backup! If you use Time Machine, you're automatically getting hourly backups. So if you issue the wrong command or the right command in the wrong directory, you can restore the files very easily from Time Machine. If you manage to hose your whole system, boot from the Mac OS X DVD and do a full restore from your Time Machine backup. But don't let this lull you into a false sense of security.

And a GUI can be just as dangerous. When I used Windows, I was in the habit of hitting shift+delete then enter to delete useless files that I wanted not to go into the Recycle Bin. When I went from Win XP to Vista, they changed the behaviour of Windows Explorer. A couple of times, I hit shift+delete then enter expecting to have deleted a file, but unexpectedly had the whole folder selected instead of just the file. Bam! Whole folder gone. Whole week's worth of the work gone. And no time machine! :(

ohla313
Apr 30, 2011, 12:56 AM
Over the past days I was going over what I wanted to get out of coding and what I needed for a basic text editor. I realized what I needed.

Which text editor will allow me to see the page I am coding? For instance, I am writing HTML and all that in one pane and I can see the web page changes in the pane next to it.

Hopefully there's an editor out there that does that.

Thanks!

jiminaus
Apr 30, 2011, 03:00 AM
Which text editor will allow me to see the page I am coding? For instance, I am writing HTML and all that in one pane and I can see the web page changes in the pane next to it.


The free way I know to do that is to have a text editor and web browser side-by-side. Code in text editor. Cmd+Tab to web browser. Cmd+R to refresh web browser. Cmd+Tab back to text editor. Repeat.

The only editor I know of that does live preview while HTML coding is Dreamweaver. But at USD 30 per month for a subscription or USD 399 outright, I wouldn't recommend you consider it. And you'd need to learn Dreamweaver onto top of HTML, CSS, JavaScript, etc.

bpaluzzi
Apr 30, 2011, 06:25 AM
Over the past days I was going over what I wanted to get out of coding and what I needed for a basic text editor. I realized what I needed.

Which text editor will allow me to see the page I am coding? For instance, I am writing HTML and all that in one pane and I can see the web page changes in the pane next to it.

Hopefully there's an editor out there that does that.

Thanks!

Coda has this functionality, but it's honestly not much more convenient than using two separate programs and switching between them. Once you really get into testing, you'll want to use multiple browsers, anyway.

As for text editors, I use TextWrangler for 'separate' file editing, when I just need to make a quick change in something.

For actual coding/project file manipulation, I use Eclipse. It's a full-featured IDE, featuring debugging, class inspector, auto-completion, and the like. It's also free! There are specific builds available for most common languages, or you can just download the "Classic" app.

http://www.eclipse.org/downloads/

ohla313
Apr 30, 2011, 05:42 PM
Thank you PghLondon and jiminaus for your responses. Sorry but could you dumb it down a bit on what you are saying?

From what I read, Coda would be able to do this but it isn't that useful? And in order to see where my needs are, I should start with the free TextWrangler? Is having too many text editors on my MacBook ok? Should I worry about conflicts or anything? I might just want to try out TextWrangler, Coda, and TextMate at the same time and see.

bpaluzzi
Apr 30, 2011, 06:29 PM
Thank you PghLondon and jiminaus for your responses. Sorry but could you dumb it down a bit on what you are saying?

From what I read, Coda would be able to do this but it isn't that useful? And in order to see where my needs are, I should start with the free TextWrangler? Is having too many text editors on my MacBook ok? Should I worry about conflicts or anything? I might just want to try out TextWrangler, Coda, and TextMate at the same time and see.

Yeah, it's not really that useful -- whether you're switching in between tabs in the same app, or switching between two apps is about the same, in my opinion. Honestly, it's easier for me to switch between apps, as I can just cmd-tab between them.

No worries with having too many text editors. TextWrangler is a great text editor -- beginning or pro. It doesn't do auto-complete, but it does do color-based syntax highlighting. I use it on all of my development rigs.

Coda combines a text editor (with the syntax coloring, like TextWrangler), an FTP client, an SSH/telnet terminal, and a WebKit (Chrome/Safari) "browser" for doing previews. It's a good idea in concept, but for me at least, I was able to work better using separate programs that are optimized for each of these tasks. Add in the fact that the "separate" versions of these programs can all be found for free, while Coda costs $100 (wow, they've really increased the price on that!), and it was a bit of a no-brainer (for me, at least)

virtualandy
Apr 30, 2011, 11:52 PM
If you want to edit html/js and see it live, take a look at Firefox + Firebug (I guess these days, Google Chrome and Safari both have developer tools that do the same thing).

Also, w3schools kind of sucks. Take a look at: https://developer.mozilla.org/en/JavaScript/Guide

If you got some extra coin to buy a book, I like this one: http://www.amazon.com/Eloquent-JavaScript-Modern-Introduction-Programming/dp/1593272820 (it's about learning to program w/ JS, so maybe appropriate).

Unggoy Murderer
May 1, 2011, 03:40 AM
I do professional level website design in my spare time, and I use Panic's App called Coda. It's available from the App Store, and I paid $100 dollars (before it was in the App Store, don't know the price now) but it is the best text editor I have ever used. It supports syntax highlighting for loads of file types (htm, CSS, js...) and has a build in browser for real-time previewing. There's a 14 day trial available, and I recommend you give it a try =]