Users certainly should not be able access Ens_Config.Credentials table, maybe some user has permissions too broad?

What you can do additionally is to store credentials in a separate SECONDARY database. When you create a new interoperability namespace (in non HS installs), it should be created automatically. Still, you can manually create this DB and related mappings by calling CreateNewDBForSecondary.

After creating secondary db, check that no one has R on DB resouce.

Additionally you can encrypt the db file.

Sure. There are two ways:

1. Switch to another namespace to execute your query:

/// Get a list of all mirrored databases as a $lb()
ClassMethod GetMirroredDBs() As %List
{
    new $namespace
    set $namespace = "%SYS"
    set sql = "SELECT LIST(Name) dbs FROM Config.Databases_MirrorDatabaseList()"
    set rs = ##class(%SQL.Statement).%ExecDirect(,sql)
    do rs.%Next()
    set dbs = $lfs(rs.dbs)
    kill rs
    quit dbs
}

Now you can have this method in USER namespace and it would automatically swith into %SYS, execute query, iterate over the results, write results into a local variable, switch back into USER namespace and return the value back to you.

The main thing you need to remember is that result set iteration MUST happen in a target namespace.

2. Map classes and globals to your namespace. Docs. Table would be available as if it was created in your original namespace.

What are recommend habits inside and outside, during you own time and during your work time, to be focused during you coding session and daily tasks?

 

My habit/advice/etc. and something that really helped me is a sincere acceptance of the fact long uninterrupted stretches of time do not exist. 

Stop trying to carve out an entire week for a new product feature or a day to prepare a perfect demo. The best you can get is half an hour between meetings.

After I accepted that, planning and accomplishing work (and anything else really) became much more manageable. And much less frustrating as I don't expect to complete any task uninterrupted by something else. 

To do that, first, I split any task into 15-minute-to-half-hour chunks. For example, if I'm writing code, first I just create stubs for all the parts (usually methods and classes), beginning to end, even if I don't know how they should be implemented. Each method is one or several chunks. After that, I start on a chunk: implementing one method I know for sure. If I have no idea how anything works at all, I'll implement invocation arguments/objects and so on. If still no idea: split one chunk into several and try again.

It works out for almost everything. Writing articles, I first write a title and a list of sections. Usually, I have ten or more of these stubs lying around, and then inspiration strikes me - why not fill one section? Or several if there's time. 

 

Another trick is leaving the day's last item unfinished. When I'm close to eob and actually see how to complete something, I often leave it as a task to start the next day. This way, I know where to start and what to do in the morning. And I can score a win pretty much immediately. 

Say you have this query:

SELECT a, b, c
FROM mytable
WHERE d=1 AND e=2

If you want to change fields in SELECT or WHERE, you'll need to rewrite your query by adding or removing it's parts. Source control diff would also show a whole line change.

But if you write it like this:

SELECT 1
  , a 
  , b 
  , c
FROM mytable
WHERE 1=1
      AND d=1 
      AND e=2

You can comment out any field or condition simply by adding --:

SELECT 1
  --, a 
  , b 
  , c
FROM mytable
WHERE 1=1
      --AND d=1 
      AND e=2

when you have a lot of conditions and need to iterate fast, this way of writing queries is much better for debugging and source control since diff is always contianed to the one line you edit.

Ens, EnsLib and EnsPortal are system packages, developes can subclass them.

To get class count call something like this:

SELECT 
  count(ID)
FROM %Dictionary.ClassDefinition
WHERE 1=1 AND
      System = 0 AND 
      NOT (Name %STARTSWITH '%' OR 
           Name %STARTSWITH 'Ens.' OR 
           Name %STARTSWITH 'EnsLib.' OR 
           Name %STARTSWITH 'EnsPortal.' OR 
           Name %STARTSWITH 'HS.' OR 
           Name %STARTSWITH 'SchemaMap')

Missing: SQL way to filter out mapped classes.