Ruby / Rails working with Delphi back end - ruby

Can anyone point me to some sources or tutorials that would help me wrap my head around using Rails to connect/inquire with a Delphi backend (using a Firebird database).
Also, a few questions regarding this setup.
Is a Delphi back-end faster than a rails back end? Delphi seems to have far better support for connecting to firebird than the ruby drivers would.
What is the current best choice method for making requests? The REST stuff, or some kind of RPC? or something else?
Since we are currently a Delphi shop, i assumed the back end being in delphi would help us leverage current skills better.
Any help is appreciated.
EDIT: Little bit about the set up.
So to make this easier to explain lets just say its essentially a todo organizer. So the frontend would be a calendar showing what is due on each day. Or perhaps list views of that information, etc. The "back-end" as I had called it would be something that is storing to a Firebird database. the RoR calendar site would then request information about Todos, or todos on a given day or date range, perhaps information about certain contacts. All of which is stored in Firebird.
I do realize you can do the front-end part in delphi as well but I'm trying to phase out Delphi in favor of newer languages.

AFAIK you need much more than a RESTful API to run a RoR application.
Most of the work is done on the server side: MVC model, data persistence, routing, etc...
Using Delphi as back end will need a huge amount of work.
Take a look at some projects, if you need a RESTful server built in Delphi:
Delphi on rails https://code.google.com/p/delphionrails
Delphi Web Script https://code.google.com/p/dwscript
Delphi Relax http://code.marcocantu.com/p/delphirelax
DataSnap (directly in Delphi)
our mORMot framework http://mormot.net
All implement direct connection to Firebird, and DoR + mORMot + DWS sounds to have better performance.
A Delphi based server will in all cases be more responsive.
DoR is more close to RoR - as the name states! Delphi Relax seems also close to it (even if I wonder if Marco will still maintain it - 5 months without commit).
DataSnap is more RAD, and integrated within the IDE.
DWS has a new DB backend, and the same high performance HTTP server than mORMot.
mORMot has a full client-server ORM, but web clients are to be build in AJAX - SmartMobileStudio is preferred.

Related

Phalcon php vs node.js

We are going to develop rest server for our application (and all logic is on client javascript).
So we thought to use Phalcon php, but we also need to create realtime chat system, which is much more easy to do using node.js. This made us think about using node.js instead of phalcon
Unfortunatly, we are not good expirienced in node.js, we love phalcon for its performance and internal beauty.
The quiestion is, did anybody compare phalcon and node.js performance? May be it's better to use node.js only for long polling chat requests, but i dont like when project is connected with so different tools.
You are trying to compare two different things IMO.
node.js has a lot of power and flexibility but so does Phalcon. If you want to create a chat application with Phalcon, then you will need to implement some sort of polling mechanism in your browser that would refresh the chat window every X seconds. Getting/Inserting the data from the database will be Phalcon's job. Javascript will be used to do the polling i.e. refresh the chat page every X seconds.
The problem with this approach is that you might be hitting your web server every X seconds from every client that has the chat application open - and thus refreshing the chat contents, even when there are no messages. This can become very intensive very quickly.
node.js has the ability to send messages to the subscribed clients instantly. Web sockets can do the same thing I believe.
Check this video out, which will give you an idea of how this can be achieved easily:
https://www.youtube.com/watch?v=lW1vsKMUaKg
The idea is to use technologies that will not burden your hardware, rather collaborate with it. Having a "subscription" notification system (such as sockets or node.js) reduces the load on your application since only the subscribed clients receive the new messages and no full refresh is needed from the chat clients.
Phalcon is great for the back end with its speed and it can be used to construct the message which in turn will be passed to the transport layer and sent to the client. Depending on how you want to implement this, there are plenty of options around and you can easily mix and match technologies :)
as #Nikolaos Dimopoulos said, you're trying to compare two different things.
But here is my advice, while you're experienced with PhalconPHP framework, and you want to benefit from Phalcon speed and performance, you can implement the web app in Phalcon FW, and the chatting system in Node.JS as a service.
If your web application "The Phalcon app" needs to push messages from the backend, you can use http://elephant.io/ library for that, I have done this before with Yii framework and Node, and it's working perfectly.
My advice is to use what you already know, experimenting with nodejs just for the chat application.
Mainly because you said you do not have experience with it, so, because the chat app is something a lot of people made you'll find plenty of examples.
By doing so you will learn a lot from node and might even think about migrating from Phalcon if it suits your needs, using the features offered by expressjs for example.
I would not choose one over the other based on performance.

Making a chat app using AJAX, Servlet and JSP on GAE

I'm a CS student trying to do some side projects during this summer. One of my aims to is create a chat app which will be ultimately hosted on GAE. I am new to web development so I'm trying to shoot around in the dark hoping to hit the target but I guess it will be a major waste of my time. The rationale for using servlets and JSP is that GAE requires Java for the backend. I hope to use AJAX to do the front-end.
However it is hard for me to put all the technologies together to make it work. I am having trouble with the design. I don't need any codes, but rather help with the design patterns.
I am confused with how GAE works. Since GAE requires Java/PHP/Python etc, is it possible to deploy the client coded in AJAX using GAE? Do I require two GAEs, one for the client and one for the server which is coded in Java?
I am also quite lost with how to connect the AJAX technologies with the Servlet & JSP technologies. I'd appreciate it very much if you guys can provide a step by step instruction on the design pattern. Links to online tutorials will be very much appreciated. My style is to learn as I go.
Ultimately, my aim is to get an chat app (very simple one where all users can see each other messages) up and running on GAE to get a feel of the whole web development process (code, run, deploy).
Just a side note, I don't know any PHP/MySQL (but will learn later if I get the whole web dev thingy down to include database features).
Thank you all.
There's a LOT of stuff available out there to read if you just search for Google App Engine. Start with the documentation and work through the tutorials. It's not a waste of your time to learn, since you don't already understand it.
Google App Engine is essentially a distributed web server + database. AJAX on App Engine is no different from AJAX anywhere else - the server serves HTML+Javascript which runs on a web browser, and communicates back to the server.

DataBase for Metro style apps in windows 8 Development?

Hi i am developing a metro style application where i will be connecting to web services and get the data from the web service and i will be binding it to the UI.
But my requirement is in my application i need to create tables and also provide relation between the tables and dump the data in to that local database and use that data in calling the other methods present in my service application (calling one more method in services by passing something as an input to that).
Can you please explain me the following :-
What is Database which is supported for metro style apps?
How can i create a database and create tables and dump the the data which i got as the response from my service application?
I am new to Metro style application development please help me out .
Thanks in Advance.
First of all WinRT has very poor db support. Most of this kind of things are done by web services, OData etc
BUT I`m almost 100% sure that you can use SQLite. On codeplex there are connectors from Win8 Metro app to SQLite DB so check this topic. I also saw somewhere on MS page that SQLite is support in some way. Check it
What Fixus said is correct. Personally , since my app doesnt have a large amount of data to store locally (it goes against the Metro guidelines to store large amounts of data) I serialize the objects instead to local storage. When needed, and if internet is available, the services will be called and the local data updated.
If you choose to use SQLlite make sure you use the real deal and not a third party db, as the DB library must be approved by Microsoft if you want to get the app accepted to the windows store. I'm not even sure that SQLite is yet approved, but by the looks of it they will be.
Tim Heuer always writes great articles on the subject, this one might help you
Let me know if you need help with serializing in WinRT, if you need it.
Best of luck!
We recommend using SQLite database with LinqConnect - Devart's LINQ to SQL compatible solution which supports SQLite engine (provided by http://code.google.com/p/csharp-sqlite/). You can employ LINQ and ADO.NET interfaces with our product. Starting from the 4.0 version, LinqConnect supports Windows Metro applications: http://blogs.devart.com/dotconnect/linqconnect-for-metro-quick-start-guide.html.
If you're building some application that has to keep working without any network connection, and needs to synchronize at some point in time, it is necessary to keep a local database.
You can read the following article, which has some basic guidelines and samples.
http://blogs.msdn.com/b/win8devsupport/archive/2013/01/10/using-database-in-windows-store-apps-i.aspx

Any way to use MvcMiniProfiler on windows application? Or is there a sister application?

So I've started using MvcMiniProfiler on our websites and quite like it. We have a Windows Application component/framework that is leveraged by the website and I was wondering if it was possible to use the profiler on that. I'm assuming not, but maybe there is a subcomponent of the code that could be used? I see that there is a way to configure where the results are stored (i.e. Sql Server) so maybe it is close to possible?
We have the following flow:
Website submits job to 'broker' then returns a 'come back later' page.
Broker runs and eventually data in the websites database gets updated by the broker.
Website displays the results.
I'd be great if there was a way I could get the entire workflow profiled. If there is no way/no intentions from the developers to make MvcMiniProfiler available to Windows applications, any recommendations for similar styled profilers?
You could get this working by using SqlServerStorage, there is very little in the code base that heavily depends on ASP.NET, in fact the SQL interceptor is generalized and so it the stack used to capture the traces.
I imagine that a few changes internally need to be made, eg: use Thread.SetData as opposed to HttpContext but they are pretty superficial.
The way you would get this going is by passing the "profiling identity" into the App and then continuing tracking there. Eventually when the user hits the site after it happens, it would show up as little "chiclets" on the left side.
A patch is totally welcome here but it is not something it does in its current version.
(note to future readers, this is probably going to be out of date at some point, if it is please suggest an edit)
Yes, there's a Windows porting of MiniProfiler: http://nootn.github.io/MiniProfiler.Windows/

How do I move from C#/ASP to Ruby?

I have recently designed a web application that I would like to write in Ruby. Coming from a ASP background I designed it with method and fields and linked them together (in my diagram and UML) like I would do it in C#.
However, now that I've moved from a single app to MVC I have no idea where my code goes or how the pieces are linked.
For example, my application basically collects information from various sources for users, and when they log in the information is presented to them with "new" information (information collected since last login) is tagged specially in the interface.
In C# I would have a main loop that waits let's say 5 minutes and does the collection, then when a client tries to connect it would spawn a new thread that generates the page with the new information. Now that I'm moving to Ruby I'm not sure how to achieve the same result.
I understand that the controller connects the model to the view and I thus assume this is where my code goes yet I've haven't seen a tutorial that talks about doing what I've mentioned. If someone could point me to one or tell me precisely what I need to do to turn my pseudocode into production code I'd be extremely grateful and probably will still have hair: D
EDIT: Somehow I forgot to mention that I'll be using the Rails framework. I don't really like Ruby but RoR is so nice together that I think I can put up with it.
The part of your application that is retrieving the data at certain interval shouldn't be, strictly speaking, part of the web application. In Unix world (including Rails), it would be implemented either as a daemon process, or a cron job. On Windows, I presume that Windows service is the right tool.
Regarding C# -> Ruby transition, if that's purely for Rails, I'd listen to the George's advice and give ASP.NET MVC a shot, as it resembles Rails logic pretty closely (some would call it a ripoff, I guess ;)). However, learning a new language, especially so different than C# as Ruby is, is always a good idea and a way to improve yourself as a developer.
I realize you want to move to Ruby; but you may want to give ASP.NET MVC a shot. It's the MVC framework on the ASP.NET platform.
Coming from ASP, you're going to have to do a lot of conversion to change your code to become more modular. Much more than any one post on Stack Overflow will do justice.
MVC is made up into 'tiers':
Model - Your Data
View - What the user Sees
Controller - Handles requests and communicates with the View and Model.
Pick up a book on ASP.NET MVC 1.0, and do some research on the MVC pattern. It's worth it.
Whatever Ruby web framework you plan to use (Rails, merb, Sinatra), it sounds like the portion that collects this data would typically be handled by a background task. Your models would be representations of this data, and the rest of your web app would be pretty standard.
There are some good Railscast episodes on performing tasks in the background:
Rake in Background
Starling and Workling
Custom Daemon
Delayed Job
There are other options for performing tasks in the background (such as using a message queue and the ActiveMessaging plugin) but these screen casts will at least give you a feel for how background jobs are generally approached in Rails.
If you perform these tasks on a regular schedule, there are tools for that as well.
I hope this is of some help.
Check out Rails for .NET Developers. I've heard good things about this book and it sounds like it's just what you're looking for.

Resources