Serverside Dashboard buildup (Node.JS) - javascript

I´m sending some sensordata to my azure IoT-Hub and now I want to display them on different Dashboards.
To get started I used the template from a Microsoft Tutorial and it works fine:
https://github.com/Azure-Samples/web-apps-node-iot-hub-data-visualization.git
The only problem is, that the Dashboard only show the new data that comes in for the client.
After every reload of the page (from the client side) the Dashboards are completely blank at first and then build up the data that comes up next.
(I think the client loads the script and builds the Dashboard up itself?)
I load the index.html file and in the html-file are linked some js-files.
My question is now if it´s possible to build up the Dashboards the whole time on the serverside in Node.js?
So if a client connects to my site, it automatically shows all saved data from my Dashboards (even from the past)
TLTR:
Can you generate data on Dashboards on the serverside and then just "mirror" the Dashboard to the Client?

Probably you are looking for a solution with Dashboard that can show previous day data as well.If so you need to push data from IoT hub to some other storage like CosmosDB etc and built your custom dashboard on it.
I had a similar requirement like that and used Azure Time Series Insights for that purpose.The API would return data to UI which has Dashboard build on Angular. Have documented the same here :
http://learniotwithzain.com/2019/03/near-real-time-iot-data-exploration-using-azure-time-series-insights/
Azure Time Series Insights product has some ClientSide SDK as well. Please do check the cost associated and see if this suits your requirement.

Related

How to store numeric data for nextjs/react website? (csv file? backend api call? download from a different server?)

I have a nextjs site and would like to display a chart on it. Where should I put the data for this chart? The options I see are:
Create a csv and put it in the public folder and load it from there
Create a csv and put it on a different server so my site can download it from there
Create a graphql (or other api) call on my backend which could send this data
I guess for frequently updating data 3. is the best option right? What about for static data?
For data you will seldomly be updating you could add a csv and import the data as a Json file on application build using something like this.
This is probably the best solution for data you update often, but you will need to build your frontend application (Your next.js app) every time you update the csv. This is really not such a problem if you have a working CI/CD. (check out vercel for next.js if you havent)

Dynamic Data in Shopify Blog Page

I want to write an API, i.e. hosted at www.api.mywebsite.com (not affiliated with Shopify) and then have a shopify blog post that queries that API and displays that data using javascript.
I know how to do the API potion, but can I and if so how do I do the second part where I use JS to query and display data?
Simple! Add an App Proxy to your App. With that, you setup an end point to call in your App. On the blog page you can send an Ajax GET with an ID to your App, which can then get dynamic content ready for you to use. You can either format the response as Liquid or as JSON as two examples. Send back Liquid, and Shopify renders it for you. Send back JSON and you can stamp out your data in a template.
And best of all it is a secure callback to your App that you know came from Shopify, so you have no hassles or security problems. Look in your App for Extensions, and enable Online Store, where you can tinker with the Proxy.

Is Gmail a Single page application

Today I was going through the my mail box. I just seen that when I am navigating through different folders after # that folder name is changing and data being refreshed. I just want to confirm is Gmail a single page application. I also want to develop a mail box kind of application using Single page application concept. Below is sample URL for inbox folder.
https://mail.google.com/mail/u/0/#inbox
Can I develop sample mail box application using angular js as angular js supports concept of SPA?
Yes, Gmail is a single-page application.
That is the reason before loading Gmail you see a progress bar, as it fetches everything from server once and then all the rendering is done on the client side with calls to server only for fetching data and not the DOM.
Apart from Gmail, other services in the suite like Google Calendar, Google Drive etc. are also Single Page Applications.

Using a server to send/receive information between a mobile phone and web page

I am trying to set up a simple set up as follows:
Have a mobile app with a page consisting of 4 lines (4 html paragraph lines (I am using phonegap)).
I want to use a web page from which I will input the data for those 4 lines. This information is sent to a server and that server transfers this information to that app on that mobile phone. Now, those 4 lines on the mobile phone is filled with the new information.
Similarly user inputs information on another page consisting of 10 lines of li (list). This information is again sent to the server and to the web page where the information is displayed.
I can almost feel the "internet police guys" getting all hyped and ready to vote this question down. But please understand that I have been on this site and various forums desperate to find a tutorial to guide me to do this and not able to find.
I am trying to use ajax to perform this setup. Confused how I would be using the php file. Information such as password n username is going to go in that php file to connect to the server. But php is a server side script thus needs to sit at the public_html folder. How do I use the php file from my desktop? Write a separate javascript to access it?
It is the concept that is confusing me. I am familiar with html,js,php.
I would appreciate any guidance or maybe a link to a tutorial which would help me to do the concept I mentioned. Thanks for listening.
You will need to create an API using PHP. This API is uploaded to your server and is considered "RESTful". Google a tutorial for what fits your needs. You can set all sorts of rules in this API such as requiring any requests to have an ID or access token.
Since you are using PhoneGap, your HTML and JS files rest on the device, so you will need to allow permissions to your API from anywhere. For this you will have to speak to your host provider about unless you know how to configure it yourself (some providers restrict what you want to do by default as an extra security precaution against XSS attacks).
Next, you can either use jQuery, or you can write some AJAX calls by writing the JavaScript yourself.
The most efficient way for this to work is to send JSON objects to and from the API. You will include a "command" in the JSON when you are sending from your app. On the PHP side, you will retrieve this command and use the rest of the data included in your JSON object to process the request. Your API will need to encode a JSON object for return (such as a user's profile information).
Here is a basic PHP API tutorial to get you going that explains some of the features of a RESTful API: PHP API
Here is a simple AJAX function (you will probably want to make this much more modular): AJAX
As broad as your question is, it seems like the best/easiest thing for you to do will be for you to first create a PHP webpage that will access a SQL database to perform the record updating. Actually, this should serve all of your needs for your mobile users assuming you don't need push notifications for live data updates.
I am assuming, since you are using phone gap, that you are more comfortable with web languages. After you get the webpage fully operational, then you should start building your app based on that exact same SQL database. With mobile app development there are a lot more "what if's" (what if the phone rings, what if the app is running in the background, what if there is no cellular service, etc...)
It is always easier to start with what you know and build on that, rather than starting with a new development platform and troubleshooting as problems arise.

Frontend for Hibernate and SQL 2008 Connection through JSP or JS

I am working on application which uses GWT as front end and Hibernate 4.0 Framework. I am using SQL 2008 (R2). My application is purely DB Driven. And the application would get launch at multiple portals simultaneously with different DB. Right now, the problem which I am facing is, I have to deploy as many wars as many DBs are there for each Portal. Is there any way with Hibernate to make it configurable? Means After loading my Homepage after entering db name, db user_name and db password it gets connected to the DB.
I would also bring you notice that my Homepage gets loaded in JSP. And after login it is calling GWT Entrypoint.
As said by #ToddMurray in the comments, you should use a configurable JNDI dataSource. It's the preferred way to go with containers like JBoss. See here for a config example.
Another way to go is with Hibernate properties: read the documentation here.

Categories

Resources