How to hide Temporary tables in PgAdmin 4 - database

In our project we have a long list of Temporary schemas being created in the DB.
I have to scroll through the whole list of Temporary schemas and then reach the one on which I am working.
Deleting or removing the schema is not under my control.
I have tried the documentation where it stated in Preference -> Browser -> Display -> Show system objects? switch is set to True, the client will display system objects such as system schemas (for example, pg_temp) or system columns (for example, xmin or ctid) in the tree control.
Thus I marked it as False but still I am able to see the list of Temporary tables.
Refreshed the connection also.
Is there any other way to hide the same? Or did I missed something?

In the current version, you can look under
Preferences > Browser > Display > Show system objects ?
The documentation says:
When the Show system objects? switch is set to True, the client will
display system objects such as system schemas (for example, pg_temp)
or system columns (for example, xmin or ctid) in the tree control.
So this will hide them. However, if you want to hide only the temp schemas an nothing else, you could mess with the exposed pgAdmin object that's available in the browser as a global object.
I've created a hack implementation. Feel free to try this, but use it at your own risk, I accept no liability if you lose any data or code.
schemaQuery = window.prompt('Type a string to remove schemas containing this substring:')
function closetemp(ns){
ns.forEach(n=>{
if(n._metadata.data._type == 'coll-schema'){
n._children.forEach(s=>{
if(s._fileName.indexOf(schemaQuery)!=-1){
pgAdmin.Browser.tree.remove(s)
}
})
}
if(n._children!=null){
closetemp(n._children)
}
})
}
closetemp(pgAdmin.Browser.tree.children())
Run that in the browser console and a box will pop up. Type "_temp_" and it will remove every schema containing the string "_temp_" form the browser tree.
It crawls the tree, finds the schemas, and removes the nodes from the tree. It might cause errors I am unaware of, but if you refresh the tree from the menu the temp schemas (or whatever schemas match your string) will appear again.
You could create a bookmarklet and save it so that you don't have to open the browser console. If you save this as a bookmark and set this as the URL, it will remove temp tables when you click on it:
javascript:(()=>{function%20closetemp(ns)%7B%0A%09ns.forEach(n%3D%3E%7B%0A%20%20%20%20if(n._metadata.data._type%20%3D%3D%20'coll-schema')%7B%0A%20%20%20%20%20%20n._children.forEach(s%3D%3E%7B%0A%20%20%20%20%20%20%20%20if(s._fileName.indexOf('_temp_')!%3D-1)%7B%0A%20%20%20%20%20%20%20%20%20%20pgAdmin.Browser.tree.remove(s)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D)%0A%20%20%20%20%7D%0A%20%20%20%20if(n._children!%3Dnull)%7B%0A%20%20%20%20%09closetemp(n._children)%0A%20%20%20%20%7D%0A%20%20%7D)%0A%7D%0Aclosetemp(pgAdmin.Browser.tree.children())})()

Related

How to change columns in a SharePoint external content type without screwing everything up?

SCENARIO 1:
I have a SQL Server stored procedure that returns rows/columns. Then in SP Designer (SPD) I create an external content type (ECT) and push to Central Admin (CA). In CA, I assign permissions. On the site, I create an External List (EL) and can view my data. All good.
I change a column name from "Vendor Name" to "Vendor in the procedure. Now I go into SPD to alter the ECT and SOMETIMES it cannot be opened, giving an error:
"The BDC Service application Business Data Connectivity Service is not accessible. The full exception text is: Xml type 'List of xdt:untypedAtomic' does not support a conversion from Clr type 'Guid' to Clr type 'String'."
I didn't see what that had to do with my changes. Undoing my change to the procedure didn't resolve it. I had to delete the ECT and ET and recreate them. However, it sometimes happened again.
SCENARIO 2
While testing to see if it happened again, I discovered it sometimes did not. I had different problems.
After renaming the field in the proc, I went into SPD and successfully opened the ECT and made changes, pushing it CA. In CA, I discovered all permissions had been removed. This is a problem. Why does this happen? How to avoid?
So I redo permissions, then go to the site, where two different "sub" problems occur.
SCENARIO 2 A
The External List is broken and cannot be viewed or updated to show the new column name. I have to delete the list and recreate it. This obviously kills any views and removes it from every page where it was, etc., or anything referencing it. This is a nightmare. How to avoid this? I thought of one way, leading to....
SCENARIO 2 B
Instead of creating an External List, I edited a web page, added a Business Data List (BDL) web part and added my ECT to it. Everything was fine. I then purposely renamed a column in the proc again, opened SPD and (this time) was able to open the ECT, updating the field name. I pushed to CA. All permissions were removed (sigh). I re-added them. Then I went to my web page with my BDL, which was broken. I edited the web part and was able to update it so that data appeared onscreen.
BUT, the old "Vender Name" field was missing (no surprise as I'd renamed it). But the new "Vendor" field was also missing. In the BDL web part, I edited the view, discovering to my surprise that NEITHER field was in the list of fields that could be added to the view. In SPD, I opened the ECT to verify the new field was there (it was). No amount of pushing the ECT to CA, redoing permissions, and editing the BDL resulted in the new field appearing. Then, finally, somehow, the new field appeared onscreen without me ever adding it to the BDL view - caching issue?
THE QUESTION
So now I'm left with two questions:
1. Can you use a External List and avoid the problem above?
2. Why do permissions disappear every time the ECT is updated and how to prevent this?
Thanks.
for Scenario 1: Sharepoint is not cool with the "GUID" datatype. Before committing the change to your ECT, breadcrumb back one level to the ECT (sharepoint will alert you if you're going "too far back" and might lose your changes) and check the datatypes that sharepoint has assigned to each field, if you notice any GUID datatypes, you may have to manually coerce them to varchar in your view/proc and close/reopen the ECT.
Scenario 2: This is likely a timing issue and has happened to me before. What happened is that you created you ECT in designer and saved it, then went to CA to set permissions. if you had no reason to re-update your ECT you would have been all good. But the problem was that you needed to make a change AFTER setting the permissions but probably had left the newly created ECT open in designer. So what you have to do is this - after setting the permissions in CA, DO NOT SAVE ANY CHANGES TO THAT ECT UNTIL YOU VERIFY THAT YOU SEE THE PERMISSIONS YOU SET IN CA IN DESIGNER (this is the box in the upper right). This is the problem : SP designer doesnt let you SET permissions but will HAPPILY override them when saving, so if you see no permissions in designer, then saving that ECT will "reset" the permissions to empty. After setting permissions in designer, you have to wait/refresh (sometimes close and re-open the ECT) the ECT in designer until you see the permissiosn there as well.
Scenario 2B: often making changes to ECTs have to let them "propagate" through to the site (this is just how I envision it, i didnt read this). After making changes I've seen my ECTs break completely (you'll get a correlation ID error that wont be useful) or just not seeing my changes. The solution is "Smoke if ya got em". I usually wait at least 10 minutes after making an update until I start being concerned if the ECT is broken, not displaying my change, etc.
Hope this helps!

extjs: How to persist the state of an application

Let's say I have a panel/window containing a search form and tab(s) containing the search results.
Ideally the entered search values and the grid would be in the same state (e.g. sorted) when the user reloads the page.
I've seen the providers (cookie and local storage), but I am not sure how to go about it.
Do I have to wire every single control to the stateManager? Or is there a global way of persisting "everything"?
I believe state manager will write only position, size etc. But if you need to save content of textboxes, database filters - I'm afraid you will have to write something yourself.

How can I generate counts for items with differing view permissions in my database without being inefficinet?

My web-app has a media upload facility which associates each uploaded media item with a collection of media items (for simplicity we'll just refer to each group of media items as an album, though the encompassing entity for media items is not as simple a structure). Each of these "albums" has the potential to have custom viewability settings which specify who can view the album (a la Facebook).
I'm trying to generate a count of media items uploaded by a user for display on the user's front page.The problem is, I can't figure out a way to do this without perusing through the data of all the "albums" (in essence, its doing the same amount of work required to collect the viewable albums).
If all the albums had the same viewability settings, I could just maintain a count of the media items and manipulate it on upload & deletion. Since they can potentially all have different viewability settings, however, I have to check the viewability permission of the viewer for each "album" to make sure its media items can be included in the count that will be displayed to him.
Consider Facebook:
Upon looking at a user's profile, you can see a count of photos uploaded by the user. Presumably this count is of all photos you're allowed to view, and not the total count of the user's photos. If this is true, it would be inefficient to peruse through all the album database rows (and rows in other tables, such as those containing the "Lists" of allowed viewers) just to generate a count; you still have another click to get to the page where you can view the photos (where a permission verification process will have to be completed again)!
Is there something I'm missing, or is this now sites handle items like these? Perhaps the process is completed the first time and the viewable albums are cached for subsequent use?
I don't know about Facebook, but... Unless you're doing something extremely complicated with the permissions, if you have a well-normalised database and properly set up indices, the join should not be that slow. Can you show the relevant schemata?
After momentarily blocking a friend from viewing some of my photos, then viewing the profile as him (using the "View as" option) at the top-right corner, it appears as though the photo count doesn't change. In other words, the count is the value of all the photos uploaded by the user, regardless of the privacy settings on each.
I'd be grateful if anyone could confirm this.

Show custom object in related list under page layout

I have been trying this whole day but cant figure out... I have custom object called Dev which has many to many relationship with Accounts... I want this object Dev to show under related list of page layout of account... But it is not showing there how can i add that to related list?
Assuming you have a lookup relation from Account to Dev and also a lookup from Dev to Account (creating your many-to-many), then this will work fine.
Try re-creating your lookup relationship from Account to Dev. Then make sure that you add the related list and add to the page layouts in steps 5 & 6:
Step 5. Add reference field to Page Layouts (Yes to All)
Step 6. Add custom related lists (Yes)
That's all you need. If, however, your many-to-many relationship is unique or otherwise configured differently (with a junction table, for example) then the above may not work for you.
We always tend to use joining objects for these relationships, obviously you can show the list of joining objects as a related list, and you could display other fields from the dev object by use of formulae.
One thing we've tended to do is create an inline VF page which can then show all of the objects related to the current record.

Loading dropdownlists

what is the best way to load dropdown lists from reference/lookup tables for a desktop application?
the application is layed out into 3 tiers. I've built up my entities.
the front end has a form with 6 tabs. and one big save (another discussion :)
Should I load them all when the form is initially loaded? Are there any caching mechanisms I could use?
it is vb.net app on a network drive that is accessed by several users.
it's also worth noting that some reference tables may be updated. Via another form.
thanks
T
Lots of factors. One you need to populate in constructor so the data is there to populate the visual elements. Beware that just because a tab is not visible does not mean it is not loaded when you app starts.
For a static list of strings
public class Library : INotifyPropertyChanged
{
private List<string> dropDown1;
public List<string> DropDown1 { get { return dropDown1; } }
public Library()
{
// use data reader to populate dropDown1
}
}
I know this will get comments that can use something lighter than a List but List has a lot of nice features, easy syntax, and easy to populate. As a next step you could structure as a client server and use some static so the list is populated once and then shared by all. If you have more properties then substitute string with a class. For a dynamic list then in the get you grab the current data from the table on demand. In your get you could hold on to the last list and if the next request is within X seconds then return stale data. It depends on if stale data is acceptable.
There are many other approaches and I do not pretend this is the best. Just putting out a relatively simple example to get you started.
When it gets to hierarchical then things get a little more complex. There you can use ADO.NET table to store the static dependent data and then apply a filter on a view.
If its a web page you don't have to load all tabs on page load.
Desktop i think it will be more easy and it should be like that.
Only when the user click on the tab show the page and hide all the pages
associated for other tabs.
i hope all tab pages values will be on session so that user can go and come back to any tab and your Big Save at last.
Something useful related to your question i found here
http://www.syncfusion.com/FAQ/windowsforms/faq_c93c.aspx
and one more

Resources