MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Fedora 30 Missing Library

without comments

Having run into an obsolete library issue installing Oracle Database 18c XE on Fedora, Version 30, I opted to revert my student image to Oracle Database 11g XE. The installation went without issue but when I tried to log into SQL*Plus as the oracle user, I got the following error message:

sqlplus: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

The libnsl.so.1 library is no longer installed as part of the distribution for Fedora 28 forward but you can install it with the yum tool, like:

yum install -y libnsl

If you attempted to run the oracle-xe utility to configure the database prior to adding this library, it fails to provision the instance without a message. You won’t get the message until you manually try to connect as the sysdba privileged user. At that point, you’ll determine the instance wasn’t provisioned.

You can see that the installation failed when the oracle-xe utility fails to print the following lines to the console after the options are entered:

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

After installing the missing library, the oracle-xe utility works correctly. Alas, it looks like I’ll never bother to sort the Oracle Database 18c XE issues because after this version of the image we are moving the courses to a PostgreSQL database. PostgreSQL offers the smaller footprint that supports the core learning objectives of the courses.

As always, I hope this helps those looking for a solution.

Written by maclochlainn

August 11th, 2019 at 9:29 pm

Fedora 30 Install Chrome

without comments

While building the new Fedora 30 Linux instance for my students, I needed to install the Google Chrome browser. Here are the instructions for installing the Chrome browser.

  1. As the root user, create the google-chrome.repo file in the /etc/yum.repos.d directory with the following information:

    [chrome]
    name=google-chrome
    baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
    enabled=1
    gpgcheck=1
    gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
  2. Next, use the yum utility to install the Chrome browser:

    yum install -y google-chrome

    You should see the following log information:

  3. Click the following “f” icon in the lower left corner to bring up the Application Launcer:

    It raises the Application Launcher dialog:

    Enter Chrome inside the search field and it launches the Chrome browser:

As always, I hope this helps those trying to do the same thing.

Written by maclochlainn

August 9th, 2019 at 11:56 pm

Posted in Chrome,Fedora,Linux

Add user as sudoer

without comments

Somebody asked why adding a user to the wheel group in didn’t enable them as a sudoer, as qualified in my earlier Fedora post. The reason is that you also need to modify the primary group in the /etc/passwd file to specify the Group ID value for the wheel group as the primary group of the designated student user.

You can identify the Group ID with the following command:

cat /etc/group | grep wheel

It should return the following for the wheel group:

wheel:x:10:student

You need to check the target student user in the /etc/passwd file, which you can do with the following command:

cat /etc/passwd | grep student

It should return the following for the student user, which has a default group value equal to the user of the same name:

student:x:1000:1000:Student:/home/student:/bin/bash

As the root user, edit the /etc/passwd file to correct the student user’s primary group ID, as follows:

student:x:1000:10:Student:/home/student:/bin/bash

You should see the following two lines. If you want authorized sudoers to provide a password (recommended), then modify the first line by removing the # comment. If you don’t want authorized sudoers to provide a password, modify the second line by removing the # comment. Open the /etc/sudoers file with vi or gedit if you’d like a GUI editor.

# %wheel     ALL=(ALL)      ALL
# %wheel     ALL=(ALL)      NOPASSWD: ALL

Hope this helps. It’s a quick update for Fedora 30, you su to root and add your user to the sudoers list with the following syntax:

usermod someusername -a -G wheel

By the way, don’t forget to log off and then back on to the account.

Written by maclochlainn

June 12th, 2019 at 1:03 am

Posted in Fedora,Linux,Unix

Tagged with ,

Find files with errors

without comments

My students wanted a quick solution on how to find the log files that contain errors. That’s a simple line of code in Linux if you want any Oracle errors that start with ORA-:

find $HOME/lab2 -type f | xargs grep -i ora\-

It takes only a moment more to look for errors starting with ORA- or PLS-, like:

find $HOME/lab2 -type f | xargs grep -i -e ora\- -e pls\-

The latter might return something like this:

contact_lab.txt:ORA-00904: "MEMBER_LAB_ID": invalid identifier 
contact_lab.txt:ORA-00942: table or view does not exist 
contact_lab.txt:ORA-00942: table or view does not exist 
member_lab.txt:ORA-02264: name already used by an existing constraint 
member_lab.txt:ORA-00955: name is already used by an existing object

You can improve the error identification by identifying line numbers by adding -n option, like:

find $HOME/lab2 -type f | xargs grep -in -e ora\- -e pls\-

The latter might return something like this when there are two or more files:

contact_lab.txt:76:ORA-00904: "MEMBER_LAB_ID": invalid identifier 
contact_lab.txt:150:ORA-00942: table or view does not exist 
contact_lab.txt:157:ORA-00942: table or view does not exist 
member_lab.txt:75:ORA-02264: name already used by an existing constraint 
member_lab.txt:149:ORA-00955: name is already used by an existing object

Unfortunately, the command raises an error when there aren’t any files found of with a qualified extension. It also fails to prepend the file name when there’s only one qualified file name. As a result of these deficiencies, I’ve written the following Bash shell script. I’ve opted to call it the .findErrors.bashrc file name and deploy it in the user’s $HOME directory.

#!/bin/bash
 
  # Assign any file filter to the ext variable.
  ext=${1}
 
  # Assign the extension or simply use a wildcard for all files.
  if [ ! -z ${ext} ]; then
    ext="*.${ext}"
  else
    ext="*"
  fi
 
  # Assign the number of qualifying files to a variable.
  fileNum=$(ls -l ${ext} 2>/dev/null | grep -v ^l | wc -l)
 
  # Evaluate the number of qualifying files and process.
  if [ ${fileNum} -eq "0" ]; then
    echo "[0] files exist."
  elif [ ${fileNum} -eq "1" ]; then
    fileName=$(ls ${ext})
    find `pwd` -type f | grep -in ${ext} -e ora\- -e pls\- |
    while IFS='\n' read list; do
      echo "${fileName}:${list}"
    done
  else
    find `pwd` -type f | grep -in ${ext} -e ora\- -e pls\- |
    while IFS='\n' read list; do
      echo "${list}"
    done                                                                                                                                                   
  fi

You can modify the errors() function with or without a file extension to identify errors beginning with ORA- or PLS- in their log files. As always, I hope this helps those looking for a solution.

Written by maclochlainn

May 21st, 2019 at 8:04 pm

Convert JSON with PHP

without comments

Sometimes I get poorly thought or just naive questions. That is naive questions because they didn’t read the documentation or don’t understand the semantics of a given programming language. The question this time said they tried to implement what they found on a web page but their sample json_decode function example failed after they followed directions.

Surprise, it didn’t fail because they followed directions. They overlooked part of the example because they didn’t understand how to read a nested array in PHP. The actual example sets up an array of JSON objects, then print_r to read the Array, but the student tried to read it in a foreach loop. Naturally, their sample program raised an error because the base object was an Array not a String, and their target JSON object was nested inside the base Array.

I rewrote the example file to simply convert a JSON structure to an associative array, as follow:

<?php
  // Assign a JSON object to a variable.
  $someJSON = '{"name":"Joe","moniker":"Falchetto"}';
 
  // Convert the JSON to an associative array.
  $someArray = json_decode($someJSON, true);
 
  // Read the elements of the associative array.
  foreach ($someArray as $key =--> $value) {
    echo "[" . $key . "][" . $value . "]";
  }
?>

When you call the program, like this

php test.php

It displays

[name][Joe][moniker][Falchetto]

As always, I hope this helps those looking to display a JSON structure in PHP.

Written by maclochlainn

May 6th, 2019 at 8:45 pm

Posted in JSON,PHP,Uncategorized

Chrome on Fedora 27

without comments

Installing Chrome wasn’t as easy just running the yum utility. You need to download it from the following website.

https://www.google.com/chrome/browser/desktop/index.html

When you try to use the rpm utility to run it, you’ll get the following errors:

warning: google-chrome-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
error: Failed dependencies:
        /usr/bin/lsb_release is needed by google-chrome-stable-74.0.3729.131-1.x86_64
        libappindicator3.so.1()(64bit) is needed by google-chrome-stable-74.0.3729.131-1.x86_64
        liberation-fonts is needed by google-chrome-stable-74.0.3729.131-1.x86_64

The failure points to three missing libraries:

  • lab_release
  • libappindicator3.so.1
  • liberation-fonts

While the error message indicates you’re missing the libappindicator3.so.1 library, the required library is actually the libappindicator-gtk3 library. You can use the yum utility to install the required library from the repository as the root user.

The library you need is actually in the repository as libappindicator-gtk3. You can use the yum utility to install the required library.

yum install -y libappindicator-gtk3
Last metadata expiration check: 1:04:24 ago on Sat 04 May 2019 05:34:34 PM MDT.                                       
Dependencies resolved.                                                                                                
======================================================================================================================
 Package                             Arch                  Version                        Repository             Size 
======================================================================================================================
Installing:                                                                                                           
 libappindicator-gtk3                x86_64                12.10.0-16.fc27                fedora                 41 k 
Installing dependencies:
 libdbusmenu-gtk3                    x86_64                16.04.0-4.fc27                 fedora                 38 k
 libindicator-gtk3                   x86_64                12.10.1-11.fc27                fedora                 67 k
 
Transaction Summary
======================================================================================================================
Install  3 Packages
 
Total download size: 147 k
Installed size: 382 k
Downloading Packages:
(1/3): libdbusmenu-gtk3-16.04.0-4.fc27.x86_64.rpm                                      63 kB/s |  38 kB     00:00    
(2/3): libappindicator-gtk3-12.10.0-16.fc27.x86_64.rpm                                 65 kB/s |  41 kB     00:00    
(3/3): libindicator-gtk3-12.10.1-11.fc27.x86_64.rpm                                    93 kB/s |  67 kB     00:00    
----------------------------------------------------------------------------------------------------------------------
Total                                                                                 145 kB/s | 147 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1 
  Installing       : libindicator-gtk3-12.10.1-11.fc27.x86_64                                                     1/3 
  Running scriptlet: libindicator-gtk3-12.10.1-11.fc27.x86_64                                                     1/3 
  Installing       : libdbusmenu-gtk3-16.04.0-4.fc27.x86_64                                                       2/3 
  Running scriptlet: libdbusmenu-gtk3-16.04.0-4.fc27.x86_64                                                       2/3 
  Installing       : libappindicator-gtk3-12.10.0-16.fc27.x86_64                                                  3/3 
  Running scriptlet: libappindicator-gtk3-12.10.0-16.fc27.x86_64                                                  3/3 
  Verifying        : libappindicator-gtk3-12.10.0-16.fc27.x86_64                                                  1/3 
  Verifying        : libdbusmenu-gtk3-16.04.0-4.fc27.x86_64                                                       2/3 
  Verifying        : libindicator-gtk3-12.10.1-11.fc27.x86_64                                                     3/3 
 
Installed:
  libappindicator-gtk3.x86_64 12.10.0-16.fc27                  libdbusmenu-gtk3.x86_64 16.04.0-4.fc27                 
  libindicator-gtk3.x86_64 12.10.1-11.fc27                    
 
Complete!

While the error message indicates you’re missing the lab_release library, the required library is actually the redhat-lsb-core library. You can use the yum utility to install the required library from the repository as the root user.

yum install -y redhat-lsb-core
Last metadata expiration check: 1:30:39 ago on Sat 04 May 2019 05:34:34 PM MDT.
Dependencies resolved.
======================================================================================================================
 Package                                Arch               Version                          Repository           Size
======================================================================================================================
Installing:
 redhat-lsb-core                        x86_64             4.1-36.fc27                      fedora               42 k
Installing dependencies:
 at                                     x86_64             3.1.20-6.fc27                    fedora               79 k
 mailx                                  x86_64             12.5-25.fc27                     updates             258 k
 ncurses-compat-libs                    x86_64             6.0-14.20170722.fc27             updates             321 k
 redhat-lsb-submod-security             x86_64             4.1-36.fc27                      fedora               20 k
 spax                                   x86_64             1.5.3-10.fc27                    fedora              212 k
 
Transaction Summary
======================================================================================================================
Install  6 Packages
 
Total download size: 932 k
Installed size: 1.9 M
Downloading Packages:
(1/6): redhat-lsb-submod-security-4.1-36.fc27.x86_64.rpm                               24 kB/s |  20 kB     00:00    
(2/6): redhat-lsb-core-4.1-36.fc27.x86_64.rpm                                          48 kB/s |  42 kB     00:00    
(3/6): at-3.1.20-6.fc27.x86_64.rpm                                                     80 kB/s |  79 kB     00:00    
(4/6): spax-1.5.3-10.fc27.x86_64.rpm                                                  554 kB/s | 212 kB     00:00    
(5/6): mailx-12.5-25.fc27.x86_64.rpm                                                  1.1 MB/s | 258 kB     00:00    
(6/6): ncurses-compat-libs-6.0-14.20170722.fc27.x86_64.rpm                            903 kB/s | 321 kB     00:00    
----------------------------------------------------------------------------------------------------------------------
Total                                                                                 479 kB/s | 932 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1 
  Installing       : mailx-12.5-25.fc27.x86_64                                                                    1/6 
  Installing       : ncurses-compat-libs-6.0-14.20170722.fc27.x86_64                                              2/6 
  Running scriptlet: ncurses-compat-libs-6.0-14.20170722.fc27.x86_64                                              2/6 
  Installing       : spax-1.5.3-10.fc27.x86_64                                                                    3/6 
  Running scriptlet: spax-1.5.3-10.fc27.x86_64                                                                    3/6 
  Installing       : redhat-lsb-submod-security-4.1-36.fc27.x86_64                                                4/6 
  Installing       : at-3.1.20-6.fc27.x86_64                                                                      5/6 
  Running scriptlet: at-3.1.20-6.fc27.x86_64                                                                      5/6 
  Installing       : redhat-lsb-core-4.1-36.fc27.x86_64                                                           6/6 
  Running scriptlet: redhat-lsb-core-4.1-36.fc27.x86_64                                                           6/6 
Running as unit: run-rca25c70a677d4866bb6056b31e1034c3.service
  Verifying        : redhat-lsb-core-4.1-36.fc27.x86_64                                                           1/6 
  Verifying        : at-3.1.20-6.fc27.x86_64                                                                      2/6 
  Verifying        : redhat-lsb-submod-security-4.1-36.fc27.x86_64                                                3/6 
  Verifying        : spax-1.5.3-10.fc27.x86_64                                                                    4/6 
  Verifying        : ncurses-compat-libs-6.0-14.20170722.fc27.x86_64                                              5/6 
  Verifying        : mailx-12.5-25.fc27.x86_64                                                                    6/6 
 
Installed:
  redhat-lsb-core.x86_64 4.1-36.fc27                       at.x86_64 3.1.20-6.fc27                                   
  mailx.x86_64 12.5-25.fc27                                ncurses-compat-libs.x86_64 6.0-14.20170722.fc27           
  redhat-lsb-submod-security.x86_64 4.1-36.fc27            spax.x86_64 1.5.3-10.fc27                                 
 
Complete!

The last missing library is liberation-fonts, which you can also install from the repository with the yum utility, like so as the root user:

yum install -y liberation-fonts
Last metadata expiration check: 2:01:27 ago on Sat 04 May 2019 05:34:34 PM MDT.
Dependencies resolved.
======================================================================================================================
 Package                              Arch                Version                          Repository            Size
======================================================================================================================
Installing:
 liberation-fonts                     noarch              1:1.07.4-10.fc27                 updates               17 k
Installing dependencies:
 liberation-narrow-fonts              noarch              1:1.07.4-10.fc27                 updates              208 k
 
Transaction Summary
======================================================================================================================
Install  2 Packages
 
Total download size: 225 k
Installed size: 476 k
Downloading Packages:
(1/2): liberation-fonts-1.07.4-10.fc27.noarch.rpm                                      49 kB/s |  17 kB     00:00    
(2/2): liberation-narrow-fonts-1.07.4-10.fc27.noarch.rpm                              336 kB/s | 208 kB     00:00    
----------------------------------------------------------------------------------------------------------------------
Total                                                                                 191 kB/s | 225 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1 
  Installing       : liberation-narrow-fonts-1:1.07.4-10.fc27.noarch                                              1/2 
  Installing       : liberation-fonts-1:1.07.4-10.fc27.noarch                                                     2/2 
  Running scriptlet: liberation-fonts-1:1.07.4-10.fc27.noarch                                                     2/2 
  Verifying        : liberation-fonts-1:1.07.4-10.fc27.noarch                                                     1/2 
  Verifying        : liberation-narrow-fonts-1:1.07.4-10.fc27.noarch                                              2/2 
 
Installed:
  liberation-fonts.noarch 1:1.07.4-10.fc27               liberation-narrow-fonts.noarch 1:1.07.4-10.fc27              
 
Complete!

You can install the Chrome browser with the following command as the root user:

yum install -y google-chrome-stable_current_x86_64.rpm
Last metadata expiration check: 2:08:09 ago on Sat 04 May 2019 05:34:34 PM MDT.
Dependencies resolved.
======================================================================================================================
 Package                           Arch                Version                        Repository                 Size
======================================================================================================================
Installing:
 google-chrome-stable              x86_64              74.0.3729.131-1                @commandline               56 M
 
Transaction Summary
======================================================================================================================
Install  1 Package
 
Total size: 56 M
Installed size: 196 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1 
  Running scriptlet: google-chrome-stable-74.0.3729.131-1.x86_64                                                  1/1 
  Installing       : google-chrome-stable-74.0.3729.131-1.x86_64                                                  1/1 
  Running scriptlet: google-chrome-stable-74.0.3729.131-1.x86_64                                                  1/1 
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Resource temporarily unavailable)
error: /tmp/google.sig.KSJ5OI: key 1 import failed.
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Resource temporarily unavailable)
error: /tmp/google.sig.KSJ5OI: key 2 import failed.
Redirecting to /bin/systemctl start atd.service
Running as unit: run-rcb32925ea21c401da74f536a222563ef.service
  Verifying        : google-chrome-stable-74.0.3729.131-1.x86_64                                                  1/1 
 
Installed:
  google-chrome-stable.x86_64 74.0.3729.131-1                                                                         
 
Complete!

When you launch the Chrome browser, it will write the following error message to standard out:

[11346:11357:0504/212207.077855:ERROR:ssl_client_socket_impl.cc(946)] handshake failed; returned -1, SSL error code 1, net_error -200
context mismatch in svga_sampler_view_destroy

The issue is corrected in new distributions of Chrome. The actual bug is shown in the screen capture below.

I upgraded the code in Fedora 27 because the Firefox browser wasn’t processing HTML Select tags correctly. After the upgrade of all fixes, the Firefox browser fails to let you use tabs to query other web pages. I shutdown Firefox, restarted it successfully, and took note that the liberation-fonts package was the problem. The tab processing issue occurred because I applied liberation-fonts package without restarting Firefox. Both Firefox and Chrome use the liberation-fonts package for displaying text.

You should run Chrome with the following command-line syntax to avoid the warning errors triggered by an existing bug:

google-chrome 2>/dev/null &

It would display a web page, like:

I hope this helps those looking for a solution.

Written by maclochlainn

May 4th, 2019 at 7:56 pm

Posted in Linux

PostgreSQL Native OS X

without comments

Started playing around with a native installation of PostgreSQL on my Mac OS X. I navigated to the PostreSQL page to download the program. I downloaded and installed the PostgreSQL Version 11.

Then, I had to connect as the postgres user and start the server. You do that by opening a Terminal, assume the role of superuser root, and then connect as the postgres user. The commands are:

sudo sh
su - postgres
whoami

As the postgres user, you need to set your $PATH environment variable to include the installation of PostgreSQL. You can use the following syntax to add the default directory to the existing $PATH environment:

export PATH=$PATH:/Library/PostgreSQL/11/bin

You can also add the previous line to the postgres user’s .bashrc file, which you’ll need to manually source. You need source the .bashrc file manually because the postgres user can’t connect directly to the server. You must assume the role of the postgres user from the superuser root.

After you have set the environment, you can start the PostgreSQL server with the following command as the postgres user:

pg_ctl -D /Library/PostgreSQL/11/data -l logfile start

Now, you can connect using pgAdmin 4. That’s it for the basic installation. You should see the following after logging in to the PostgeSQL instance:

Basic pgAdmin 4 Consule Screen

As always, I hope this helps those trying to sort out the process.

Written by maclochlainn

April 18th, 2019 at 12:59 am

Posted in Uncategorized

iPhone & Snowblower

without comments

What happens when your 16 year old doesn’t know he has a hole in his pocket, the iPhone slips down his pant leg unnoticed, and he runs over the device with a snowblower. It’s called instant shredded iPhone. You think that’s bad news but that’s why I purchased AppleCare for the device.

Then, you call Apple and discover that unless they can find and read the IMEI number from a chip, there is no warrantee coverage. That tells me AppleCare is worthless against EXTREME damage. It’s only of value when you drop it and break something while the unit remains more or less intact, or you have one of the growing number of iPhone’s with manufacturing defects that you can’t catch within the first year of ownership.

After three calls to Apple, the “senior” technical analyst said you can bring it into the local Apple Store. At that point, I asked, “Did you fail to hear that I live over 250 miles away from the nearest Apple Store?” The analyst said, “Yes, I didn’t hear that.” It was obvious that the situation didn’t fit inside the box that let them close the issue and move on with positive outcome on their staff metrics.

What Apple would like is: The customer pays $99 to replace the phone while they evaluate the pieces to see if they can find an IMEI number. They probably have that policy to avoid fraud on broken iPhones. If they can’t find an IMEI number though, they get to charge full price for the replacement iPhone. I opted for an alternative: they send me a box, I enclose the pieces for evaluation before pay $99 for a replacement iPhone, assuming they can verify from what’s left its was once an iPhone. This way, I can avoid getting soaked for the retail price when my plans support a less expensive upgrade of the now defunct device.

Ultimately, the likelihood of any value from AppleCare appeared to only occur when you break it without destroying it. However, I was wrong because Apple replaced the iPhone. 🙂

Written by maclochlainn

February 28th, 2019 at 6:02 pm

Variable Scope

without comments

Microsoft SQL Server provides T-SQL with the ability to assign values from the queries to local variables. While T-SQL returns a SELECT-list, there are rules for how you can assign the SELECT-list values. The process is more or less an all or nothing approach when assigning values to a local variable. The rule is quite simple for scalar variables because the SELECT-list may contain multiple values but assignments must be made one at a time. You can’t mix retrieving values with assignments. Lets say you try to write the following block of T-SQL code:

1
2
3
4
5
SELECT 'Execution Scope' AS "Statement";
DECLARE @base NVARCHAR(MAX) = N'';
WITH x AS (SELECT 'Chilly' AS cold, 'Burning up' AS hot)
SELECT @base += cold, hot FROM x;
SELECT @base AS "Result";

You raise the following exception:

Msg 141, Level 15, State 1, Server DESKTOP-4U7EN27, Line 3
A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.

You should rewrite the query like this:

1
2
3
4
5
SELECT 'Execution Scope' AS "Statement";
DECLARE @base NVARCHAR(MAX) = N'';
WITH x AS (SELECT 'Chilly' AS cold, 'Burning up' AS hot)
SELECT @base += cold FROM x;
SELECT @base AS "Result";

While the subquery on line 3 returns a multivalued SELECT-list, the assignment statement appends the value associated with the column name or alias, which acts like a key in a dictionary. While a dictionary is a collection of name and value pairs, you can use the name of any dictionary element as a key to return only one value from the dictionary. That is the value that the name identifies in the dictionary.

You can put a GO on line 6 in an interactive session or you can put the five lines into a T-SQL script file and call it from the sqlcmd utility. You can run the script file with the following syntax, assuming you have a student user with student as its password working against items in the studentdb schema:

sqlcmd -Ustudent -Pstudent -dstudentdb -y40 -itestScope.sql -otestScope.out

Effectively, all T-SQL variables are limited to their execution scope. You determine execution scope interactively by providing the GO command. T-SQL script files are bundles that execute in a single execution scope unless you embed the GO command.

Then, you can display the testScope.out file as follows from the command line (in a cmd session):

type testScope.out

It will display the following:

Statement
---------------
Execution Scope
 
(1 rows affected)
Result
----------------------------------------
Chilly
 
(1 rows affected)

As always, I hope this helps those looking for a solution.

Written by maclochlainn

February 15th, 2019 at 10:34 pm

Upgrade pip Utility

with one comment

You should always have the most current version of pip installed when working with Python. You can upgrade the pip utility with the following command:

sudo pip install --upgrade pip

It should print the following to the console:

Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 971kB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-18.1

Written by maclochlainn

January 2nd, 2019 at 11:21 pm

Posted in Uncategorized