Skip to content

Instantly share code, notes, and snippets.

@iriyak
Last active May 28, 2025 14:51
Show Gist options
  • Save iriyak/95821a6a9f21061636cecdfd14971ed8 to your computer and use it in GitHub Desktop.
Save iriyak/95821a6a9f21061636cecdfd14971ed8 to your computer and use it in GitHub Desktop.
(LePage named: 'How to setup an environment for experiment')
addSnippet: (LeTextSnippet new
string: '# 1. Load a package';
addSnippet: (LeTextSnippet new
string: 'The file is compiled as a package and currently uploaded to gist, not as a Github repo. Download and manually import it.';
yourself);
addSnippet: (LePharoSnippet new
code: 's := ZnClient new
get: ''https://gist.githubusercontent.com/iriyak/ecd5231cd8d67172270082bc7d53f2a6/raw/ad6b9971592072ed3ed75903aaf3b076d1261e15/KIExtensionsForGToolkit4P3.st''.
CodeImporter evaluateString: s';
yourself);
addSnippet: (LeTextSnippet new
string: 'You can see a RPackage (KIExtensionsForGToolkit4P3) after successful installation.';
yourself);
addSnippet: (LePharoSnippet new
code: 'RPackageOrganizer default packageNamed: #KIExtensionsForGToolkit4P3';
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '#2. Apply a change to existing codebases';
addSnippet: (LeTextSnippet new
string: 'As of now this package needs to patch to existing codebases and I prepared a pharo rewrite snippet so that you can review each change before accepting. Two changes should be proposed. Accept changes when you''re fine to proceed.';
yourself);
addSnippet: (LePharoRewriteSnippet new
search: 'P3ClientLoginPane new';
replace: 'P3ClientLoginPane2 new';
yourself);
addSnippet: (LeTextSnippet new
string: 'Register the startup script of {{gtMethod:name=GtP3ConnectionManager class>>startUp}} to {{gtClass:name=GtSessionManager}}. ';
yourself);
addSnippet: (LePharoSnippet new
code: 'GtP3ConnectionManager initialize';
yourself);
addSnippet: (LeTextSnippet new
string: 'You can check regisration is successful. Open a singleton of {{gtClass:name=GtSessionManager}} and drill down to a ClassSessionHandler(GtP3ConnectionManager) in Prioritized List view from Network Cateogry in Categories view and double-click the record to inspect which part of the code is registered.';
yourself);
addSnippet: (LePharoSnippet new
code: 'GtSessionManager default';
yourself);
addSnippet: (LeTextSnippet new
string: 'Done! It is now ready for testing!';
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '#3. What to do first?';
addSnippet: (LeTextSnippet new
string: '##3.1. Overview';
addSnippet: (LeTextSnippet new
string: 'We first open a singleton of {{gtClass:name=P3ConfigHolder}} in a separate window. Let''s establish a PostgreSQL connection and see how book keeping goes over Configs custom view. Once enough entries are kept, we switch the database connection by clicking on "Save" button instead of interacting with {{gtClass:name=LePostgresqlLoginSnippet}}.';
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '##3.2. Inspect a singleton of P3ConfigHolder';
addSnippet: (LeTextSnippet new
string: 'Open an inspector of P3ConfigHolder class. Configs custom view shows the current configurations that the singleton holds. The view actually borrows the logic for #gtItemsView: for Dictionary and the right click allows to manipulate a key or a value of each association.';
yourself);
addSnippet: (LePharoSnippet new
code: 'P3ConfigHolder';
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '##3.3. Inspect a singleton of GtP3ConnectionManager';
addSnippet: (LeTextSnippet new
string: 'Open an inspector of GtP3ConnectionManager class. Connection custom view shows the current P3Client instance object. As GtP3ConnectionManager maintains a single connection, you can see just one record.';
yourself);
addSnippet: (LePharoSnippet new
code: 'GtP3ConnectionManager';
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '##3.3. Establish a PostgreSQL connection';
addSnippet: (LeTextSnippet new
string: 'Open a new LePage and establish a PostgreSQL connection with use of PostgreSQL snippet or PostgreSQL login snippet. You can see a name field and assign it to the set of configuration. After clicking on "Accept" button, P3ConfigHolder keeps recording.';
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '##3.4. Switch the database connection';
addSnippet: (LeTextSnippet new
string: 'Once enought entires are kept in P3ConfigHolder, let''s move to Configs view of P3ConfigHolder and click on "Save" button to switch the database connection. This operation always involving closing the existing connection and establishing a new connection with the set of configurations associated with the name selected.';
yourself);
addSnippet: (LePharoSnippet new
code: 'P3ConfigHolder';
yourself);
addSnippet: (LeTextSnippet new
string: 'The PostgreSQL snippet and PostgreSQL login snippets refer to the same P3Client that was given by GtP3ConnectionManager and hence the change is spread across snippet. In other words globally.';
yourself);
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '#4. Roll back the changes to the original state';
addSnippet: (LeTextSnippet new
string: 'The below snippet aims to roll back to the original state for th existing codebase. The search actually hits a method found in {{gtPackage:name=KIExtensionsForGToolkit4P3}} which is not supposed to replace, but go ahead. That package will be anyway removed as part of rolling back.';
yourself);
addSnippet: (LePharoRewriteSnippet new
search: 'P3ClientLoginPane2 new';
replace: 'P3ClientLoginPane new';
yourself);
addSnippet: (LeTextSnippet new
string: 'Close all the LePages that contain PostgreSQL snippet or PostgreSQL login snippets. It refers to the instance of P3ClientLoginPange2. There is no need to remove these snippets from the LePage. Closing the page is sufficient.';
yourself);
addSnippet: (LeTextSnippet new
string: 'Unregister the startup script of {{gtMethod:name=GtP3ConnectionManager class>>startUp}} from {{gtClass:name=GtSessionManager}}. ';
yourself);
addSnippet: (LePharoSnippet new
code: 'GtSessionManager default unregisterClassNamed: GtP3ConnectionManager';
yourself);
addSnippet: (LeTextSnippet new
string: 'Remove the installed package from the System.';
yourself);
addSnippet: (LePharoSnippet new
code: '(RPackageOrganizer default packageNamed: #KIExtensionsForGToolkit4P3) removeFromSystem';
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '#In Closing';
addSnippet: (LeTextSnippet new
string: 'That''s all of the current progress.';
yourself);
addSnippet: (LeTextSnippet new
string: 'Hopes you enjoy exploring data analysis (EDA) with PostgreSQL snippet and PostgreSQL login snippet!';
yourself);
addSnippet: (LeTextSnippet new
string: '';
yourself);
yourself);
addSnippet: (LeTextSnippet new
string: '';
yourself);
yourself
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment