Mac OS Terminal Custom Prompt with Git Branch

This article explains how I set up my new Mac’s terminal to be more simple and incorporate the Git branch in the prompt.

Get .git-promt.sh

Get the code from the source on GitHub.

As directed in the comments, place the code in your home directory (e.g. ~/.git-prompt.sh). You will most likely need to create this file.

Add or edit .bashrc or .zshrc

You will need to know what shell you are running. A really easy way to see this is to just type some gibberish in the terminal prompt and hit enter.

$ asdf
bash: asdf: command not found

The above shows you are running the Bash shell. Below shows you are using the ZSH shell.

$ asdf
zsh: command not found: asdf

Create or edit your .bashrc or .zshrc file in your home directory (e.g. ~/.zshrc). Then add the following to your file and save:

Bash Shell

source ~/.git-prompt.sh
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '

ZSH Shell

source ~/.git-prompt.sh
setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '

Reload Shell rc File

Run the following command to reload your RC file.

Bash Shell

source ~/.bashrc

ZSH Shell

source ~/.zshrc

Your New Prompt

Your new prompt will look something like this depending on if you are in a git repository or not:

[username@host current_directory]$
[username@host current_git_directory (branch_name)]$

There are many options to customize your prompt even more by customizing what you put in your RC file . Doing a search on google will help you find what you need.

Migration From Drupal 7 to Drupal 8: How do I find which items were ignored?

You are migrating from Drupal 7 to Drupal 8 and you have ignored items after you run a migration. This leads to the very important question of which ones were ignored?

What you see

[notice] Processed 632 items (630 created, 0 updated, 0 failed, 2 ignored) - done with 'node_form'

The above is what I will use in my examples.

What you want to know

What are the items ignored!? For this we can look into the database. I assume you have access to a console…

The migrate_map_migration_name table in your database will give you the information you need. There will be a column named source_row_status. The value of 2 equals the status of ignored. So run the following MySQL command:

SELECT * FROM `migrate_map_node_form` WHERE source_row_status = 2;

The sourceid1 column of the returned rows will contain the id of the item that was ignored.

Example output:

source_ids_hash sourceid1 destid1 source_row_status source_row_status last_imported hash
8530eb5d63ad4cfea47134a28e3339e089f639164d218287c3… 10931 NULL 2 0 0
ddd550e747c2a26a2a5058d49be0e146616fd5c45f6bef88f3… 11656 NULL 2 0 0

Answers on stackoverflow.

Migration of Files from Dupal 7 to Drupal 8 with: [notice] Field discovery failed for Drupal core version 7. Did this site have the CCK or Field module installed? Error: No database connection configured for source plugin d7_field_instance

When migrating files in Drupal 7 to Drupal 8 you receive one or more notices:

[notice] Field discovery failed for Drupal core version 7. Did this site have the CCK or Field module installed? Error: No database connection configured for source plugin d7_field_instance

At the end of the migration you will see something like this:

[notice] Processed 2607 items (2474 created, 0 updated, 15 failed, 118 ignored) - done with 'file'

The numbers will be different according to the amount of files you are migrating. In my case each of the 118 ignored files all had generated [notice] Field discovery failed....

After looking through the database I found that one of my fields held reference data to a user that no longer existed.

Process I took to find the problem

  1. Google and Drupal site
    1. There was very little information to be found with searching for: [notice] Field discovery failed for Drupal core version 7. Did this site have the CCK or Field module installed? Error: No database connection configured for source plugin d7_field_instance.
  2. Dive into the database – splash
    1. Find which files didn’t get migrated from the migration map with MYSQL on the D8 database.
      SELECT * FROM `migrate_map_file` where source_row_status <> 0;
      
      You’ll want to note that all the files that don’t have a d8_database > migrate_map_file > migrate_map_status of 0 are not created. The status of 2 means the file is ignored and 3 means it failed the migration.
    2. Use MYSQL on the D7 database to select a few files each that were ignored and created.
      SELECT * FROM `file_managed` WHERE fid = 5981 OR fid = 6051 OR fid = 5816 OR fid = 6906 OR fid = 16231 OR fid = 3709
      
      The file_managed table is where you can pull each FID (field id) from the fid column. In the example the last two FIDs where files that were created. The other 3 FIDs where ones that had been ignored. By comparing these I found that the only thing that stood out was the UIDs (user ids). A couple of the files ignored had the same UID.
    3. On the Drupal 7 site I viewed the user by the UID (mysite.com/user/123). This ended up in a page not found. You can also check this in the database with the following command.
      SELECT * FROM `users` WHERE uid = 123;
      

Conclusion

There were files with an author that no longer existed in the database. As an example, the file with the FID of 5981. This file referenced the author, which was a user, with a UID of 123 that was no longer in the database. This caused the notice and for the file to be ignored in the migration.

Linting HTML with Sublime Text 3, SublimeLinter, HTML Tidy for Windows, and SublimeLinter HTML Tidy on Windows

Linting is the process of running a program that will analyse code for potential errors.

In this article we will be Sublime Text 3, SublimeLinter, SublimeLinter HTML Tidy, and HTML Tidy for Windows to lint some HTML code.

  1. Install Sublime Text 3
  2. Install SublimeLinter
  3. Install HTML Tidy for Windows
  4. Install SublimeLinter HTML Tidy

Install Sublime Text 3

Sublime Text 3 is a sophisticated text editor for code, markup, and prose.

This is a free software to try and the trial period doesn’t stop but it does have a pop up every so often that reminds to you play fair. Purcase the software like I did. It is a solid investment if you are going to do any coding.

Install SublimeLinter

SublimeLinter is a plugin for Sublime Text that provides a framework for linting code.

  1. With Sublime Text 3 open hold CTRL + SHIFT + P and type install
  2. Select Package Control: Install Package
  3. Type SublimeLinter
  4. Select SublimeLinter
  5. You will get a Package Control Message that says the package is installed

Install HTML Tidy for Windows

HTML Tidy for Windows is a binary that is needed by the SublimeLinter HTML Tidy plugin. It allows you to run Tidy on Windows.

  1. Navigate to the HTML Tidy for Windows website
  2. Select the tidy.zip link to download
  3. Extract the tidy.exe file to a place that SublimeLinter will have access to it
    1. For example C:\Users\Username\tidy

Install SublimeLinter HTML Tidy

SublimeLinter HTML Tidy

  1. With Sublime Text 3 open hold CTRL + SHIFT + P and type install
  2. Select Package Control: Install Package
  3. Type Sublimelinter-html-tidy
  4. Select Sublimelinter-html-tidy
  5. You will get a Package Control Message that says the package is installed
  6. To use tidy you have to point SublimeLinter to the tidy.exe file
    1. In Sublime Text 3 navigate to Preferences > Package Settings > SublimeLinter > Settings

    2. In the new window scroll down to paths

    3. Copy that section to the tab on the right

      "paths": {
          "linux": [],
          "osx": [],
          "windows": []
      },
      
    4. Enter your path to tidy.exe in the windows option

      {
        "paths": {
            "linux": [],
            "osx": [],
            "windows": ["~/tidy"]
        },
      }
      

      Note: You need to use forward slashes.

    5. Save the setting with CTRL + S

    6. Close the window

  7. Now open a HTML document and errors in your HTML will be displayed

How to pay Minnesota sales tax and record it in QuickBooks Desktop

  1. Set up sales tax in QuickBooks Desktop
  2. Make sales and collect sales tax
  3. Run report Reports > Vendors & Payables > Sales Tax Liability
    1. This will give you the numbers for your sales tax liability
  4. Log into MN e-Services
    1. File the appropriate quarter
    2. Enter the information from your sales tax liability report
    3. Pay sales and use tax
    4. Print transaction for your tax records
  5. In QuickBooks navigate to Vendors > Sales Tax > Pay Sales Tax
    1. If you have paid your previous sales tax appropriately you should only have the last quarter’s tax numbers listed
    2. Confirm the check date is the date you paid the taxes
    3. Confirm you have the last quarter date selected
    4. Adjust the tax amount as needed Note: Minnesota rounds the amount to whole dollars. This will mean that you will have to adjust the tax paid up or down.
      1. Click Adjust
      2. Confirm that the Adjustment Date is the date you paid the taxes
      3. Select your Sales Tax Vendor
      4. Select your Adjustment Account
        Note: If you round down you will recieve a credit. That credit needs to go somewhere in QuickBooks so you will have to set up an Income account to track it. The same is true if you have to round up. Except for this you will need an Expense account. Reference
      5. Select the type of adjustment. Increase Sales Tax By for rounding up (or if you have to pay a late fee) or Reduce Sales Tax By for rounding down.
      6. Enter the Amount of the increase or reduction
      7. In the memo I find it helpful to enter the reason for the adjustment (e.g. Sales Tax Adjustment – Round up)
      8. Click OK
    5. Select each of the line items you would like to pay including any adjustments
    6. Click OK
  6. That is it you have paid for your taxes and tracked them in QuickBooks

Just a note… I am not an authority figure on QuickBooks. This is just what has worked for me.

Troubleshooting

I had a mess when I paid the taxes in QuickBooks with a check instead of the Pay Taxes feature. I had to make some adjustments. See the Sales Tax Payable is incorrect after using the Write Cheques window to pay sales tax heading on the How to resolve common sales tax issues QuickBooks page.

Order of Link Pseudo Classes (Lord Vader Hates Furry Animals)

Remember: Lord Vader Hates Furry Animals (CSS-TRICKS > Link Pseudo-Classes (In Order))

  1. :link selector to style links to unvisited pages (CSS :link Selector)
  2. :visited selector to style links to visited pages(CSS :visited Selector)
  3. :hover selector to style links when you mouse over them (CSS :hover Selector)
  4. :focus selector is used to select the element that has focus (w3schools.com > CSS :focus Selector)
  5. :active selector is used to select and style the active link (w3schools.com > CSS :active Selector)
    • :active MUST come after :hover (if present) in the CSS definition in order to be effective!
    • a link becomes active when you click on it
Drupal 8: Missing Login

Drupal 8: What happened to my login page!?

The Short

If you are working on the page.html.twig file and you now can’t get to the login screen confirm you are rendering the content section in your template by having {{ page.content }} in the page.html.twig file.

The Long

Recently, I have been learning to use Drupal 8 while at the same time getting more and more familiar with Drupal 7. I hit a little problem along the way and thought I would share as Drupal is notoriously hard to find information on when you need it. Unfortunately, part of the reason why is because if you read the documentation you can figure it out with some effort.

Who wants to put that kind of effort into it when it seems like there is a simple fix? So here is a simple fix or something you can check if you have a similar problem.

What I was doing…

I was in the process of building a custom theme and was building a template using YOURTHEME/templates/page.html.twig.

After logging out I was unable to log back in. I tried logging in via the login path built into Drupal 8 (mysite.com/user/login). It came up with the same page as the main page I was working on. I determined the template was the problem by renaming the template so as not to be rendered by Drupal. Note you can’t clear the cache if you can’t login. You will have to run the drush in the command line in the root folder (the folder with sites in it…) of your site: drush cr. Now the login page work by going to mysite.com/user/login.

The problem was that I had defined the content area in the MYTHEME.info.yml but did not add the code to the template to render the content in the content area of my theme. To resolve enter {{ page.content }} where you want to render your login information in your theme. Clear the all caches and change the name of the template back to what it was (page.html.twig).

AOL equals LAME – AOL does not allow you to forward your emails.

These posts are incorrect. AOL no longer forwards emails to other addresses (not even other AOL addresses)! (https://www.techwalla.com/articles/how-to-forward-aol-mail; http://www.justanswer.com/email/7l0qq-aol-email-automatically-forwarded.html)

However, there is a work around. Techwalla had this very helpful article.

Basically you have to have Google Mail forward you email for you. You add your something@aol.com email address to your gmail account (you will have to create one if you don’t have one).

  1. In your Gmail account  click the settings cog wheel at the top right.
  2. Click “Accounts and Import”
  3. Click “Add a mail account you own” (a popup window will apprear)
  4. Enter your AOL email address, click “Next Step”
  5. Fill in your AOL username and password (username is youraccount@aol.com).
  6. Check “Label Incoming Messages” to tag emails sent to your AOL address and help separate them from Gmail messages.
  7. Before pressing “Add Account,” check “Leave a Copy…” if you want your AOL emails to appear both on Gmail and on the AOL website or AOL Desktop.

Then if you want to use a different email account (i.e. not Gmail) you can forward the Gmail account to another email.

  1. In your Gmail account  click the settings cog wheel at the top right.
  2. Click Forwarding and POP/IMAP
  3. Click “Add a forwarding address”
  4. Add your email address (not AOL or Gmail) and save.
  5. Gmail will send that email a confirmation. Go to that account’s inbox and click the box to confirm the forward. This will open a browser window click confirm.
  6. Now one more step… In the Forwarding and POP/IMAP section of Gmails settings you need to enable forwarding to the address by selecting the Forward a copy of incoming mail to yourforwardedemail@somewhere.com.
  7. Click save. Now you will be able to get your email! 🙂

 

 

Forward Exchange Email to Exterior Email Account without Domain Credentials

This is mostly for my reference but if it helps someone else great! 🙂

  1. Create Exchange Shared Mailbox
  2. Add alias to Shared Mailbox
  3. Create Email enabled Contact (instructions not included)
  4. Forward Shared Mailbox

Exchange: Create Shared Mailbox

https://technet.microsoft.com/en-us/library/jj150570(v=exchg.150).aspx

  1. Go toRecipients > Shared > Add .
  2. Fill-in the required fields:
    • Display name
    • Email address
  3. To grant Full Access or Send As permissions, clickAdd , and then select the users you want to grant permissions to. You can use the CTRL key to select multiple users. Confused about which permission to use? See Which permission should you use? later in this topic.
    • No Need to set permissions
  4. ClickSave to save your changes and create the shared mailbox.

Exchange: Add Alias to Shared Mail Box

  1. Navigate to Exchange admin center > recipients > shared
  2. Select Shared Mailbox then Click edit
  3. Click email address
  4. Click plus
  5. Enter email (ie user@yourdomain.com)
  6. Click ok
  7. Click Save (Now you can send email to that user)

Exchange: Forward Shared Mailbox

https://community.office365.com/en-us/f/148/t/214982

  1. Login to your office 365 portal; then go to this URL outlook.office365.com/ecp
  2. Click “recipients” from the left and “shared” tab from the right; then double click to open the shared mailbox you want to forward email from
  3. Click “mailbox features” from the left side and scroll down the window, then click View details under “Mail flow”
  4. Now Check “Enable forwarding” and browse the user name where you want to forward the email to; choose other options as per your convenience. Click Ok then Save.