As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm trying to learn ruby for web from scratch. I know PHP and I'm new in ruby. I don't want to use any framework at beginning. Trying to create simple 2 - 3 pages for practice. I search a lot but not got any example to create webpage from ruby and racks and to run it in any browser.
Guys please share if you do have any URL or online material to get start.
Writing a simple CGI in Ruby is easy, however, explaining how is beyond the scope of Stack Overflow.
To start, read Wikipedia's Common Gateway Interface article so you have a basic idea of what a CGI has to return. Pick apart the Perl example; You should be able to figure out what's going on easily enough. Read through the article and compare what it says to what the code example is doing.
Next, look at Ruby's CGI module, because it will help you parse incoming form information, and encode/decode URLs and HTML. Look at the table of environment variables, and you'll see the same things passed in that are mentioned in the Wikipedia article. Next, notice the params() method, which is how you access form variables. Follow that by reading the "Writing output" and "Generating HTML" sections, and nose about in the examples. You should be on your way then.
Once you've done that, you should take a look at the Sinatra gem. It's a very nice, easy to use, framework that is well suited for general web use, and, after getting an understanding of how a CGI works, you'll be in a good place to appreciate what Sinatra does for you. Additionally, I highly recommend using HAML with Sinatra. It's a short-cut language for generating web pages, similar to ERB, but less verbose.
You'll find that PHP has shielded you from a lot of the knowledge needed to write a "normal" web application using a CGI. That's OK if you already know that stuff, but it's bad if you have never done lower-level code, or are trying to use different languages, because knowing the CGI layer provides a lot of knowledge that is needed to understand the whole HTTPD stack. Once you know the CGI layer, things like Sinatra, Rails, Django, Mojolicious and all the other frameworks out there suddenly make more sense, and you'll know when to take advantage of them or roll your own. And, PHP's place in the HTTP server will be clearer too, allowing you to pick and choose your tools better for the job at hand.
Something like this should do it:
http://www.editrocket.com/articles/ruby_apache_windows.html
Check out Ben Scofield's talk from RubyConf 2008 - Building my own Web Framework Should give you some idea about what is involved in building a web app with ruby from scratch without using any frameworks.
The answers to this previous question should be helpful as well: Complete web apps in Ruby without using any frameworks - how difficult? Pitfalls?
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Alright masterminds. Should I consider joomla or just stick with hardcore coded webdevelopment?
Explanation:
I am basically a programmer with a pretty good command of HTML, Flash, Dreamweaver, Javascript ( though not an expert...yet).
I do not intend to design websites for customers, I do regularly design sites for my own projects.
I have seen some really cool web layouts done with joomla, and wordpress and the like. Now I know that these are content management systems and my projects are ( generally, though not always) not content management systems.
FOR EXAMPLE:
Say I had to design the website for t-mobile, or verizon, or vodafone with their phones and offers and what not, now should I be considering a complete design from scratch or should i pick up a nice looking joomla template and MODIFY it so users can browse for phones, order them , buy on contract ( i actually am working on a smaller version of such a site)
The point being , is it worth spending time modifying a joomla template to your needs or should you just build the whole site from scratch, because after all, "real coders are hard coders??" :)
Any of you out there shedding some light on it would be great help!
Thx
Out of all honesty, I would be more concerned about the functionality rather than design. If you are looking for something along the lines of a e-commerce site then definitely go for Joomla and use a shop extension such as VirtueMart of JoomShopping. With something like this you would need extreme PHP knowledge, therefore can make life very simple by using Joomla and extensions to go with it. Then you can choose a template of your choice of revamp a basic one.
Word of advice though, please oh please don't use flash ;)
Hope this helps.
IT depends on what you need really.
I've been building joomla powered websites for years and I have never modified nor used a ready-made template, but always built them according to the PSD (custom design), and for joomla (unlike wordpress for example) all you need to build custom looking joomla website is HTML / CSS knowledge and hopefully a good framework.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am making a very specific "control panel" sort of thing to organize information, record statistics, deliver alerts, and things like that.
My initial plan was to make it using CakePHP. I tried Cake, and although I thought it was really awesome, I really hated it due to the fact that it's "automagic." I didn't like how it did all this stuff without me knowing. Yesterday I switched to CodeIgniter, because a friend told me to try it. I like CI much better, however using a PHP framework just doesn't feel right. To me, it doesn't feel nearly free or flexible enough.
My question to you:
Should I continue trying to use a framework, or should I construct a 'semi-framework' that makes certain things easier (layouts, form validation, localization)?
Might I add that I already have a secure authentication system created (well, I THINK it's secure, but that's for a different discussion :P) that would be fairly simple to implement on this site.
Should I continue trying to use a framework, or should I construct a
'semi-framework' that makes certain things easier (layouts, form
validation, localization)?
I think the big issue here is whether using a framework is making your life easier or not. Frameworks are designed to simplify coding by giving you a powerful base to work off of in your own code. If that base is helping you by reducing the amount of code you need to write and the amount of maintenance that goes into it, then yes, I would strongly recommend you use a framework. If the framework is making your job more difficult because it is not well suited to your needs and is not reducing the amount of work you need to do overall, then I would strongly recommend not wasting your time with one.
Just like you'd stop using a dishwasher that isn't helping you wash the dishes faster or better, go ahead and stop using a framework that isn't helping you code faster or better.
It depends on your site. If you have large site with dozens of pages, better use a framework. But if your site is tiny, there is no need in using it.
Try combining Zend with NuSphere PHPEd IDE. Zend is a generic all-purpose framework which allows you to go as hardcore as you desire and it has tons of examples and documentation. PHPEd will enable you to do really nice debugging, even inside the framework code, so that you will feel in absolute control.
On the other hand, reinventing the wheel is never a good idea. You will never be able to get all the form validations right all by yourself and the amount of testing for all this code will make you stay in the office, on Tuesdays, during the graveyard shift :)
It might be a great idea to spend some time reading about some open-source projects, like Magento, so that you can observe the true power of generic frameworks, before trying to write your own.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm looking for a base project which I could extensible and quickly deploy for small project such as company website, small shop, blog.... I've used Orchards http://orchardproject.net, but it's too sophiscated to understand internal process and customize.
Could you please review pros and cons of Orchard, or recommend me others that simplier.
Thanks
Orchard CMS is like a small laboratory for future ideas but it's quite hard to work with for real projects despite having some very good core ideas.
Pro:
ASP MVC with Razor view engine
Modules
Good documentation for a open-source project
Con:
Lack of automated generated admin UI (you write the back and front-end UI)
Lack or improper hierarchical data structures and 1:N/N:N relations
Too big and complex for small projects it trying to address
You may try Umbraco or just write a new ASP MVC application with a library of custom controls.
I have looked at both Orchard and N2 CMS and I would say that if you're developer and want a CMS that provides simplicity whilst allowing you to create quite complex sites then N2 is the CMS for you.
I'm using Orchard for developing some sites.
I love it.
It is not so easy to understand at first because there are so many little pieces to understand.
But after some time when the big (and the small) picture is more clear, you will appreciate the fact that you have to code (or just get from gallery and install) the little functionality you need.
If you need send an email, you use the corresponding module, and you never need to code yours or you can replace sending feature with a new one and it is available to all other modules.
Base framework includes some useful functions like db-layer, authentication e, indeeded, every other module you may install...
Have fun!
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Have you used Sinatra successfully? What kind of a project was it? In what situations would you recommend using Sinatra instead of Rails or Merb?
I've dabbled with Sinatra, but haven't really written anything serious with it.
As you said above, there's a list at http://www.sinatrarb.com/wild.html, although a lot of the applications listed there seem to link to GitHub pages, which I assume are often people experimenting with Sinatra and publishing their results online. Then, there's also the Sinatra mailing list, where you might find links to some interesting projects.[*]
As for your question on when to use Sinatra, I personally would answer "for smaller projects." When you want something up and running very quickly, it seems like Sinatra is an excellent choice. It's also great for people who like Ruby. With that I mean, when you're doing something in Rails, you have to do it "The Rails Way". Rails is the framework upon which you're building your application, and you have to adhere to its customs and conventions. Sinatra, on the other hand, feels like a library. You feel like you're writing Ruby, if you want to connect to a database, you use the library you like/think is appropriate for the job, if you want to output HTML you choose the templating library you like, and if you want a simple web framework, you choose Sinatra. Sinatra is not something upon which you build your whole application, it's something you use beside the rest of your application.
So, as you may have gathered, I'm quite fond of Sinatra, and I would use it for personal (or small-scale) projects. It's easy to set up and easy to use, as long as you know what you're doing. Looking through http://www.sinatrarb.com/wild.html, it seems like that's what most people are using it for, see for example Is Lost on yet? and Calendar About Nothing.
[*] Edit: I found a thread here, with people linking to their projects. There seem both larger and smaller projects. Very interesting stuff.
There is a list at http://www.sinatrarb.com/wild.html.
Still, I'd like to hear a bit more about them. I also suspect that there are lots of successful Sinatra projects outside that list.
I just released TweepDiff (http://tweepdiff.com) written in Sinatra. Anything else would have been overkill but I would use Sinatra for bigger projects too.
I think sinatra is best suited for micro-applications development (no big surprise, it's a micro-framework)
Sinatra provides you with a sufficient level of abstraction to build almost everything you want quickly. And what I like about sinatra is that the framework gives you tight control over what your app is actually doing, you can really "feel" what you are writing. So, I would say Sinatra is a subtly balanced framework.
I also think Sinatra is attractive for "people who likes writing Ruby" as said before. You start writing ruby class before implementing a sinatra interface. (good exemple of this kind of workflow here : http://dev-logger.blogspot.com/2009/01/ric-rac-roe-in-soup-of-technologies.html)
I wanted to be able to run succinct self-contained Ruby scripts from my web server. As far as functionality goes, it would be similar to a CGI library. Sinatra was perfect. One sinatra app later and I have a collection of scripts accessed through simple sinatra style routes.
Whenever I need to write a web application that doesn't depend on a database, I suspect sinatra will be my first port of call.
I'd have to echo most of the above comments. We're in the process of implementing a Sinatra/HAML stack for browsing and basic reporting on data.
I really like the combination of simplicity and direct connection to Ruby. If something isn't working in the browser, it's pretty easy to port it out to a straight Ruby program for debugging.
There's definitely a feeling of building a dog house with Sinatra versus the Taj Mahal with Rails. It's easy to comprehend (it's also helping me understand the need for MVC and Rails).
Altogether very cool stuff and very fast. I haven't stressed it yet, so I can't say how well it'll behave in the real world.
I made http://istay.com using sinatra, all I can say is that it is a fantastic little framework for any site that doesn't directly use or doesn't have a database.
Though I do feel sinatra has reach it's limit with the current site, and any extensions will be written using Rails or other framework.
I use Sinatra for small 'one function' kinds of apps (My current blogging engine might be a good example). I think the simplicity of Sinatra works best for little utilities and basic API front-ends (Twitter apps, etc).
For larger scale apps there is even the Sinatra-based Padrino Framework with some of the niceties that you would usually reach for Rails to provide.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I want to start learning HTML and AJAX using a Linux distribution.
Can anyone recommend a distribution that has these requirements:
Local Host Admin interface (like PHPmyAdmin)
IDE for Javascript... etc
There is no real best distro for web development.
All tools you need will run on any linux distro.
Pick something you have experience with.
If you don't have any experience I'd recommend one of the 'user friendly' distros like Ubuntu or SuSe.
First question - Why do you want to do this on Linux? You can do basic AJAX requests from any platform, simply drop in your JavaScript framework of choice (JQuery, Prototype, or even MooTools and you can be up and running on your existing development platform.
Get familiar with a decent editor, one that will provide basic syntax coloring for you. One tool you may want to look at is the Aptana web development IDE that is based on Eclipse. This will give you the capability to write and debug any AJAX work you do as well as provide you some documentation and access to other dynamic languages like PHP, Rails, Python as well as a basic HTML editor.
That should square you away more than enough for what you're looking to do.
I just setup my first linux hosting to do the same thing. I did a lot of looking around and was recommended by articles and friends to use Ubuntu. So I did and everything has been working just great.
I'm using slicehost They have lots of tutorials to get you going.
http://articles.slicehost.com/ubuntu-gutsy
I can't think of many distributions that won't do what you need. I'd suggest something that has a good package manager, and, works well on your hardware. There will be plenty of choice for your requirements with all the major distributions.
What are you currently using ?
Andrew
Ubuntu should get the job done but you might consider a slightly more server oriented distro. In my shop, we use CentOS 5 which is more of an enterprise-oriented distro.
It exists specialized distributions:
The best one for me: Noys
http://www.noysweb.net/
Other one is Excelixis:
http://excelixis.wordpress.com/excelixis/
Cheers
HTML and AJAx don't need to be on any particular distribution, Ubuntu makes it pretty easy to install all the required features. I like fedora personally.
Try http://www.eclipse.org/webtools and http://www.zend.com/phpide although screem http://www.screem.org/ may well do what you need if it is purely html, javascript and css