I'm trying to create something similar to the below HTML form using Play framework with Java:
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_filter_list
But instead of hard-coding the selectable values to be searched (like "Adele" in the example I gave above), I plan on querying a large dataset with thousands or 10s of thousands of records and allowing users to search that dataset. Please answer my below 2 questions:
Is this possible to do in the Play Framework
Would doing this be bad practice? Would it be better to have users enter a string and only query when they hit the 'Search' button?
This is 100% possible with Play! The bottleneck will be your dataset. Is it a file, an SQL database, a nosql database, a search engine, a webservice query. This is where the problem usually lies.
Debatable. Implement it any way you like, if you experience bottlenecks tweak it. You could implement a 200ms timeout before firing the ajax request. A very nice tool is select2 which allows you to easily configure this.
Related
General question here. I have a Spring Web MVC Application that allows users to enter data one record at a time. Validation checks are run when adding/editing each individual record (database calls, client side validation, etc)
We want to provide users a way to bulk insert many records on a single load. Right now the obvious choice is importing an excel spreadsheet, however I feel like this will require a ton of redundant work as we will have to provide all the same validation checks, dynamic string building, and preloading drop downs in this excel sheet as we have done in our application. Thus my question is, is there a simple solution of recreating this process via a web interface that would imitate entering data into a spreadsheet (Any tool or framework of sorts)? If this could be done on the front end we would be able to utilize all the functionality we have already implemented
Hope this isn't a poor question, I would just really like to avoid spreadsheets all together
I use http://handsontable.com - it is a javascript component that I use.
You can get quite close to Excel-like behaviour, in a browser. You can also copy / paste to and from Excel with it.
I want to implement a search functionality in my web application that I am building using java technology. I would have to search through the database, depending on the user query and will display the results. Which way can I go about doing this(please take note I am using java technology)??.Thanks.
You can use a product like http://lucene.apache.org/core/ or http://lucene.apache.org/solr/ for this instead of writing this on your own.
Lucene is a high-performance search engine for documents.
SOLR is built on top of Lucene and provides additional features (like hit highlighting, faceted search, database integration or rich document (Word, PDF, ..) search)
Lucene will analyze your text data and build up an index. When performing a search you run a lucene query against this index.
Assuming you mean free text searching of the data in the database...
For free text searching Lucene and/or SOLR are very good solutions. These work by creating a separate index of the data in your database. It is up to you to either pull the data from the database and index it using Lucene/SOLR or arrange your code that writes to the database to also update the Lucene/SOLR index. Given what you have said it sounds like this is being retrofitted to an existing database so pulling the data and indexing it may be the best solution. In this case SOLR is probbaly a better fit as it is a packaged solution.
Another option would be Hibernate Search. Again this would be a solution to use if you are starting out. It would be more difficult to add after the fact.
Also bear in mind some databases support free text searching in addition to normal relational queries and could be worth a look. SQL Server certainly has text search capabilities and I would imagine other databases have some sort of support. I am not too sure how you access these but I would expect to be able to do it using SQL via JDBC. It is likely to be database specific though.
If you just mean normal SQL searching then there are a whole load of Java EE technologies, plain JDBC, Spring templates, ORM technologies (JPA, JDO, Hibernate etc). The list goes on and it would be difficult to suggest any particular approach without a lot more info.
We are using AppEngine and the datastore for our application where we have a moderately large table of information containing a list with entries.
I would like to summarize the list of entries in a report specifying how many times each one appears e.g. normally in SQL I would just use a select distinct for a column, then loop over every entry and just use select count(x) where value = valueOfEntry.
While the count portion is easily done, the distinct problem is "a problem". The only solution I could find remotely close to this is MapReduce and most of the samples are based on Python. There is this blog entry which is very helpful but somewhat outdated since it predated the reduce portion. Then there is the video here and a few more resources I was able to find.
However, its really hard for me to understand how to build he summary table if I can't write to a separate entity and I don't have a reduce stage?
This seems like something trivial and simple to accomplish but requires so many hoops, is there no sample or existing reporting engine I can just plugin to AppEngine without all the friction?
I saw BigQuery, but it seems like a huge hassle to move the data out of app engine and into that store. I tried downloading the data as CSV but ran into many issues with that as well. It doesn't seem like a practical solution in the long run either.
There is a document explaining some of the concepts of the mapreduce for java. Although it is incomplete, it shares most of the architecture with the python version. In that document, there's also a pointer to a complete java sample mapreduce app, that reads from the datastore.
For writing the results, you specify an Output class. To write the results to a new datastore entity you would need to create your own Output Class. But you could also use the blobstore (see BlobFileOutput.java).
Other alternative, is that whenever you write one of your entities, you also write/update another entry to a EntityDistinct data model.
If you plan on performing complex reports and you can anticipate all your needs now, I would suggest you to look again at Big Query. BigQuery is really powerful and works perfectly on very massive datasets. You can inspect http://code.google.com/p/log2bq/ which is a python project that loads the logs into Big Query using mapreduce. Or you could also have a cron job, that every once in a while fetches all new entities and moves them into Big Query.
Related to the friction, remember that this is a no-sql database, and as such has some advantages but some things are inherently different to SQL. Remember you can always use Google Cloud SQL, given that your dataset is of limited size, but you would loose the replication and fault-tolerant capabilities.
I think this could help you: http://jjmpsj.blogspot.ro/2008/05/appengine-output-tricks-reporting.html?m=1
I am in the process of designing a financial web page (using Java, Wicket, JQuery..) where one of the page has around 5 tables and each table has around 10-15 columns. These columns should be highly configurable that means some clients want to view/hide selected columns or some clients may want to see column name as different from other client. I want to make this page highly configurable through some XML files or some other way and I do not want to change java related code for this. Are there any APIs or tools available for controlling or configuring web page tables and columns?
DataTables
Flexigrid
Both of these are jQuery plugins that are very nice to use (I have utilized both). I believe DataTables should be able to do everything you are looking for (and quite a bit more). Check out both sites and see what you think.
For more suggestions, check out this link: 15 Great jQuery Plugins for Better Table Manipulation
I have a simple task that I feel there has to be an app out there for (or is easy to build or extend an open-source version).
I need to run a mysql query repeatedly and look for changes in the results between runs (the data is coming in in real time).
I have built several of these queries and throughout the day find myself jumping between tabs in my mysql client running them, and trying to see what has changed. This becomes difficult as there are hundreds of rows of data and you can't remember the previous values easily.
Ideally I could have a simple app (or web app) that stores the query, and refreshes over and over again. As the data is filled into the table it could compare the old results and change the color to red or green (or something).
I would need sorting, and simple filtering (possibly with string replaces into the query based on the inputs.
We run Ubuntu at work and I have tried doing this via terminal scripts (we use Ruby), but I feel a more-visual output would give me better results.
Googling around I see several for-pay apps, but there has to be something out there to do this.
I don't mind coding one up, but I don't like to re-invent the wheel if I don't have to.
Many thanks!
For simple things like this you are not reinventing the wheel as much as making your own sandwich -- some things don't make much sense to buy. Just build the simplest web page possible (e.g. a table with the table names you are interested in and maybe a timestamp for the last time it was checked. Have some javascipt run your query and color the cells based on the change you are looking for...repeating this operation as needed. I could give you more specific info if you can tell me how the data changes...more entries into a table? Updates to existing data?
I often use JDBC servlets via Tomcat for this. Here's an excellent tutorial and a very simple example.
I've done something similar in the past using Excel. Just build a connected spreadsheet, make your queries and the result will be outputed to Excel, then you format the way you like it. Very flexible, and if you need some kind of logic beyond the query itself, there are always Excel's built in functions and VBA.
Here is a useful link to help you. It is very simple:
http://port25.technet.com/archive/2007/04/10/connecting-office-applications-to-mysql-and-postgresql-via-odbc.aspx