I'm starting to build a script for a Penny Auction site like swoopo.com
What framework should I use?
Whats the best way to keep the timers updated without using too much bandwidth?
This all started when I started looking at all the junk thats currently out there.
Most are using PHP and javascript and I feel there is a much better solution.
I have only ever coded in PHP and java and am looking to use this project to learn something new. I have been looking into RoR, would this be suitable for this kind of project?
You must be able to do server pushes.
In ruby you can use orbited (http://github.com/collin/orbited-ruby).
You can do all webapplication you want in all kind of programmation language.
Ruby on Rails is made to do webapplication. You want made a webapplication. So you can do it with this framework. There are nothing better to say.
Made an application with any language can be slowest than an other even if the language is quicker. It's always depends how you code it.
Ruby On Rails help to maintain easily your code and more readable. It's maybe not the better language in each case. But in each case, it's works and do what you want.
Related
this is not a ruby on rails question
I just finished up a ruby basics course on teamtreehouse and I'm sitting
here thinking of what I want to make to demonstrate to myself that I
grasped what I learned.
I have a plan to write a program to automate setting up new hire files
and folders on a network directory at my work at the click of a button.
It might be nice to have a GUI for it instead of running it through the
command line.
First off, is this possible to run ruby with javascript and html without
running it through a server?
I'm trying to think of different ways I would get ruby to speak with
javascript. My first thought was to use a JSON file to produce url links
from in my webpage, but I have no idea how I would run the ruby program
from the web page.
probably a dumb question. Im trying to come up with a good project to
get some confidence in bare bones ruby before I pursue ruby on rails or
sinatra.
One easy way to run Ruby and many other languages in the browser would be to use a Ruby to JS compiler like http://opalrb.org/. Here's a huge list of more languages then you can shake a stick at: https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js#ruby.
The only trick is to make sure that the compiler can also be run in the browser not just the code it produces.
Hopefully that helps.
---- edit ----
I think I perhaps didn't read your question as much as I should have. As for comunication between the server and the client goes, I would say go with sinatra. It's really very simple, and you don't even have to use a database if it's just a project to learn with. Just modify files and save your data that way.
If you want a more dynamic front end making AJAX calls then you can just make a route in sinatra that would return back the information in an easy to parse form for JS such as JSON.
According to this article from AirBnB
it says
A Hybrid Approach
At the end of the day, we really want a hybrid of the new and old
approaches: we want to serve fully-formed HTML from the server for
performance and SEO, but we want the speed and flexibility of
client-side application logic.
To this end, we’ve been experimenting at Airbnb with “Isomorphic
JavaScript” apps, which are JavaScript applications that can run both
on the client-side and the server-side.
So, I am a bit confused as to whether full-stack JavaScript frameworks render HTML files on the server or on the client. My most current educated guess is that some frameworks create HTML files exclusively on the client, some exclusively on the server and some are mixed. But which are which?
To be honest, it can get a little confusing. Especially if you just read about it and don't actually try it out.
I try to clarify it very quickly but if anything is unclear let me know :)
First thing first: What is Isomorphic JavaScript? Simplified it means that you use the very same code on front-end and back-end which is usually possible thanks Node.js (or the new fork iojs).
Now, until recently it was normal to deliver a more or less static html page to the client. Doesn't matter if the html is actually static on the server or the server creates it dynamically - the client just renders the HTML it gets.
With the new frameworks like Angular or React the approach is differently: You basically create the HTML dynamically on the client side and ask the server just for data. This means your server is in general just an (json) API!
However, some of the frameworks have an option to "pre-render" the html serverside which basically just means the initial request returns the proper html as we know it already and from there the clients takes over to manipulate the DOM again.
Usually you do that because you want a "single-page" Application that has more than one page. Single-Page just means you don't need to reload.
And the main reason you want that is because your webapp looks nicer on smartphones/tablets.
The aim is to get a "native" feeling even though it's "just" a website.
It has a few more advantages and obviously also quite a few disadvantages but if you're interested in them try to learn one of those frameworks and take it from there.
Angular.js is currently the "standard" framework that most people use - so can't really go wrong there.
I personally like React.js quite a bit but it's not as popular as Angular (yet?).
Some people even combine the two of them but you really need to know what you do to make that work in a way that makes sense so just go with one ->they both provide everything you need.
You can also have a look at Ember or Backbone but the concept is pretty similar to Angular and probably a little less complex but not as widely used.
Hope it's a little clearer now and I didn't make it even worse :)
I built a quiz taker app with Ruby on Rails, using the MVC framework. I want to do basically the same thing with pure JavaScript, and add more features with jQuery for mobile devices and special effects, since jQuery is just awesome like that.
I have looked around on sites like TodoMVC for comparisons on frameworks, but I'm foreign to how these frameworks function. Why do they use Collection rather than Controller in their MVC definition? It seems to me that these are just client-side frameworks. Would I use something like Backbone.js for client-side work and Node.js for server-side?
I'm just unsure as to how development with pure JavaScript functions. I need to create a database to store quiz and user information and be able to access that database when viewing most pages, so I feel the MVC framework is the best way to go.
Any suggestions as to where to start?
Wow, that's quite a broad post; let's take things one at a time
Why do they use Collection rather than Controller in their MVC definition?
The exact answer varies by library, but a simplistic answer is that the Controllers in most Javascript apps doesn't really need any framework; they can be raw Javascript and work just fine as they're usually not very complex.
Furthermore, parts what you might consider to be "the Controller" are often provided separately. The primary example of this is Backbone's Router object: it is similar to the implied routing (and routes.rb) in Rails, or the urls.py in Django. Just as those frameworks don't consider routing to be part of "the Controller", Backbone (and similar frameworks) provide routing as a separate piece ... even though it could fall under the C in MVC.
Similarly, much of the DOM manipulation functionality that jQuery provides would normally belong in the Controller of an MVC app, so in a sense jQuery helps you build your controllers; it's just not explicit the way Backbone.Model helps you build your models.
Would I use something like Backbone.js for client-side work and Node.js for server-side?
That's really apples and oranges; to put in server-side terms, Backbone is more like Rails, and Node is more like Ruby (or Mongrel or something). So yeah one's client-side and the other's server-side, but the differences are deeper than that.
Any suggestions as to where to start?
Pick a framework and get your hands dirty! Seriously, you can spend hours reading reviews of the different frameworks, and still be no closer to making a decision at the end than when you started (I speak from experience). But if you just pick one and try it, you'll likely find that it either "gels" with you or doesn't pretty fast.
Personally, I'd recommend starting with Backbone just because A) it's very popular these days, and B) I'm biased: I use it on a daily basis and love it. Also, it probably would fit you well because it was created by the CoffeeScript guy (and CoffeeScript was his attempt to make Javascript more Ruby-like). However, Ember.js is also very popular these days, and Hector mentioned ExpressJS, which I know nothing about but could be cool.
But the point is, pick one, do a hello world, or maybe something a little more complex like an introductory tutorial (Backbone has one around a To Do app). A few hours of coding with it will tell you far more than I (or anyone else on Stack Overflow) ever could about whether it's right for you.
If you are looking for a JavaScript MVC-like framework take a look at Express.js http://expressjs.com
Express.js is more like Sinatra than Rails, but it will give you a good foundation on the server side.
I would definitely look at Google Closure. I have started to use it with LimeJs on a personnal pet project and really got caught with it's compiler and it's modular design.
It's not really MVC, but since JavaScript should be thought more in an asynchronous fashion, I tend to think more of it as event driven than simply a request-pipeline-response way.
So, Closure Library and jQuery / jQuery UI (both on Google API) for the client side and ExpressJs for the server side. Also, take a look at this framework comparison chart, you might find it interesting.
I'm trying to decide what's the best framework for my small web project:
PHP, Django (or some more ligthweight Python libraries), Ruby on Rails? Or something else? (Except ASP.NET and JSP, because I don't like those)
I want to use the latest HTML5 features, no Flash, heavy JS and AJAX, and lots of animations. I would also like to write a custom picture slideshow using CSS3 and JS. I wan't to hand code all the client side myself but I don't know what to use on the server side. I won't need databases or much of the webapplication framework features, only something simple for managing templates and urls and serving AJAX requests.
the best language is the one that you can understand
in my case, asp.net is considered more "enterprise" than php, but I will probably write more bugs, errors, in asp.net comparing to the same code written in php.
so if you know a language, keep use it, any server language can do the same things that the other ones do.
in second place, documentation is fundamental. I use for work a lot of languages, and i think the php's documentation is simply the better one. users contributions in php's docs are really useful.
java's doc is more complicated and schematic but there are a lot of tutorials on the net.
microsoft's msdn is a little painful, but it is not so bad if you have learned how to search infos.
hope this helps.
Almost Everything is Possible with :
PHP
+
jQuery
+
HTML5
+
CSS3
If you feel adventurous you could look at http://nodejs.org/ and http://expressjs.com/
or even http://couchdb.apache.org/, with the latter you could run everything off a JSON and Javascript driven non relational database.
PS. I believe at the beginning of your third paragraph you meant "I want".
I always normally use,
PHP - Easy to learn, easy to work with...
JQuery - Awesome library and easy to learn...
Using HTML5 would also let you draw and animate images with canvas which is also awesome and easy to pick up!
PHP is the best choice. easy to learn, open source and etc. More imporantly you can get many online tutorial as well as you will get answer quickly for your queries
[Disclosure: This question is slightly related to my previous question.]
As you can see, a few suggested that I learn JavaScript / jQuery / Node.js. From what I've read, (a) jQuery is a JS library that makes coding in JavaScript (that works across all browsers in one go) easier, (b) Node.js is a basically a server-side JavaScript environment, (c) Javascript is the root programming language of the aforementioned ones, and is client-side.
I have also read many questions regarding the same on SO, but for someone (like me) who has nil knowledge of any kind of programming, somethings aren't clear.
(1) Basically, my goal is to write a (real-time) live blogging/commenting application for my blog. This, I have learnt, requires a client-side scripting language like JavaScript. So, the question is, can I build such an application with (a) jQuery alone (b) Node.js alone?
(2) If the answer to (1) is YES: Do you think going with the server-side option - - Node.js would be better? (as jQuery definitely doesn't work on JS-disabled browsers, I don't know about Node.js.) Please advise.
(3) When I got a book for XHTML, the book got me started with HTML, and gradually took me into XHTML. So, there was no confusion between HTML and XHTML. Would that be the case with (a) jQuery and (b) Node.js too?
EDIT: (4) There's one problem with JS. Some users may have JS disabled in the browser. Is there any other client-side scripting alternative as good as JS? (Just asking)
That is, in order to learn, (a) jQuery or (b) Node.js should I first learn, JS or can I start with a beginner's jQuery or Node.js book right away? Which would be the right way?
I really need your advise here, as I am totally new to programming (and have very little time to study), and I am pretty excited of what's ahead.
(I used (a) jQuery and (b) Node.js whenever possible to denote that you consider them separately, and not think that I will be learning both. I can only choose one, at least for now.) Thanks.
DECISIONS! DECISIONS! For someone who may come here in the future searching for the same... From the answers it's clear that one can start with jQuery, and end up learning pure JS through practice (building applications, solving issues etc). It seems the learning curve, that way, would be longer?! (Because you end up having problems, keep trying to solve them, maybe lose confidence... blah! blah! blah!) Still that's good. What I've chosen is the straight forward way - JS first (until I feel like I've got some hold), and then go go jQuerying! I hope I am not wrong in my conclusion. :) {Thanks #Greg Pettit and #Pete Wilson}
Node.js and jQuery perform two different roles. One facilitates server-side JavaScript, the other provides an abstraction library for client-side JavaScript. It's not one or the other. The question has to be branched into two directions:
What server-side technologies do I want to use? Is PHP+MySQL (a known commodity) going to do what I want on the server side? Should I use something I'm already familiar with (ASP or whatever)? Or do I like the projected performance benefits and scalability of Node.js to jump into that? Does Node.js have mature enough Database classes to actually use it for my purpose?
On the client-side, do I want to write everything with 'pure' JavaScript, or do I want to use a framework? If I use a framework, should I use jQuery because it seems to be the most widely-known, or do I research other frameworks that might do what I want? Furthermore, should I look into web application frameworks like Kendo UI or jQuery UI or piece it together with a JavaScript framework?
At some point, someone is going to tell you if you don't know JavaScript at all that you should start with pure JavaScript so that frameworks don't corrupt you. Me, I say phooey. You want to get stuff done. You don't want to spend your hours jumping through hoops when you could be just getting stuff done.
If you jump right into a framework (say, jQuery) instead of learning JavaScript properly, there are things that you will learn eventually anyhow. Before too long you'll realize that you didn't need to use $(this).attr('id') when you could've just used this.id. But it doesn't matter, because the former worked until you learned the better way.
I'm a former educator and very much in support of seeing results quickly, because it will propel you to learn more. Just because you start with jQuery doesn't mean you'll forever ignore 'pure' JavaScript. If you are an intelligent problem-solving kind of person, eventually 'pure' JavaScript will find you, and you'll begin to identify the right time to use it, and the right time to use a framework.
You should definitely start with learning Javascript first. I would read Eloquent Javascript to learn javascript at first. Then, learn jQuery and then node.js. For jQuery, I would say you should read jQuery in Action to learn jQuery.
For most web-applications, you need a server-side part. For the application you want to do, you need client-side Javascript. You'll have to do both parts.
For the server-side part, you can use whatever you please, whether it's Node.js, or PHP + the myriad PHP web frameworks, or anything else that can respond to HTTP requests.
Node.js and jQuery serve completely different purposes, it's unlikely you'll find a book that deals with both, and if you do, there's no "smooth" progression between the topics I can imagine.
jQuery does make use of certain idiosyncracies of Javascript (rebinding this), some of its nontrivial features (anonymous functions), and introduces several patterns on top (using literal objects for named/optional function arguments), so I'd recommend looking into JS at the moderately advanced level rather than just muddling though.
You should read javascript the good parts by Douglas Crockford, make a hello world with pure node.js then use express.js + socket.io or now.js. and mongodb for data persistence
Well it goes without saying to learn library of any language you need to learn the laguage first. But how you want to learn it is your choice, some people prefer to start with the library first then traverse bottom up to cover the basics of the language, while some other likes to get their hands dirty with basics of language before trying out advanced syntaxes and libraries.
To add to it I should also mention jQuery and Node.js are totally different things and have different learning curve too.
Node.js is more of a concept to enable javascript run at server side with asynchronus programming inbuilt. To learn node you will be learning some server level APIs like file streaming, logging, file system operations, callback etc which are typically server level tasks.
Whereas to learn jQuery you would learn how javascript operate of doms and events, css , ajax etc on a webpage to alter those pages dynamically.
From application/website building point of view I would say to get started you need very little knowledge of nodejs but more knowledge of JQuery.
PS: If you are looking to build an website today in 2017 I would suggest to avoid jQuery altogether and go for client frameworks like angular/react.