annotate m-toolbox/m/helper/mc.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents ce4df2e95a55
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
1 % A function to properly clear MATLAB memory for LTPDA.
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
2 %
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
3 % M Hewitson 06-08-08
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
4 %
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
5 % $Id: mc.m,v 1.11 2011/02/03 13:42:43 ingo Exp $
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
6 %
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
7
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
8 % Remove this object from memory so we can clear classes
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
9 % prefs = getappdata(0, 'LTPDApreferences');
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
10 % prefs.misc.default_window = '';
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
11
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
12 % TODO: We need to close all GUIs before doing this - Prefs GUI and Repo Gui
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
13
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
14 function mc()
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
15
26
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
16 % remove preferences
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
17 try
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
18 rmappdata(0, 'LTPDApreferences');
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
19 end
0
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
20
26
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
21 % database connection manager
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
22 cm = getappdata(0, 'LTPDADatabaseConnenctionManager');
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
23 if ~isempty(cm)
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
24 % save cached credentials
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
25 setappdata(0, 'LTPDAcredentials', cm.credentials);
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
26 % remove database connection manager
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
27 rmappdata(0, 'LTPDADatabaseConnenctionManager');
0
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
28 end
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
29
26
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
30 evalin('caller', 'clear'); % delete the timer-objects
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
31 clear classes % delete the local variables
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
32 evalin('caller', 'clear classes'); % delete the variables in the caller function
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
33 evalin('base', 'clear classes'); % delete the variables in the 'base' workspace
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
34
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
35 % load the preferences again
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
36 LTPDAprefs.loadPrefs();
0
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
37
26
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
38 % instantiate database connection manager if required
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
39 credentials = getappdata(0, 'LTPDAcredentials');
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
40 if ~isempty(credentials)
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
41 cm = LTPDAConnectionManager();
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
42 cm.credentials = credentials;
0
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
43 end
26
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
44 try
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
45 rmappdata(0, 'LTPDAcredentials');
ce4df2e95a55 Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents: 0
diff changeset
46 end
0
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
47
f0afece42f48 Import.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff changeset
48 end