HTML5 QRCodeScanner for attendance system - javascript

I want to youse HTML5QR Code Scanner library in one of my projects.
First I want to say sorry for asking those very basic questions, but I am new to coding in JavaScript, I normally write in PHP.
I'd like to use this library for my school as attendance system.
My idea is: every student owns a qr code
The teacher scans the code with his mobile device. After collecting all codes, the decoded values (name of each student) are written into a database.
I have two problems with that:
1: Can I collect a list of all decoded values?
My idea is that scanning, collecting and than writing the values into the database is much faster than doing this process for every student individually.
2. How can I pass those values to PHP, which I use to write the values into my database?
Thank you in advance for your help!
Kind regards
Dan

If i caught you well i would suggest you to use the following library https://github.com/cozmo/jsQR then implement a very simple interface to allow lecturers (Non-Tech persones) to easily scan the student card and get directly a feedback as the attendance has been taken.
To enhance Fexibility, avoid saving all students details on the the QR datas but instead just save his unique identifier i.e Roll Number and then as soon as his attendance is taken, retrieve all other infomation from database.
For fasten the process, You will need to send the request using Asynchronous Request,check on https://www.w3schools.com/js/js_ajax_http_send.asp to know more about it.
Finally, Avoid complicated UI on the record page for lecturer, this will avoid misunderstanding.
I've previously worked on attendance system feel free to ask me any other question.

Related

how to make relation for no sql database?

how to make relation for no sql database?
You can say it for firebase database, where database is in json
format.
A NO SQL database means that database has no relations. Either go with SQL database and convert JSON format or face the truth that in NOSQL there are no relations.
Before anything, I will give you an example of how to try to do this, but I want to tell you that I wouldn't actually do this again. Firebase is no good replace for MySQL.
Making relations for a noSQL database is not possible, but you could always make them "manually" and decide how to work with it.
What I meant with "manually" is that you can duplicate data for that, but that's not a very good option. For example, I made long ago an Android app to manage neightbour communities, and because of the time I had to do it I decided to make it with Firebase.
And I will never do it again, to be honest. I didn't want to lose time on an API, but I lost it anyway trying to structure everything nicely and with all the changes I had to make every 2 days so everything wouldn't fail.
Here you have an example. The database has 2 nodes, the communities and the users.
The users have these fields:
And, meanwhile, the communities have an incidences list, and those store the email of its author as any other field (image not relatable, they are random ones).
So, TLDR: No, you can't make relations. The only way to do what you want is with duplicated data, like the email of its author on the incidence.
PS: I made a chat app with Firebase in my company, I would share the DB with you so you can see the structure, but it's confidential, you know.

Caching query results, to do or not to do, overkill or performance energizer?

Good evening,
my project uses the MEAN Stack and has a few collections and a single database from which the data is retrieved.
Thinking about how the user would interface itself with the webapp I am going to build, I figured that my idea of the application is quite a bit of a waste.
Now, the application is hosted on a private server on the LAN, making it very fast on requests and it's running an express server.
The application is made around employee management, services and places where the services can take place. Just describing, so to have an idea.
The "ring to rule them all" is pretty much the first collection, services, which starts the core of the application. There's a page that let's you add rows, one for each service that you intend to do and within that row you choose an employee to "run the service", based on characteristics that this employee has, meaning that if the service is about teaching Piano, the employee must know how to play Piano. The same logic works for the rest of the "columns" that will build up my row into a full service recognized by the app as such.
Now, what I said above is pretty much information retrieval from a database and logic to make the application model the information retrieved and build something with it.
My question or rather my doubt comes from how I imagined the querying to work for each field that is part of the service row. Right now I'm thinking about querying the database (mongodb) each time I have to pick a value for a field, but if you consider that I might want to add a 100 rows, each of which would have 10 fields, that would make up for a lot of requests to the database. Now, that doesn't seem elegant, nor intelligent to me, but I can't come up with a better solution or idea.
Any suggestions or rule of thumbs for a MEAN newb?
Thanks in advance!
EDIT: Answer to a comment question which was needed.
No, the database is pretty static (unless the user willingly inserts a new value, say a new employee that can do a service). That wouldn't happen very often. Considering the query that would return all the employees for a given service, those employees would (ideally) be inside an associative array, with the possibility to be "pop'd" from it if chosen for a service, making them unavailable for further services (because one person can't do two services at the same time). Hope I was clear, I'm surely not the best person at explaining oneself.
It would query the database on who is available when a user looks at that page and another query if the user assigns an employee to do a service.
In general 1 query on page load and another when data is submitted is standard.
You would only want to use an in memory cache for
frequent queries but most databases will do this automatically.
values that change frequently like:
How many users are connected
Last query sent
Something that happens on almost every query (>95%)

How to match and categories mysql data in the background?

I was researching about this but couldn't find any tutorial as I don't know what exactly the program is used in this matter.
I have mysql data of expenses.
What I want is after user add new expense, it automatically categories that transaction based on the supplier name or the description provided.
For example if the transaction is:
Supplier/Store: Mc Donalds
Date: 15/06/2016
Amt: $10.00
Tax: $1.00
Then column "Category" should automatically be filled by "Food" may be sometime later in the background.
Hope you can give me a kick start.
Thanks
if I am clear to your question. I think you should use a session.
if the user add expense, then you automatically push that expense to the multidimensional session.
you just put the session in a html tag that always update every seconds (use settimeout or setinterval in javascript )
because what im trying to say here, is that its easy to call function or data when it is inside the session. and if the user is done the process. thats the time you will save all changes into database. just like a shopping cart.
You're asking about a very difficult problem to solve completely.
You can have a trivial solution by mapping a list of known supplier names to categories, but that won't be too useful with real life data, where supplier names can vary a lot according to user input, not to mention the amount of effort required to maintain that list.
If you want to start parsing descriptions for categories, it's even harder, involving NLP and probably some sort of machine learning algorithm from user feedback.
TLDR; Entire teams of Masters/PhDs are usually tasked with what you want to achieve, good luck. It's also not an exact science, but an art, so no exact algorithm exists, at least not in the public domain.

Offline UK Postcode Database With Geographic Coordinates

Is it possible to query a UK Postcode Database that is available offline and gather Geo Coordinates with JavaScript?
I am under the impression that the database is too vast to do this without online/local database management.
Has anyone found a solution for this problem?
Thanks.
EDIT:
The data will need to be used by a private organisation and does not need to be either hugely accurate nor updated regularly. (Basically the user needs to find the nearest location to their specific postcode - < 10 locations). I Think my concern is seeing the 550+mb databases.
It also needs to work purely in the browser offline using JavaScript. JSON format would be preferred.
This is possible and there are few choices but first a few questions.
To what level of accuracy do you need the coordinates
The more exact, the more it will cost
How much time and effort do you want to put into long term maintenance
The data is regularly updated so make sure you have a business process in place
Are you building a solution for an existing company, or trying something out as a startup?
It is a large amount of data, but is manageable. The practicalities depend more upon the amount of time and money you want to invest.
There are two approaches:
1) Build your own
If needing premise level coordinates, you'll need to get a copy of the postcode file from the Royal Mail here and depending upon your level of accuracy you'll then need to also grab a supply of coordinate information from someone such as Ordnance Survey.
Load and link together the supplies into some sort of database or other store you are comfortable working in and make sure this process is easily repeatable once a month when the data comes through.
For just postcode level, I think the Code-point Open data should be good for you. If you are not worried about individual premises and postcode level is good enough. That comes to about 150MB in CSV files but you can get it a lot smaller than that by just storing the data you need.
The next step and develop a look up mechanism. The quality of your look up will depend upon your use case. If you are just after a rough location from the postcode this will be simpler than if you are after it down to the nearest cm and need a full premise address.
2) Go third party.
There are many companies around that can do this for you. My company - Experian Data Quality - provide tools to allow you to do this offline as a library or SOAP based service.
Once integrated, they will allow your users to quickly and easily find their correct address and then in the same call enhance the address with location (and many other types) of information.
This will cope with typos, data updates etc. Fill in the form or give us a call for a demo if sounds useful http://www.qas.co.uk/solutions/data-quality-software/data-capture/address-checker.htm
There is sample integration code available that will allow you to hook it into your website with JavaScript.
You can buy the database from the Royal Mail:
http://www.poweredbypaf.com/end-user/products/data-products/paf-raw-data/
This is the official database from the Royal Mail and can be downloaded and used offline.

Run Database Stored RegEx against DOM

I have a question about how to approach a certain scenario before I get halfway through it and figure out it was not the best option.
I work for a large company that has a team that creates tools for the team mates to use that aren’t official enterprise tools. We have no access to the database directly, just access to an internal server to store our files to run and be able to access the main site with javascript etc (same domain).
What I am working on is a tool that has a ton of options in it that allow you to select that I will call “data points” on a page.
There are things like “Account status, Balance, Name, Phone number, email etc” and have it save those to an excel sheet.
So you input account numbers, choose what you need and then using IE Objects it navigates to the page and scrapes data you request.
My question is as follows..
I want to make the scraping part pretty Dynamic in the way it works. I want to be able to add new datapoints on the fly.
My goal or idea is so store the regular expression needed to get the specific piece of data in the table with the “data point option”.
If I choose “Name” it knows the expression for name in the database to run again the DOM.
What would be the best way about creating that type of function in Javascript / Jquery?
I need to pass a Regex to a function, have it run against the DOM and then return the result.
I have a feeling that there will be things that require more than 1 step to get the information etc.
I am just trying to think of the best way to approach it without having to hardcode 200+ expressions into the file as the page may get updated and need to be changed.
Any ideas?
IRobotSoft scraper may be the tool you are looking for. Check this forum and see if questions are similar to what you are doing: http://irobotsoft.org/bb/YaBB.pl?board=newcomer. It is free.
What it uses is not regular expression but a language called HTQL, which may be more suitable for extracting web pages. It also supports regular expression, but not as the main language.
It organizes all your actions well with a visual interface, so you can dynamically compose actions or tasks for changing needs.

Categories

Resources