Is there a way to implement CRUD actions using phonegap? - sqlite

If have a web app and built in nodejs (sails) and I want to create the same app for mobile using phonegap and local storage (sqlite), is there a way to implement the CRUD actions in the mobile app without programming the DB creation, queries, etc?

If I understood you correctly, you are looking for abstraction layer so that you wouldn't need to handle the database connection by yourself? If so, I haven't actually came across with any such framework, nor was I able to find one with quite extensive googling. It may be because it is still quite rare to use the SQLite, especially on normal web browsers. Also, it is quite trivial to write those operation by yourself and thus you should be able to do it quite easily.

Related

WCF necessary for web app?

I'm working on a web app that will connect to a database to store and retrieve and manipulate data, and I was wondeiring if WCF is necessary. I've already deseigned and setup the database and i'm getting ready to start coding the app.
I read up about WCF but what i'm confused about is why i would need to use this layer when i can do the database coding inside the app itself by passing variable values directly into the database with stored procedures.. What am I missing?
BTW, I did research here and didn't see a question similar to this. I went to down two pages and typed "WCF necessary web app". No relevant hits...
WCF in this context is necessary if, for some reason, you need to have an abstraction layer between the database and the web app and you need to have this on another machine (or out-of-process). If that is not the case (likely) there is no need.
You might have noticed guidance to have an abstraction between the database and the web app. There are many pros and cons. Biggest con is effort. If you are not able to articulate clear benefits then you do not need to do this.
You do not "need" to do anything. Do what's right under your specific circumstances and requirements.

Getting started with databases

I am currently a front end developer. I know HTML and CSS pretty well, I'm OK with jQuery and know some Vanilla JS. I have an idea for a website I want to create where I will be storing data for products (data that I will be grabbing from various websites around the web). It's basically a help me choose application where the user will go through some steps and be given some choices based on their selections. This site is nothing new, but it's more for learning purposes/portfolio work.
Most of my co-workers use ASP.NET and I've seen that you can setup a website like this using ASP.NET and the provided server controls along with C#, however, I want to take another route that allows me to do the same thing NOT using ASP.NET (C# is OK and preferred if that is possible) in that I can grab data, store data, and bind data to my page.
In addition to this, I would like to do this on the Mac.
Here's a list of things I have looked at:
MongoDB (I was really confused by the setup and didn't read anywhere that this would definitely be the solution).
AngularJS
EmberJS
BackboneJS
Several other JS frameworks
Ruby on Rails
Note about the above: Some of the above might be the solution, but I don't want to start spending time learning them only to realize a week in that this is not going to help me get to my goal.
If this post would be better suited for another stack site please let me know. Thank you.
To create a basic website with a persistence you'll need to deal with three parts the front-end (client), back-end (server) and the persistence (database). Of the things that you've listed Angular, Ember and Backbone are all front-end frameworks. They each have their own way of approaching the issue but they all work in the client facing part of the project so views, interaction and dispatching data to the backend. Rails is the only thing that you've listed that's a back-end framework, another option for the back-end if you're more familiar with JS might be Node and Express. Node allows you to build a server in JS and Express is one of the more popular Node frameworks. That section will be responsible for getting the calls for data and calls with data from the front-end and dispatching the appropriate response. Rails typically works with with a SQL database like MySQL or PostGres out of the box because Rails' active record is meant to work with SQL. Mongo is a NoSQL database and I think people are getting it working with Rails but I don't know that it's highly common. Mongo's shell is pretty much javascript and it stores data as JSON (not technically but close enough) so it's been a comfortable choice for JS developers learning back-end. Either Rails or Node can get a server up and running locally on your machine so you can work with the full architecture. So what it comes down to really is picking one of each from those sections and making them play nicely together. For your purposes I would think that the way to go would be either a basic Rails app (probably with MySQL) and using jQuery ajax calls to manage some calls from the front-end or building something with the so-called MEAN stack (Mongo, Express, Angular, Node) which is all JS and using Angulars built in http functionality to handle those calls. Hope this at least narrowed the field of research a bit. Really thats a pretty open question and there are a lot of options.
What is your webhosting site? I suggestPhpmyadmin Or Mysqldatabase You can create tables and strings where you can put the websites you wanna "grab" data from and put a little javascript in there to tell your website if blahblahnlah =blahblahblah then get id="website1"
Some clarifications:
At first, you need to distinguish between a server side language (used to program the functionality) and a database (used to store data).
C# is a language of the .net framework. Regarding websites, there's no C# without ASP.net.
There are two major groups for realizing back end solutions: PHP (market share ~ 40%) and ASP (~ 25%). PHP is a programming language, ASP.net incorporates several programming languages (mainly C# and VB.net).
Both worlds are able to connect to databases: For PHP, this is mainly MySQL, for ASP.net it is mostly Microsoft SQL server.

Does Sails.js or Meteor.js work with ArangoDB or OrientDB?

I'm planning to work on a social site and I would like to leverage both a document and graph database for all of the desired features. Is there a way to get Meteor.js or Sail.js (or any better) to work with ArangoDB or OrientDB? Or should I just stick with the bundled MongoDB and integrate something like allegrograph DB?
Sails.js has support for both of the databases you mention:
https://www.npmjs.com/package/sails-orientdb
https://github.com/rosmo/sails-arangodb
In addition to MongoDB, Postgres, and dozens of others.
Sails.js is a classic mvc client-server web application framwork, basically its ruby on rails implemented for node.js + webscockets, so mostly all you need to make it work with any backend database is make changes to the orm.
Meteor is a very different beast, it is a very opinionated realtime end to end web framework including client server and database, by behing very very opinionated it solves many of the common issues in realtime application, where you need to implement a mechanisms for very quickly updating all your clients of each others actions and take care of things like latency compensation, data collision resolution, and real time client version managment, This is implemented by using web sockets and the mongoDB's write ahead logging for triggres of data updates, making meteor somewhat coupled with mongo.
But you can make orientdb work pretty well with meteor using the new orientDB live query api. It is a pubsub implementation for query results, and can be used for efficent updates pushed from the db through the server directly to the client with very little overhead on the server. This is far from production ready and only currently works on the orient db 2.1 rc5 version.
I have implemented a small meteor demo application as an example https://github.com/imdark/meteor-orientdb-demo
Please check on Meteorpedia the Alternative Database Post, they mention neo4j-livedata and minineo4j.
Here is the Atmosphere package: ostrio:neo4jdriver
Is there a specific economic or technological reason why you consider not to use the very well integrated mongoDB as the database of choice?
In addition to Travis answer I also recommend waterline-orientdb for Sails.js.

MeteorJS Alternatives: Latency Compensation Frameworks and Libraries?

Effort:
I am building a word game based on a chat web-client where I need to make a server call on input chat text to validate it before broadcasting on the chat.
I am aware of Meteor providing latency compensation out of the box. But given its still in "early preview" makes me seek other alternatives.
What I tried:
Unfortunately my web search for "latency compensation framework library" doesn't yield anything other than Meteor (including non-personalized results).
Question: Are there any other alternatives that provide latency compensation -or- can make the job easier? I am hoping other developers might have encountered something useful/relevant.
Although Meteor is in 'early preview', its code is very close production ready and a lot of startups and other early adopters are using it for production-level code. You aren't going to find anything that gives you wings like Meteor because no such alternative exists.
As a hardcore Meteor convert and someone who's used many other frameworks, I recommend you to just try Meteor out. As they say, it only takes a weekend for you to build an app in Meteor and decide whether it's right for you.
Having said that, I will attempt to answer the question and list the distant-second alternatives to Meteor that you probably won't want to use:
Derby
Sails
What you're seeing right now in the various real-time full-stack Javascript web frameworks is the future of Web development, cutting down dozens of people and thousands of man-hours of work needed to develop a software project. There are some fast boats sailing that are leaving server-side rendering behind, and you should probably just get in one of them and get going.
RethinkDB uses term 'latency compensation'.
I've also tried to gather per-feature alternatives to Meteor
Meteor is a really cool framework. you can build the complex data driven application very easily using meteor.
But, this framework currently supports only the MongoDB as back-end database.
I have recently created full stack framework called Nooljs which is similar to the Meteor. Now I have open sourced it. It support all the database connections including MySql, ms-sql, and MongoDB. The complex data driven application can be created easily using this framework.
This has been developed using well known existing framework such as Angularjs, Node, express-js, and socket-io.
Easy to build complex data driven JavaScript applications with minimum coding.
Support multiple data connections suck as Ms-sql, MySQL, PostgreSQL, and Mondodb.
Real time framework build top of Express-js and Socket-io
The client side is powered by the Angularjs.
The layout can be build using the Angularjs tags and elements.
Modularized layout to simplify the complex web pages.
Can be mixed both Express-js and Socket-io

Putting a new web interface on an old fat-client database

My company has a fairly old fat client application written in Delphi. We are very interested in replacing it with a shiny new web application. This will make maintenance a breeze and many clients want a web application.
The application is extremely rich in domain knowledge, some of which is out of our control. Our clients use the program to manage their own clients and report them to the government. So an inaccurate program is a pretty big thing. The old program has no tests. We are not sure yet if we will implement automated testing with the new one.
We first planned to basically start from scratch. But we are short handed and wanting to basically get everyone on the web as soon as possible. So instead of starting from scratch we've decided to try to make use of the legacy fat-client database.
The database is SQL Server and can be used in SQL Server 2008 easily. It is very rich in stored procedures, functions, a few triggers, and lots of tables with over 80 columns... But it is decently normalized. We want for both the web application and fat client to be capable of using the same database. This is so that if something breaks badly in the web application, our clients can still use the fat client and connect to our servers. After the web application is considered "stable", we'd deprecate the fat client.
Has anyone else done this? What tips can you give? We want to, after getting everyone on the website, to slowly change the database structure to take care of some design deficiencies. What is the best way to keep this in a data access layer so that later changes are easy?
And what about actually making the screens? Is there any way easier than just rewriting an 80 field form in ASP.Net? Are there any tools that can make this easier?
The current plan is to use ASP.Net WebForms (.Net 3.5). I'd really like to use MVC, but no one on the team knows it including me.
We are not sure yet if we will implement automated testing with the
new one.
Implement automated testing. What's the point in replacing one buggy program with another?
Good question, but "Slowly change" the db structure after getting everyone on the website, sounds like a joke...
I would rather take the opportunity to create a fresh db structure, write a bulletproof migration script for you db, that you can try out and rewrite a zillion times without any side effect fro your clients, and then write whaterver you want (fat/web) on the new db, have it tested and migrate everyone when it's ready.
I have a couple suggestions:
1) create a service layer to abstract away the dependance on the DAL. In a situation as you describe having a layer of indirection for the UI and BLL to rely on makes DB changes much safer.
2) Create automated tests (both unit and integration), especially if you plan on making fairly significant changes to the Domain or Persistance layers (BLL/DAL). To make this really easy you should always try to program to an interface. This makes your code more flexible as well as letting you use mocking frameworks (Moq is one I like) to ensure your tests truely are unit tests and not integration tests.
3) Take a look at DDD (http://domaindrivendesign.org/) as it seems to fit pretty well with the given scenario. At the very least there are some very useful patterns that can help make your application more flexible.
4) MVC isnt very hard to learn at all, it is however an easy way to get unit testing setup for the UI as a result of the MVC architecture (testing the controller and not the view). That said, there is no reason you couldn't unit test web forms, its just a bit more work. MVC really is just a UI framework/design pattern (more Model2 but we can ignore that for now). It gets you closer to the metal so to speak as you will be writting a lot more HTML and using a Model (the 'M') for passing data around.
For DDD take a look at Eric Evans book: http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/ref=sr_1_1?s=books&ie=UTF8&qid=1317333430&sr=1-1
Hope that helps
ASP.NEt forms is a no starter, is completely inappropriate for something like this. I recommend to start with something like Creating an OData API for StackOverflow including XML and JSON in 30 minutes, then build your Web app on top of that (ie. push it to the client, use JQuery/Silverlight).

Resources