How to add a "# users online" feature to Meteor app? - javascript

I'm working on a Meteor app and I want to add a feature that would say how many people are on the website at a time, similar to omegle.com where it says "38,000+ online now" or whatever. Is this possible with Meteor? If it is, I have no idea how to execute it, and that's why I'm asking it here. Does anybody know how to do this?

You can use presence package for that purpose, see https://atmospherejs.com/package/presence . It provides the live data on the user state. For example, the easiest way to get the number of online users is:
Presences.find({online: true}).count();

Related

How to know which site are running my module?

I am about to sell a module that I coded for e-commerce websites, and I was wondering if it's possible, to insert some extra code in it in order to know which websites are running the module.
In other words, let's say a customer buys my module, then install it on its website, is there a way for me to know which website it is ?
I don't want any other info than "which website", my goal is not to trace users, but simply to have a statistic of the number of websites where my module is installed (because, it can be for instance that a customer buy the module then install it on several other websites...)
Thanks for your help
Aymeric
Difficult to answer without knowing what you are running, PHP, JS, etc. but when I created a similar plugin for WordPress there are some hooks for when a plugin is activated/deactivated. I just put an HTTP call into my API that told me when someone activated or deactivated the plugin and I got a rough idea. I mean, if they don't deactivate it properly, e.g. delete the files, then you would get a false positive of them using it, but not many folk do that.

Automatically create an invoice with customer details from website

I've just set up a website with much help from this site!
I have customers who buy items (through the PayPal interface that takes care of the credit card payments).
I have made invoices in LaTex, which I edit manually. The next step I want to take, is to learn how to get my website to pass the purchase information into my LaTex document so that the invoice is automatically generated, and automatically send a copy to the customer.
My question is just: what things should I be searching for to look in order to learn about this kind of thing? I don't know where to start. Would it be JavaScript that would do it?
You will probably need a backend language for that like NodeJS, PHP, Java etc.
Where i would start is look at the documentation of LaTex and see if they have API's to hook into to do what you want to do and go from there.
Usually if there are api's available they will come with examples to get you started.

Integrate Payment Gateway into NativeScript App

i am quite new to Mobile App Development, Payment Gateway implementation and NativeScript itself. Now i shall integrate an IPG into a Mobile App build with NativeScript to allow the user to buy goods via the Application (it is already possible to do so via the Website). I do not have any information regarding supported payment methods yet.
Whenever coding something i do have the opportunites to either write it on my own or use an existing open-source API. I've decided to try an open-source API to make it work.
My Problem is that i don't really know where to start. I have been doing some research on "how nativescript works" and Payment Gateway itself. Basically any JavaScript code is going to work with NativeScript, so any open-source API for IPG working with JavaScript should do it for my Application, right? Since i did not find any open-source API's for NativeScript itself, i started looking for any JavaScript API. Sadly, all if found was an API of telecash (https://www.telecash.de/produkte-services/e-commerce/support-fuer-entwickler/downloads-handbuecher/) (watch out, thats a german side), whose documentation seems quite fine, but it did not seem open-source.
So my Question(s):
Can anyone tell me a little bit about any experience you might have with that topic (perhaps just a link or a tip)? Maybe there is even another thing that i should start with that i have forgotten? And i think i did not understand the difference (if there is one) between Payment Gateways itself and IPG. Maybe someone can help me out on that.
I can not post code here since i am still on the "research"-phase (have been for quite a long time), but I can not see any progress within it so I am counting on your help. Feel free to correct me if I did a mistake or understood something wrong I mentioned here. :-)
Best regards.

Google calendar API with a server side account node.js

The title pretty much sums it up.
I'm sorry for asking this question here but i have been going around and around in circles for about 2h now trying to figure out if it is possible to access a calendar's events (simple get, read-only) without the user having to login to a google account?
I am trying to display the events of one calendar to use as an internal thing. But i want this to work without necessarily asking the user to log-in manually.
I have a service account set-up, but for the life of me cannot figure out an example in javascript where this works. And i'm wondering if it is even possible in JS. I know it is possible in java and php. But no examples using javascript seem to exist.
I also saw a few similar cases on stackOverflow, but those cases were looking for refresh tokens. I would like to abstract all authentication from the user.
So, is this possible in javascript?
(Angular.js client-side/Node.js server-side)
Edit for TL;DR
I want to fetch and display events from a google calendar from a node.js server without ANY user intervention. Is this possible?
HAHA! I found something that works.
Install it, create google service-account, download the .p12, convert, enter the info and you're good. Detailed on his github. Calendar stays "private" (only shared to the service account), no user intervention is necessary and it fetches the data fine
(Mostly... Having a problem deploying my js code on a different machine but it works fine on the Windows I used for testing and it's probably a mistake on my part.)

Creating a Notification Icon with Dojo 1.9

I want to create a notification icon with Dojo, but I'm not sure where to start.
The icon has to be similar to those found on Facebook and Whatsapp, showing how many new messages/notifications you have.
I've been looking in the Dojo reference, but couldn't find a good widget to use. Maybe I'm missing something obvious, but I might as well ask it here.
Googling hasn't been of much use unfortunately.
As far as I know there's no widget that automatically does the stuff for you. This problem is far too specific to provide a general widget for it. You also have to think about several things before you can start.
Do you want to use WebSockets? The web is generally made for pulling content, if you want to push your notifications from your server to your client, then you will need to look at WebSockets. A good tutorial to use them can be found on Sitepen.
If you don't want to use websockets (you're not able to create a websocket server or you have some other reasons) then you will probably have to use a simple "REST service" and obtain the amount of notifications from it. This means you're script won't be "live", so you will need to pull the content from the webservice every X seconds/minutes. This means you need a normal AJAX request which can be done with the dojo/request/script module.
If you need to time this AJAX request, you can use the dojox/timing module.
This is only the "logic" part, the user interface (icon + # notifications) can be made by yourself with plain HTML and CSS.
What about dojox/mobile/Badge:
http://livedocs.dojotoolkit.org/dojox/mobile/Badge
?
From comment:
"Maybe you can find something in the DojoX library" -
off course you will find much.
I would recommend
dojox/socket
see http://dojotoolkit.org/features/1.6/dojo-websocket

Categories