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
Building a 'fake' web browser and web pages that are all compiled locally in a windows form application. The whole thing operates offline.
I need to build a search function on one of the web pages I've made. Obviously theirs no server involved, so I have to have the data extracted and displayed from a local source. I've used 'Jput' before in a previous project so i was thinking about having a Json file that can be called. The site is a fake social network, so when a user searches a name or phrase, it displays related results (profiles) either on a separate page or within the current doc. Jput is good, but its pretty limited when it comes to styling.
QUESTION
What would be the best way of doing this? How would I index all these results and how would the search engine work?
Let me know if more detail is needed for this question
Thanks!
You can use a normal Javascript array ( that can be stored as json) :
Example data:
var users=[
{name:"John",age:22}
{name:"Jack",age:23}
]
Now you can search after name:
document.body.innerHTML=users.filter(el=>el.name.split("Ja")[1]).map(el=>el.name).join("<br>");
This will show all users that names contain "Ja"inside of the document ( or any other html elem, can be based on users input).
You can easily show a users profile like this:
user=users.find(el=>el.name=="Jack");
for(key in user){
alert(key+":"+user[key]);
}
This is just the beginning of what you can do with natives js, no need for libs etc.
Related
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 4 years ago.
Improve this question
I am trying to get a list of singles released in 2018 from allmusic.com.
It is easy enough to go to their advanced search page and input those parameters, but then I would have to copy and paste the information by hand. All the information is in the html, but it has be generated by clicking the search button and the page navigation buttons. The url itself doesn't change. That puts it well out of my ability to crawl via my limited beautiful soup skills.
Does anyone know how to web crawl java script generated html?
Without looking into the details of the particular website, I imagine you would need to find out what HTTP requests the JS code is making and work backwards from there.
Start by inspecting the network calls (e.g. in Chrome DevTools, just look in the Network tab) and then write something to make those same calls to retrieve the data.
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
I have this Store Locator
Installed on my website. It's all working fine and well, but it's a bit slow. This is because there are 500 stores located on the map.
Edit:
I am looking for this!:
https://googlemaps.github.io/js-marker-clusterer/examples/simple_example.html?compiled
Can somebody explain me how to implement this (javascript), into a magento site?
I suggest to build your own module for this.
try this module creator: http://www.silksoftware.com/magento-module-creator/
on the (Need Add Single Table Model) put yes, and then select (Need Backend Model Manager) and fill the fields.
Basically in your case you need the following fields (store name, store lat, store long, store full address, etc..)
the module will provide you with manager in the backend to manage and create stores easily.
then you have to style the list on the front end..
print them in the same format used in the example (you should use this format: https://googlemaps.github.io/js-marker-clusterer/examples/data.json)
and finally load the js and it should work perfectly.
Let me know if it worked or you are still facing any issue?
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 have a problem that I'm not sure how to approach. Here is some background:
We are using a web application that can be extended with ASP classic and JavaScript
The web app contains details of clients
Users of the web app need to be able to print an address label for a specified client
The user needs to specify which label on the sheet will be used
Now I can get all the information that I need about the client and which label is to be used next but I have no idea how I should go about printing the label. I have an inkling that I should be doing some sort of mail merge and displaying the result to the user for printing but I don't know how I'd go about getting the screen laid out correctly for the labels. Should I be creating some kind of PDF and displaying that? If so how would I go about doing so?
This is all very new to me so any help would be much appreciated, Thanks!
At FVI we have the same issue and solved it as old school as it gets.
First we created a rtf document of the label we wanted. In this template we had key words in the file such as ##CUSTOMER## and ##ADDRESS01##.
Step one was opening the template into memory, text substitute the key words and save to a web link for opening and printing.
By making a new RTF file on the fly we did not have to worry about the software on the other end of the connection. we just presented our factory with a correctly formatted response that fit to the printer definition we had established.
Thus on the web page it has a select option for label type and that loads the correct template into memory for final output.
Not the best way to do it, but it cost us only 1 day of layout and simple html programming and zero issues with our China Factories.
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 9 years ago.
Improve this question
I am currently working on a small nodejs project that is responsible for returning search terms from a twitter feed. I have the search working however because I am new to this I am having problems displaying this on my webpage. The search information I want to display is being held by a callback from my function and I want to output this information. Keep in mind this information is ascertained after the webpage is loaded and I think that is why response.write(information); is not working for me. However if I do console.log(information); I do get the information I want but it's just not where I want it. Can someone help me out with outputting please.
I ended up solving this by using JSON.stringify(information);
You are right, it's very likely that once you have returned your webpage the response will be closed.
2 options:
1) you load your webpage first on 1 static route (using static middleware) and this web page then does an ajax call to a second route which returns your information.
2) you don't return your webpage until you have retrieved your information. I'm assuming your information will need to be displayed on this webpage which means you'll have to turn your webpage in a template and merge it with your information. You can use a Jade template or underscore template for example.
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 7 years ago.
Improve this question
What is the best script to use for showing the current visitors or guests Online?
Thanks!
As #Ryan Smith suggested, this greatly depends on the implementation details of the website. I'm sure that there is a off-the-shelf framework offering a storefront application with all the bells and whistles (such as the types of scripts you are mentioning); however, these can range anywhere from being free and open source, or very expensive.
Implementing a script like this yourself isn't very difficult. Assuming that you're keeping track of the users on the website in some form of data store (typically a backend database) you could do something like this:
When the page loads, fire a JavaScript that makes an Ajax request
Have the page that's the target of the Ajax request select a count of the number of rows in the table storing the active users. Return this result.
When the request completes, have the Ajax callback insert the number into the DOM in whatever place you'd like.
You can set this process to repeat at certain intervals so that the pages containing the script are dynamically updated showing a relatively up to date count of the number of users online.
I think it all depends on how your tracking who's online within your application.
Usually, when someone logs-in, you create a session for them that you could iterate through based on whatever language you are using.
You have to keep in mind that HTTP is a stateless environment, so determining when someone is online is largely subjective as to your opinion as to how long ago they logged in.