linking gwt combobox with database - database

I created a gwt app with a gxt combobox. I have it where it pulls data (a list of names apprx 5000) from the database places it in an array which in turns places it in a store. That is then placed in the combobox using set store, so when a user starts typing in the combo it searches through the store for the name. My question: is this the best way to do this or is there another method.

How is the performance loading that list of 5000 names? Does it take a long time to load your page? You may want to think about loading them as you need them so that the gui loads faster.
This article suggest 'lazy loading' gui components
http://googlewebtoolkit.blogspot.com/2008/11/improving-performance-with-on-demand.html
How have you pulled down the list? I assume is via RPC, have you used a Data Transfer Object?, XML?
This link talks about options for serialization http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
Michael

Related

Approach for building a Gallery of images (ParentalKey vs StreamField)

I'm trying to decide between using ParentalKey or StreamField, in this case, with the purpose of adding an image gallery to a page.
We don't need any other information than the image itself (given that the image will be anyway a wagtailimages.Image model's instance, so the alt text is already handled there).
Any thoughts on what is better to make it easier for the editor to work even if maintaining around 50 images per page?
And about good practices and code maintainability?
Would you prefer a third party package for the image gallery? (even if that blocks you from upgrading to wagtail 4?)
Would your opinion change if instead of a single image, we needed some more fields?
Many thanks!
For an image gallery, the first recommendation would be to use the Collections feature. You can get pretty far with the nested collection system and even add extra meta data if needed by adding a model that relates to the collection.
If that is not suitable, ParentalKey/InlinePanel would be my next pick. For simple relationships you get all the benefits of StreamField such as re-ordering, add/remove items but with solid database integrity and usage stats working out of the box.
Only go to StreamField if you need to have optional data set against each image. For example if you have an image list but images could be an Image with a RichText OR just an image.
Unfortunately, managing large sets of images is not great (outside of collections) so you may find you need to build a seperate UI for this. If that ends up being the case you will find migration of data already in model relations being easier to do or maybe not even needed with something like ModelAdmin.
Hope it goes well, be sure to write a blog post about what you end up doing.
I would use the ParentalKey with InlinePanel for that. It shows you all the images as a list in a more compact way than the StreamField. One can reorder this list.
A StreamField is more expandable in the future. You could add new blocks, like videos or quotes or whatever at any point. If you define each block as StructBlock, you will be able to add whatever you want in the future to these blocks without loosing existing data (also true for the ParentalKey model).
I would not use Collections for image slideshows as you won’t be able to sort the imagas in a collection via the CMS, right? Collections are meant to keep order in the backend, I think.

Excel like copy paste feature for adding data into grid using react and grid library

I am creating a kind of excel online application using react in frontend, Java in backend and Postgres database.I am using a library called ag-grid (community edition).
Now one of the feature i need is to copy and paste data in to rows
just as we do in excel.
The grid is going to be linked with the Postgres, all the data in the table in the DB is displayed into the grid and any change made into the grid will be reflected to the DB and vice-versa.
The specific need is, i need copy and paste feature, i need to paste the data which is, say copied from other excel in to my application. I should be able to create blank rows and i should be able to paste the data into those rows, if the blanks rows are less then it rows should get automatically added(as in excel) as soon as data (say multiple rows data) is pasted into a one or more rows.And when i choose to save the my application then data of grid should be saved to DB.
Is it possible to create this feature using ag-grid community ?
Is there any other library which is recommended for this purpose ?
If there is any resource or documentation available for this feature
then please point me.
Just in case if anyone stumbles upon this problem, I've found a solution from some another website. It uses processDataFromClipboard event of Ag Grid for a custom solution.
https://plnkr.co/edit/lM3OtCQxpJdapHQt?preview
The ag-grid community edition does not support CRUD operations with a server side model - the enterprise edition does:
https://www.ag-grid.com/javascript-grid-server-side-model-crud/
If you insist on using ag-grid community you will need to handle the editing/grid changes yourself, which should not be too hard. A good starting point would be the cell editing page:
https://www.ag-grid.com/javascript-grid-cell-editing/
In particular, you will need to listen to the cellValueChanged or rowValueChenged event:
https://www.ag-grid.com/javascript-grid-cell-editing/#event-cell-value-changed
The event params will provide you with the following properties:
newCalue
oldValue
column
colDef
which you can use to generate the update call.

Creating a Android catalog

Anyone seen an android app created with App Inventor that is a catalog?
I want to create app with a static DB, when a user selects a number it will display the item name, details about the item and image of that item.
I suggest this easy way if you're a beginner at programming in general and you know a bit of HTML and Javascript.
Have your database in JSON, most database management systems will export your tables in JSON format.
And here is how to insert your javascript in App inventor
http://puravidaapps.com/javascript.php
Using a javascript library will make the process even easier.
Let me suggest to store your data in a csv file. Just add it as asset into your project and import it using the File component. Your catalog could be displayed using a listpicker component.
Start doing the tutorials to learn the basics of App Inventor. Also take a look at How to work with Lists by Saj
How to work with Lists and Lists of lists (pdf) by appinventor.org
My suggestion would be to use a list stored in an online database like firebase or a custom tinyWebDB. That way you can change the items, their prices, descriptions without having to build the app all over again. As a bonus, you could use that database to track purchases. If by static DB you mean a database on the device like tinyDB, I would still recommend using lists because they are so easy to work with.
You could have 3 paired lists. One list could be for images, one for the description, and one for the name. Then when a user picks the item number, say 3, you display item 3 of names, item 3 of descriptions, and item 3 of images.

Storing settings on the database for a web app?

I'm developing an open-source web application (a helpdesk) where the users will download it and install. This application will have some settings like: title, colors, default e-mail, logs... (for example). This settings will be edited by the user on the admin panel because most of them will not understand how to do it in code.
My question is what is the best way to store this on a (MySQL) database model? And counting that this application will upgrade and add more "settings" to that settings table.
Thank you in advance
There are a lot of different ways to do this, and it depends on what you think the final needs will be.
There's nothing wrong with saving parameters in a dedicated table, each parameter/user/value on a separate row. This is a fast way to set and get the information, and allows you to easily get access to reports by parameter and value and user, for example, what colors are the most popular.
If you are just using this for configuration, you can store the parameters as an XML or JSON string in a text/blob field. This has the benefit of giving you a single load to get all of the parameter values. Even more powerful, if your application already has default values for the parameters, you can easily extend the application without changing the database records. For a large number of parameters, this reduces the number of DB calls to load up all the parameters.

Need some WinForms and DataSet advice

Here's the story: I've been working on putting together an app in VS10 using Windows Forms in C++. This is my first experience with winforms, although I have a fair amount of experience with C++ and have worked with MFC a bit. The program needs to aquire data input from a hardware measurement system and the backend for that is mostly worked out. What I've been a bit stuck on is how to easily work with displaying this data in forms with the DataGridView and Chart objects. I'd also like to be able to save various sets of data and the programs current settings to disk that can be easily recalled and displayed in the program at a later point.
The solution I've been attempting so far has been to create a DataSet object for a certain program instance which holds some DataTables for the data and current settings. This is easily saved and read to XML files using the DataSet methods, which is nice. The tricky part for me using this method has been trying to sync up the program's display data and settings in the DataGridViews and Charts. It seems like these controls are really meant to be designed through the GUI. Maybe I'm just a noob, but I couldn't figure out how to get the DataSet I designed to link with my Charts using the "Add Project data source" dialog, so instead I set up a bindingSource and then proceeded to set Chart settings manually in the code. That's been getting hairy pretty quickly.
What would you have done to implement this, and how would you advise proceeding? I'm sure there has to be a much simpler way of doing this.
I've used Microsoft Chart Controls to display data from hardware measurement systems before with good results.
We store our data separately in arrays and when we want to display something, just call the AddXY function on the items to add a point. Configuring the graph in the first place is more easily done in designer though. Have a look at the samples for more info.

Resources