User Defined Rules in a Web Application [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm required to implement a notification system integrated to a web application (JavaScript + PHP). Notifications should be fired based on user-defined rules. I don't have experience with rules engines and building rules. Therefore, I don't know what I'm doing or if what the following could be implemented by better solution.
I'm trying to figure out how to store and process the following hypothetical scenario. Let's say that the web app is a shopping online service for a store that has 3 lines of products, line A, line B and line C. Each line has different characteristics. User#1 selects an object from line A, then specifies some characteristics such as size and colors. User#2 selects an object from line B, the only characteristic for this kind is material, he selects wood. Then both users ask system to notify them whenever these objects with these characteristics become available.
From what I've read so far, this could be done through [user-defined rules]. If so, then
What's the best technology to handle it? I'm willing to learn but I need a direction to help me start.
Can I use openRules or similar for this?
How to sent user defined data to a web service? given that they change based on the line.

If you are using a database, or anything similar, you can make a table where you would save the rules for each user. You can than later load them with a php class as soon as the user logs in, and check against them before doing anything that was optional.
You can also make a table and set flags, once an item becomes available loop trough the table and notify every user waiting. You would need to store, item id and customer id, in the table and delete them once they have been notify.

Related

Save only modified elements of an array [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am working with Angular, C# for the backend and DB with Oracle. The project is for a company and in the grids they leave me more than 120 records. In these grids the user can edit each record and by selecting the "Save" button all the records are sent (those that have been modified and those that have not been modified) and that is where I need your help. How can you tell which records have changed? MY IDEA is to make a copy of the data that arrives and at the end compare which ones have been changed and send that new list to the database (only with the changed records). ANOTHER IDEA is that every time someone makes a change, it will be added to another list, but the problem with this is how to identify when it changes and when it changes and returns to how it was ... Any ideas?
There are numerous ways to keep track of which elements have been modified:
Define an interface with the object and an "isModified" flag. As each item is modified, turn that flag to true.
Keep a separate list of modified objects (as you mentioned)
Keep a list of the Ids of the modified objects
With regard to how to determine whether an object has been changed, that will depend on how you are handling the edits. If you are using Angular Forms (as mentioned by #nobalG above), then it will tell you went the data is modified.
If not, again depending on how you are handling the edits, you may have other changed events you can track.
More detail isn't possible without having some code detailing how you are handling the edits.

I need an advice for web developpment [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to code a website, showing 7 elements: one image (that will be changing), and 6 buttons (left, right, up, down, backwards, forwards), as shown in this example
The website should be able to "read" a 6 column file, which will have the following format example
with:
"ind_img_x" being the index for image x (numeric index)
"url_img_x" being the string containing the web address for image x
The file will control which image will appear accordingly with the button that is pressed.
For example: if the image displayed is "img_2", and the user press the "down" button, then the website will show the image 77452, and wait for the next button to be pressed.
The file will be rather big, able to contain several million lines (for example 10 million lines).
I should be able to update the file from time to time.
The web site will have to be able to get each image from the web (by means of the url in the file) The url data may consists of strings of large length. And the website has to be able to read these long strings and urls.
Would somebody please give me some advice about the best web developing language to use?
Do you think I'll be able to drop the file into the server as a text file, and ask the web site to read it each time, or will I have to put the data in a database?
I look forward to any advice that you guys may have,
Thank you!
Simplest way would be to use a webhosting service and parse the file with JavaScript. Especially because you said you already have JavaScript knowledge.
I would also suggest you to use CSV files: https://en.wikipedia.org/wiki/Comma-separated_values
Edit: When you have millions of lines you should use a database and use Nodejs libraries to connect to the database. Files are only recommended for small sets of data.

Simple Questions/Answer Games [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Thank you for taking the time reading this!
A quick disclaimer, I have never coded anything in my life!
I know some basics terms so you can communicate your response without defining them.
Anyways, my project is a simple game.
You press [START]
You hear a "random" word
You have a type-in box,
if you fill it right you get +5 points and get a random word .... and so on.
You fill it wrong, you lose immediately [gameover]
Although, I would deeply appreciate to code the whole game, for some of you it is relatively simple - I wish to do it myself for the learning experience and sense of accomplishment!
For now, I only need a push in the right direction.
I aim to use it on my tablet or phone (both run android)
Best,
haz
You should start by learning the fundamentals of JavaScript and HTML (should also learn CSS if you want the app to look nice). There are many sites (other than SO) that have multiple tutorials and/or full documentation (i.e. MDN, W3Schools). You could also use online teaching platforms for that.
Here are a couple of things you should consider after getting a grasp of the basic concepts:
When do you want to check if the user inserted the right input (timer, on enter, a submit button)?
Where will the sounds be stored and how will you retrieve them (a collection of sounds of files, a database with a server, a single big sound file containing all of the words)?
Regardless of how you store the sounds you will need a way to map text to the sound and the random number (Math.random()) to one of the two.
Finally create a JavaScript function that resets the text and gets a new word every time the user gets the word right or when the initial start button is clicked.
Once you reach any questions on the actual coding, search for the problem in SO (odds are it has been asked before). If you can't find an answer to your question create a new question (you should read How to ask first).

Button that updates number on all sessions [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I've tried a lot of ways, like for example the fs module, but I just can't find out how to implement this. I need a button that:
Updates by one whenever any user presses the button
Persists on the server
Does anyone know how to do this?
If you are new and need to build something that stores stuff on the server you have a lot to learn. If you just need to solve this simple problem and get things working you could make huge progress using a hosted backend service. If you do this you can write a couple of lines in JS and the job will be done. Most offer a free account.
One such service is built.io see link below:
https://docs.built.io/api-reference
var project = Built.App('blt5d4sample2633b').Class('score').Object();
project = project.increment('points',10); //Increases points field value by 10
That code above would update the score by 10 and store it , you can then retreive it when you show the page. All users would see the score update.
There are realtime backend services too which are very good.
An example is:
www.firebase.com
You would need to decide which one is best for you, add their script to your page add a button, hook the click event upto a function that you would then add the simple code to update the score. See above.
It a nutshell that would be it. You can probably get it working in under 1 hour if you follow the guides on the vendors site.
Firebase is backed by google and has a huge online community.

Exchange Html Data form in Real Time [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
hey guys I'm totally new to programing and I need your help to walk me through this .
lets say we have 2 users that want to communicate through HTML forms
The first users fills out a html form ( first name , last name , age etc ... ) and submits it .
The second user receives the form without being able to apply any modifications to it and then submits back to the first user as either approved or disapproved ( by ticking a radio button )
all of this has to happen in Real Time.
can somebody please explain to me how it works ? Is it done with Ajax ?
what should i research ?
You should look into Web Sockets, this is how you can accomplish the functionality you would like. Here is a link to some information on web sockets and it has a few different libraries that implement and abstract web socket to make it easier to use:
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
If you develop in Visual Studio with .NET, then you can check out Microsoft's SignalR library. It makes WebSocket coding easy:
http://www.asp.net/signalr
If you are wanting to stay away from WebSockets completely, then you would be looking to use AJAX and "Long Polling". here is a good SO post on this:
how does long polling work javascript?

Categories