Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Getting started with Web programming on the Mac

Getting started with Web programming on the Mac
Thread Tools
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 14, 2010, 08:05 PM
 
I'm a developer, specialized in desktop application programming. On the Mac, i'm familiar with XCode and IB for desktop apps, and on Windoze i'm familiar with VS.

The only 'web'(web pages, Javascript, HTML, CSS, etc) I have done is using ASP.Net on Windows(code behind, etc).

I'm very curious about web programming on the Mac, and have no clue where to start.

Is there an IDE ? what languages/libraries are supported ? where do i begin ? I'd like to use HTML, JavaScript(or JS libraries like AJAX, Cappuccino, etc) and CSS. I'm not familiar with PHP/Perl so would prefer to avoid that, just cause of the overhead involved in learning a new language.

Any suggestions, and links to tutorials(on the Mac specifically), would be appreciated.

Cheers
     
Moderator
Join Date: Dec 2000
Location: Polwaristan
Status: Offline
Reply With Quote
Mar 14, 2010, 08:23 PM
 
I'm not a programmer or developer, but don't people like Ruby on Rails for some things?
     
Posting Junkie
Join Date: Oct 2005
Location: Houston, TX
Status: Offline
Reply With Quote
Mar 15, 2010, 01:12 AM
 
Are you interested in the browser side of things (HTML/CSS/JS) or the server side of things (pick your scripting language)?

For the former options on the Mac are BBedit, Coda, and Dreamweaver.

For the server side of things you can set up Apache on your Mac and whatever language support you need (rivet, RoR, mod_php) with varying degrees of difficulty. If you like Xcode you may be able to get plugins for some scripting languages, or just use a decent text editor (BBedit, TextWrangler, jedit).

The web developers (both sides) at my employer use vi almost exclusively.
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Mar 15, 2010, 02:30 AM
 
There is no IDE necessary for any web programming language, none (that I'm aware of) are compiled. It's just about picking your favorite text editor and picking your poison as far as languages go. These days it's not just about languages though, it's also about toolkits that make doing things easy in various languages. There are numerous Javascript and PHP toolkits/frameworks, and many Javascript widgets that require popular JS frameworks such as Prototype or jQuery.

There is also the issue of whether you are interested in MVC style programming (which I recommend), or non. Ruby on Rails is all about MVC, but you can get this with several of the PHP toolkits too. Your choice of language should also be partially guided by your intended audience. For instance, if you want every hosting provider in the universe to offer some sort of web based app you intend to write, PHP might be a better choice than RoR since it is more commonly found.

You will also need a developer space for testing all of this, and I also recommend learning something like Git for managing your code. Not only does Git make tracking changes and rolling stuff back easy, but it is also a good way to transport your changes from your test server to your live, production server. In general it is not a good idea to hack away at a live site.


I'm purposely being a little "here are all the doors" in writing this because it would be a good idea to make some choices and research all of your options carefully before diving in blindly. I'd be happy to provide you with some more specific advice, but we'll need to know more about your goals and the project(s) you have in mind
     
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 15, 2010, 09:04 AM
 
@mudell, yeah client side apps. As far as the server side, im used to the M$ side of the fence.... IIS, ASP.Net and a whole lot of code(VB.Net and C#(yuck)) behind and AJAX.

This is a 'learning' project for me, as i know next to nothing about getting a webpage/site up and running on the Mac side of the fence. My goal is to be able to program RIAs on non-Microsoft systems.

I think RoR is what Apple uses for apple.com, right ? It seems like a lot of overhead (server and client side, new language, etc).

What i am interested in learning is client side programming using industry standards in a non-M$ environment....

MVC would be great especially since im accustomed to desktop stand-alone app development. I was hoping to use sprout-core or cappuccino JS libraries as the class of apps they enable is what i'd like to achieve. But after downloading and installing those libraries i have no idea where to start as im used to XCode and IB.

Cheers
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Mar 15, 2010, 04:32 PM
 
As far as client side technologies go, those are Javascript/AJAX and HTML which are completely platform agnostic. Whatever you learned on the Windows side applies here.

Cappuccino and Sproutcore are not used for building entire websites from the ground up, but for building desktop apps for web browsers such as an iPhone app.

I think you need to better define what it is you want to do. Do you want to build traditional websites? If so, you would be best off learning Prototype or jQuery rather than Cappuccino. If you wish to make the content on this site dynamic you will also have to pick a middleware language such as PHP or RoR.

If you wish to build something akin to an iPhone app for a web browser, that would be where Cappuccino or Sproutcore comes into the picture, although I would first recommend that you learn Javascript a little better so that this part of your app isn't completely obfuscated.

Regardless of which path you go down here, your work environment is going to be a text editor. I personally like TextMate.
     
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 16, 2010, 07:31 PM
 
I want to:
1. have the framework for a test environment to host a website
2. be able to complie and debug the code i do write
3. Be able to host an RIA (probably end up going with sproutcore, maybe) on the website. (it has to be a 'dynamic' type website....for example, a simple calculator app that doesnt refresh the entire page every time a button is clicked)
4. Will stick with a MySQL backend since that's readily available.

I assume that i'll be using Apache(only used IIS thus far), so ill probably have to get acquainted on that as well.

I apologize for not being specific, but this aspect (web programming on the Mac) is completely foreign to me. Thanks for your help...much appreciated.

Cheers
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Mar 16, 2010, 08:02 PM
 
Are there any web programming languages that require compilation on Windows aside from Flash?

What do you mean by "the framework for a test environment"? Do you mean the actual web server, languages, database, or a framework as in a programming toolkit?

For creating an RIA, it looks like you are on the right track with researching tools such as Sproutcore and Cappuccino. For interacting with a database you will need to use a middleware/server side language that will facilitate these queries for you such as PHP or RoR. Apache is indeed your web server of choice in a Unix environment!

Hope this helps... Keep researching, it sounds like you are starting to sort things out!
     
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 16, 2010, 11:45 PM
 
Well.. when i say "compiling", all ASP.Net Apps that i have written with code behind in VB/C# have required to be compiled.

Getting even more basic with my requirements.....

I want....
Back end: Database with SQL support
Server: "Magic layer" (ie i dont care what it does as long as it has similar capabilities as IIS
Client: Present a dynamic interface over the web through a web browser.

On Windows, i manage a "DataAccessLayer" which interfaces with the DB and serves up the data and procedures to my code behind, which has web pages as the front end. An abstraction of the "DataAccessLayer" would be nice to have (not sure what the alternatives are).

Also, when you mention RoR, PHP, etc..please keep in mind that the only web programming i have done is on Windows using ASP.Net, so i do not have any idea how these other technologies compare, or are implemented in a workflow. Thanks for your help....getting there slowly by surely. I'm taking the time to choose the right architecture before i delve into any implementation just cause i don't want to have to switch half way through.

Cheers
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Mar 17, 2010, 12:51 AM
 
I didn't know that ASP.Net apps required compilation, I know nothing about Windows programming languages. Perl, PHP, Python, and RoR apps do not, I think .NET is the odd one here

I think you need to refine your understanding of the server. It is not a magic layer, you need to know what goes on there. You probably mean the web server, and it is true that you don't need to know what goes on there unless you are tasked with setting up the virtualhost declarations to define the path and domain for the site. Assuming this is setup and ready to go for you (as it would be if you used a commercial hosting provider), there is piece to the overall puzzle you seem a little fuzzy on. Here is what an interaction, say a click on a button in your app would entail:

HTML, Javascript display manipulations and other browser based interaction -> server side programming language (e.g. ASP, PHP, Ror, etc.) -> database -> return interpreted by server side programming language and sent to the user's browser by the web server

If you want to generate dynamic content and/or interact with a database you will need one of these middleware/server side languages. This is not a magic layer.

My suggestion as far as PHP or RoR would be if you want the most ubiquitous Unix based language go with PHP and make it better and conform to MVC programming conventions by using a PHP toolkit such as CakePHP or CodeIgniter (there are several others too). If you want the cleanest, most simple, most fulfilling language to work with, choose RoR, but make sure the host you intend to host your app on supports Ruby. If you intend to use a content management system (CMS), use PHP so that you don't have to juggle between multiple languages, there are many more PHP based CMSes out there. If you intend to blog, use WordPress which runs on PHP.

If you really like Sproutcore and want to build your app around this, it looks like Ruby on Rails would be your best bet since I believe more people are using this pairing (including Apple w. MobileMe), and basically it seems like common advice to use RoR if you can, it is really a highly respected language that many rave and gush about. You won't find many people that would criticize RoR, and many that would emphatically say that it is much cooler than ASP.Net. If it were me I'd definitely start there.
     
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 17, 2010, 06:16 AM
 
@besson3c Cheers dude.
What i meant with "Magic Layer" was the web server, not the server side code. (in Microsoft land my 'magic layer' is IIS.... turn it on, host a site, and voila. white-box kinda stuff.

So RoR it is. where do i start ? bear in mind i have a standard SL installation. Would appreciate it, if you cold point me to some basic tutorials, etc.

Also, i thought MobileMe uses SproutCore (i remember hearing something about it from last years WWDC).

Cheers
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Mar 17, 2010, 01:06 PM
 
It uses both RoR and Sproutcore, it's not one or the other, they both do different things and you cannot operate a service like MobileMe without a middleware language such as RoR. In fact, you can't really operate much of anything that tracks and saves data without one.
     
Mac Enthusiast
Join Date: Jan 2007
Status: Offline
Reply With Quote
Mar 17, 2010, 03:57 PM
 
Originally Posted by Hawkeye_a View Post
@besson3c Cheers dude.
What i meant with "Magic Layer" was the web server, not the server side code. (in Microsoft land my 'magic layer' is IIS.... turn it on, host a site, and voila. white-box kinda stuff.

So RoR it is. where do i start ? bear in mind i have a standard SL installation. Would appreciate it, if you cold point me to some basic tutorials, etc.

Also, i thought MobileMe uses SproutCore (i remember hearing something about it from last years WWDC).

Cheers
Sproutcore really only needs a REST-ful server that understands JSON.

SproutCore Documentation / Todos 06-Building with Sinatra and DataMapper

Here is a link to documentation for a sinatra backend (a ruby DSL) I've started playing with it recently and it provides support for the 4 native REST verbs.

Even if you don't know ruby, you can get an idea from scanning the code what the server needs to accomplish. If your backend doesn't have support for the PUT and/or DELETE command, I believe that Sproutcore also will issue a '_method' value with the appropriate verb, which you could check against.

ROR is a little overkill for what you really need, since you can return @data.to_json straight out of the controller (you don't need view templates, js, css) etc...

Sorry rambling post....
     
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 17, 2010, 10:51 PM
 
No problem...rambling is good

Alright so i have a standard install of Snow Leopard(10.6.2) with the latest release build of XCode installed.

I 'think' ive installed RoR....typed the following in terminal...
sudo gem update --system
sudo gem install rails

They seem to have run without any problems. Does that seem right ? Whats next ?

So i guess ive got RubyGems 1.3.6 and apparently RoR 2.3.5 installed.

Jeeze it's been ages since i've gone into terminal to instal stuff.

I'm following the instructions here: http://www.pmamediagroup.com/2009/04...c-osx-leopard/

I know it says it's for leopard, but i guess the same would apply to SL. right ?
     
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 17, 2010, 11:54 PM
 
Alright im trying to follow the last instruction on installing MySQL and mysql gem(not sure what these are yet, but im assuming i need them).

I've downloaded the latest build of MySQL serve for 10.6(intel 64-bit). installation went fine(i think) DMG file name: mysql-5.1.45-osx10.6-x86_64.

[b]Typed in:[b]
sudo gem install mysql -- --with-mysql-dir=/usr/bin --with-mysql-lib=/usr/lib64/mysql

Result:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-dir=/usr/bin --with-mysql-lib=/usr/lib64/mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

Gem_make.out outputfile:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-dir=/usr/bin --with-mysql-lib=/usr/lib64/mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no

--------------------------

What gives ? i've scoured the web, and some others seem to be having similar problems.

What do i do next ?
How do i undo/uninstall what i've done (if i have to) ?

Cheers
     
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 18, 2010, 11:31 PM
 
besson3c, you there dude ?


Well, i dug around, and found that i need to type the following to install the RoR-gem-mysql ... thing.... on my machine (Macbook Core2Duo)...
command:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

The result:
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...

No definition for next_result

No definition for field_name

No definition for field_table

No definition for field_def

No definition for field_type

No definition for field_length

No definition for field_max_length

No definition for field_flags

No definition for field_decimals

No definition for time_inspect

No definition for time_to_s

No definition for time_get_year

No definition for time_get_month

No definition for time_get_day

No definition for time_get_hour

No definition for time_get_minute

No definition for time_get_second

No definition for time_get_neg

No definition for time_get_second_part

No definition for time_set_year

No definition for time_set_month

No definition for time_set_day

No definition for time_set_hour

No definition for time_set_minute

No definition for time_set_second

No definition for time_set_neg

No definition for time_set_second_part

No definition for time_equal

No definition for error_errno

No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1...

No definition for next_result

No definition for field_name

No definition for field_table

No definition for field_def

No definition for field_type

No definition for field_length

No definition for field_max_length

No definition for field_flags

No definition for field_decimals

No definition for time_inspect

No definition for time_to_s

No definition for time_get_year

No definition for time_get_month

No definition for time_get_day

No definition for time_get_hour

No definition for time_get_minute

No definition for time_get_second

No definition for time_get_neg

No definition for time_get_second_part

No definition for time_set_year

No definition for time_set_month

No definition for time_set_day

No definition for time_set_hour

No definition for time_set_minute

No definition for time_set_second

No definition for time_set_neg

No definition for time_set_second_part

No definition for time_equal

No definition for error_errno

No definition for error_sqlstate
-----------------------------------------------------------

What's the deal here ? it says it installed one gem....... but then spewed out this other stuff. Can anyone tell me what's wrong here ?
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Mar 18, 2010, 11:58 PM
 
Have you checked to see if MySQL is in your install path? What happens when you do a "which mysql"?

I would install MySQL via MacPorts rather than using the binaries on the MySQL dev site. Things could have changed, but there was one point where they were pretty out-of-date. If you use MacPorts to install MySQL, the binary will be installed as "mysql5", not "mysql".
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Mar 19, 2010, 12:03 AM
 
Disregard the advice to install MySQL from MacPorts, a lot of guides seem to point people to the MySQL site, so that's fine. Checking that MySQL is in your path doesn't hurt though.

What makes you think that there is actually a problem? Those notifications are not fatal, or else the install would have stopped completely.
     
Addicted to MacNN
Join Date: Apr 2000
Status: Offline
Reply With Quote
Mar 19, 2010, 01:03 AM
 
I assume the process is:

-Install RoR
-Install MySql
-install the MySql 'gem'

the last step is where im having some issues..... in my post from yesterday, there was no confirmation that the gem was installed. in the one today it says ith as been but then spewed out the rest.

How do i check if MySQL is in my install path ?i typed in 'which mysql' but nothing happened. i used the prefpane to start/stop the mysql server, and i tested it using the 'workbench app' thats on the mysql site. Beyond that i dont know what to check if this has been succesful or if paths have been added, etc. (havent used terminal or UNIX in almost 8 years)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:55 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2