Best Extension for Google Chrome

Some people are really good at keeping their online documents organized. Some are experts at keeping their email inboxes empty. I’ve even heard that there are people who only have a few tabs open in their browser at a time. So few in fact, that they can even read the titles of the websites on the tabs themselves. That’s just plain crazy. I’m lucky if I can even distinguish one tab from another.

But then I discovered a little gem of an extension called Workona Tab Manager.

School. Church. Tennis. Board games. Tech. Random websites. These are all the different types of tabs that I have open at a given time. A middle school boy’s locker rivals the mess at the top of my browser window. But once you load Workona, you are able to categorize all of your tabs and keep them organized. On the left side of the screen, you’ll notice a section that houses all of your workspaces. This is where you choose which topics you want to organize. Make as many workspaces as you’d like to keep yourself on task and organized.

The workspace that I have selected shows all the tabs I like to have open about tennis. When I close this workspace by clicking the x (red arrow), all the tabs go away. When I click on the tennis workspace on a different day, all the tabs magically show back up. It’s a beautiful sight. No longer do I have a long list of bookmarks that I can’t easily organize. If there is a picture I took or a resource that I want to keep organized, I can upload it to Workona’s resource area (blue arrow). Want a quick place to jot notes? The notes section (orange arrow) allows you to do that. Perhaps you even want to start a to-do list based on tennis… again, it’s doable with the tasks section (green arrow). If you collaborate with other Workona users (I have a few colleagues who also use it), we can have the same tabs/notes/resources available if we choose to share a workspace (yellow arrow). Instead of telling a colleague to search Google Drive for the document from 3 months ago, I can just have it as a shared tab and it will show up for them when they select that workspace.

You can easily move tabs from one workspace to another so that you can keep your tabs organized throughout the day. I find that when I have my MS Work tab open, I am able to stay a bit more focused on the task at hand without losing the info I had pulled up about my next tennis match. I’m also able to find the specific tab I need faster since I’m able to see the label on the tab instead of just the icon.

Another feature I really like is the Find Anything feature at the top of the Workona sidebar. If you hit option-f from any part of your browser, the Workona find feature will appear and it will search all of your recent tabs for whatever word you enter (as well as your Google Drive if you have that connected). It is an amazing way to quickly find what you are looking for.

This is one of the best extensions I use and would highly recommend it to anyone who needs a little organization in their life.

Possible fix to Gmail acting slowly in Google Chrome

A few colleagues and I have noticed a delay in the autofill feature of Gmail in the past few days and it is getting more and more annoying by the hour. We also noticed it on our learning management system (which is integrated with Gmail) making most parts of our days take even longer than they’ve been taking recently. The symptom: when we tried to type a name into the to: field, it would type just fine, but as soon as the autofill completed and I hit return, it would take 3-4 seconds for the address to actually be entered. Having to do this for a handful of virtual students during class made this a huge waste of time. Imagine needing to email five students an assignment while keeping the seven students in my right classroom and the seven students in my left classroom on task, while watching precious seconds pass by without being able to do anything productive. Did I mention I stand in a doorway to teach my class?

I did all the regular things I tell all my colleagues to try when the internet is acting weird (you should try these too if you are having issues).

  1. Make sure you limit the number of tabs you have open concurrently.
  2. Check to see if Chrome is up to date and restart the browser.
  3. Restart your computer (I don’t truly know the ins and outs of why this work, but it has solved so many of the unexplainable issues I’ve run into).
  4. Grab a hammer…

Obviously step four is only the last resort, so I thought about what else could be the problem, and then I remembered… extensions. Extensions are so great and help in many ways, but they are created by lots of random developers. And once you get more than one person working on a project, you can run into some issues. So I disabled all of my extensions. Interestingly enough, you can’t disable all the extensions with a single button. Unless of course, you install another extension that can do that for you. So, I installed the aptly named Disable Extensions Temporarily to quickly check if the extensions were indeed the culprit. Refresh Gmail and magically the issue went away. I enabled the extensions again, and boom, the problem was back. So three by three, I disabled each row of extensions to narrow down my search. And I eventually ran into my bad extension… Rakuten. When I disabled it, the issue disappeared. After uninstalling it and restarting my browser, Gmail was back to its usual self. So if Chrome feels slow and bogged down, take a look and see if Rakuten is the issue for you. If not, try to disable all the extensions and then narrow down which one is causing your headache so that you can go back to a hassle-free experience.

Getting unfat. Again. 2021 edition.

2020 was a bad year for innumerable reasons, the least of which led to expansion. My expansion. I got fat. Again. I’m pretty sure this is something I’ll have to pay attention to for the rest of my life. 7 years ago I got up to my biggest at 235 lbs and spent half a year getting it under control and getting down to 175. This time I had snuck up to 218 when I’d had enough.

Lose It! app

The two red flags that usually push me over the edge from “not caring” to “holy crap, how did I end up here?!?!” is when my pants break up with me and when tying my shoes isn’t just one of many steps to get out of the house but instead the main event. Back in December, both occurred.

So on January 3, I weighed in at 218.7 and decided to start getting healthier. I’m a decent tennis player (a high 4.0 rank) and get around the court pretty easily. My days of soccer made quickness one of my boons.  But instead of exchanging “racket-fives” and lackluster congratulations at the end of a match, my opponents would ponder aloud; “how does a guy your size get to those shots?” And while I do appreciate a backhanded compliment as much as the next guy, I picked up what they were putting down.

I’ve had success keeping track of calories, and being a math guy with a love of logic, the idea makes a lot of sense.  If you eat fewer calories than your body needs to run, you will end up losing weight.  So I use a free app called Lose It! that makes tracking the calories I eat and the calories I burn easy (especially in conjunction with my Apple Watch).  I’d like to be at my target weight (175 lbs) by the end of the school year, so if I lose around 2 lbs a week, I should be there in time.  Enter all my vital information to the app, and it recommends eating 1600 calories a day (more if you exercise).  So I’ve been eating small snack bars (often Luna bars or granola bars – 200 calories each) for breakfast, lunch, and snack, and then eat a good size dinner.  I’m usually feeling pretty good by the end of the day.

St. Patrick’s Day temptation

But when you work in a school, there are days that you have to choose to avoid the faculty lounge.  And who knew that St. Patrick’s Day was one of those days.  Three large trays of cupcakes, two large boxes of even better-looking cupcakes, and a box of Krispy Kreme donuts to complete the trifecta of temptation can be tough to resist.  But I did my best Odysseus impression and resisted the call of the sugary sirens.  Sure, I could have eaten one, and it would have been fine, but I prefer to stick to my decision to eat healthier and live a healthier lifestyle right now. 

Quest for El Dorado

This is one of the new games I’ve picked up recently that I’ve really enjoyed.  It is a great 2 player game with a decent amount of strategy built into a deck builder game and a race mechanic.  With 3 or 4 players you lose a bit of strategy, but it is still fun.  

I just found a pdf with 40 custom maps that look like they could be fun.  You can find the original link from BoardGameGeek, but I also stored it in my GDrive in case it ever goes missing.  Looking forward to trying it soon…  I particularly like the dual paths in a few of them!

Ruby on Rails – create new from web

When you create an @variable as opposed to a variable, the @ tells that it is an instance variable.

By opening config > routes.rb, we can use the code resources :articles to give a lot of different paths to articles (index, create, new, edit, show, update, and destroy).

A nice thing about Ruby on Rails is the program kind of tells you what to work on next.  We want to do a new article, so if I type in my browser: 0.0.0.0:3000/articles/new, it will tell me why it can’t do that (no route).  So go to route.rb and give it the resources to do it.  Reload the page and see that it says uninitialized ArticleController.  Guess where we go next?  Yup.  App > Controllers > new file > “articles_controller.rb”.  The code is as follows:
class ArticlesController < ApplicationController
  def new
  end
end
Save it and reload 0.0.0.0:3000/articles/new.  Now it is missing the template (view).  Go to views and create a new folder called articles.  Inside that folder create a file called new.html.erb.  Put a <h1> at the top telling what the page will do: “Create a new article”.  Reload the site and see if you can see the <h1>.  And we can!  Perfect.  Now we need to create a form to put on that page so the user can create a new article.  RailsGuides has a great site talking about all the parts of forms that rails provides but for now we’re just going to do some basic things.

So on the new.html.erb file, type:
<h1>Create a new article</h1>
<%= form_for @article do |f| %>
<% end %>
When you save and run this, you’ll see an error.  It says the first argument can’t be empty (because we haven’t made @article yet).  So we need to go to articles_controller.rb and create it.  So now it should have:
class ArticlesController < ApplicationController
  def new
    @article = Article.new
  end
end
Since we got all of that working, we can now build the form on new.html.erb.
<h1>Create a new article</h1>
<%= form_for @article do |f| %>
  <p>
    <%= f.label :title %><br/>
    <%= f.text_field :title %>
  </p>
  <p>
    <%= f.label :description %>
    <%= f.text_area :description %>
  </p>
  <p>
    <%= f.submit %>
  </p>
<% end %>
Everything works, but when you try to click “Create Article” it won’t work.  The error says “action create couldn’t be found in ArticlesController”.  So we need to define create in ArticlesController.  That is done by typing:
class ArticlesController < ApplicationController
  def new
  end
  def create
    #this will show you what is happening, but just comment it out
    #render plain: params[:article].inspect
    @article = Article.new(article_params)
    if @article.save
      flash[:notice] = "Article successfully created
      redirect_to articles_path(@article)
    else
      render 'new'
    end
  end
     
  private
    def article_params
      params:require(:article).permit(:title, :description)
    end
end

The next thing we need to do is figure out how to deal with flash[:notice].  Views > layouts > application.html.erb is a wrapper for all the pages, so we’ll see this html code on all pages.  This would be a good place to put our notice messages.  So in the body of that page (right above <%= yield %>, put:
<% flash.each do |name, msg| %>
  <ul>
    <li><%= msg %></li>
  </ul>
<% end %>

This all looks good but we don’t have a way of displaying the errors or the validations that occur when you click “Create Article”.  We can fix that by entering some code on the new.html.erb page.  Right below h1, put:
<% if @article.errors.any? %>
<h2>The following errors prevented the article from getting created:</h2>
  <ul>
    <% @article.errors.full_messages.each do |msg| %>
    <li><%= msg %></li>
    <% end %>
  </ul>
<% end %>

Now when I try to create an article with no title, I do get which errors are occurring so that I know why I can’t make an article.  But when I put in a correct title and description, I get a message “The action ‘show’ could not be found in ArticlesController.”  So I need to define show in ArticlesController found in app > controllers > articles_controller.rb.  It doesn’t seem to matter where I place the define, but I’m going to put it right below create.
def show
  @article = Article.find(params[:id])
end
You now have the action, but are still missing the template.  So go create that under app > view > articles > create a new file called show.html.erb.  On that file, we need to type the code to place the info on that page:
<h1>Showing selected articles</h1>
<p>
  Title: <%= @article.title %>
</p>
<p>
  Description: <%= @article.description %>
</p>

That should be it!  We can now create articles by going to 0.0.0.0:3000/articles/new.  Make sure to commit and push to git and we are done for now.  Next entry will be about editing entries.  

Ruby on Rails – edit/delete entries & validations

This entire section and the previous article has been working with the backend of my app.  Eventually I will be able to do all of these things from the browser, but for now I need to understand how this works from the backend.

In order to edit an entry in a database, you first need to grab it.  You can grab it by assigning it to a variablearticle = Article.find(2), where 2 is the article’s ID.  Then all you have to do is typearticle.title = "This is the new title of the 2nd article", then type: article.save to save the change.  If you want to see that change, typeArticle.all.  If you want to delete an entry, grab the article just like we did before, and then type: article.destroy to delete it.

The way our app is currently set up, people can enter blank entries to clog up the app.  We don’t want that so we need to set validations at the model layer to maintain data integrity.  We want to make sure that all entries have a title and a description.  The validation needs to be added to app > models > article.rb.  The code should be: 
class Article < ApplicationRecord
  validates :title, presence: true
end
What this does is makes sure that the title of an entry has a value.  If it doesn’t, then it won’t be allowed to be submitted to the database.  In order for this to work, you do have to restart the rails console so make sure to exit it and restart it before you try.  You can also type reload! to restart the console.  One more constraint we want to add on is to make sure it has a minimum of 3 characters and a maximum of 50 (we don’t want a letter or an entire paragraph as a title…) So the additional code is:
class Article < ApplicationRecord
  validates :title, presence: true, length: { minimum: 3, maximum: 50 }
end

Now if you try to create an article without a title or the title is too short or long, there will be an error when you try to save it using article.save.  If you are curious of what the error is (it doesn’t tell you right off) then you have to type: article.errors.full_messages and it will tell you what went wrong.

And don’t forget to push changes to git.  Use git status to see what files have changed without having been committed. git add -A will add those files to a commit.  Then use git commit -m "your message" to actually add the changes to the commit and then use git push to push the changes.

Ruby on Rails – tables/databases

If you have a table that will be holding a bunch of articles for a blog, the title of that table is articles.  The model name will be the singular, so Article (and it should be capitalized).

Table = plural, lowercase of the model name => articles
Model = singular, first letter capitalized of the table name => Article
Model file name = should be lowercase, singular with .rb at the end => article.rb
Controller name = plural of model file name => articles_controller.rb
Filename should always be snake_case.
Model & class names should be CamelCase.

To generate a table:
rails generate migration create_articles

This creates a table in your alpha-blog > db > migrate folder called (a bunch of numbers)_create_articles.rb.  When you open this up you’ll see a table, but you need columns.  It has the code:
create_table :articles do |t|
To add a column and put the header of “title” on it, we need to add this code:
create_table :articles do |t|
  t.string :title

You could also have added a column to hold the article’s text (or description) by doing this code:
create_table :articles do |t|
  t.string :title
  t.text :description

but we’ll leave it out and add it later to show what to do in case you need to add a column once a table has been created.

We then need to run rails db:migrate to actually create the table.  Once that is done you’ll see code in db > migrate > schema.rb that shows the “articles” table. But we forgot to add the description column, so we have a few options of how to fix that.  I can run rails db:rollback which essentially is like command-z.  I can then add the description and run rails db:migrate again.  Even though this works, it isn’t the best way to deal with a mistake.  Instead, you should create a new migration file. To do this, enter rails generate migration add_description_to_articles.  Once this new migration is created, you need to open it: db > migrate > (bunch of numbers)_add_description_to_articles.rb and add some code to create columns.
def change
  add_column :articles, :description, :text
  add_column :articles, :created_at, :datetime
  add_column :articles, :updated_at, :datetime

What this just did was added 3 columns to our table titled “Description”, “Created At”, and “Updated At”.
Once this is done, you need to migrate the db again. rails db:migrate.

Once that is finished, you can go back to schema.rb and see the changes that occured.  We’ve created the database, but we need a model to be able to communicate with the database.  This is the image used in the course to help understand the relationships between all the pieces.

image from the Complete Ruby on Rails Developer Course – Mashrur Hossain

So we need to create a model to communicate with the database.  That is done under app > models > create new file called article.rb.  In that new file, you’ll need to put the code:
class Article < ApplicationRecord
end

Rails magically creates getters and setters for each of the columns we made earlier in the table once we make this model.

You can check to make sure this worked from rails console. This gives you direct access to your database. You can use it as a playground to test things out. If you type in Article.all it will show you if there is a connection. You can then type Article to see all the attributes. There are a lot of things you can do from here, but they are referenced in the video of section 4, lecture 46 at around 15:30.  But a few of the commands are:
article = Article.new
article.title = "This is my first article"
article.description = "This is the description
article.save
Another way to do this more succinctly is:
article = Article.new(title: "This is my 2nd article.", description: "This is the 2nd description." and then save.
Article.create(title: "This is my 3rd article.", description: "My 3rd description.") – this one you don’t have to save as the create method automatically saves it. This is probably the most effective method.
To get out of the rails console, just type exit.

King of New York vs King of Toyko

Paco received a new copy of King of New York for Christmas and we had a family gaming session this afternoon.  I enjoy the game a lot more than King of Tokyo as there are a lot more choices to make in the game.  Just to give you a quick, basic rundown of King of Tokyo, each player plays a monster sent to terrorize Tokyo.  Whichever monster can accumulate the most fame (20 stars) wins the game.  You can also attack other monsters in the game, so if you are the last monster standing, you also win.  You do this with a Yahtzee style gameplay, where you roll 6 dice and can reroll them up to 3 times.  Each side of the die gives you different options of what you can do in the game.  

One of the changes that I really like in KoNY is the ability to not just attack other monsters, but instead attack buildings around New York. When you attack a building, you get a small bonus, but you also bring a military unit to your borough to help defend the city against your razing.  Another change in this game is that you can be attacked not only by other players, but also the military units defending the city.  It is a small change that increases the strategy of the game without changing the heart of it.  The game is still a last-monster-standing game or who can become the most famous monster in New York. 

The art and theme of the game are also great.  I found the theme to be even stronger in this game as opposed to its predecessor.  I love that the New York Marathon card doesn’t allow monsters to move unless they “pay”.  Much like in real life, you aren’t getting around the city easily if The Marathon is happening.  

King of Tokyo is a great game to play with kids but feels a bit lucky and mindless.  There are definitely decisions to be made, but there is a lot of luck involved.  I don’t see myself pulling this one out when I’m with a bunch of friends.  While King of New York still feels a bit sillier than my normal games, I think I’d enjoy having fun with some of my friends with this one.  There are plenty of ways to accrue points or knock other players out in KoNY that make it a much better option out of the two.  Adding in the King of New York: Power Up! expansion would make this game even that much better.  That expansion adds special powers and abilities for each character so that it makes each character play a little bit differently.

Our game today ended up with an early exit by Casey (not realizing her health was so low) followed by Paco getting knocked out (waiting a little too long to exit Manhattan).  I secured the win by gaining enough fame to be the SuperStar of New York and beating the last monster, Ladybug.  I see a rematch happening in the near future.

Ruby on Rails – deploying to Heroku

To deploy to Heroku, follow these steps:

  1. Open the Gemfile in your app.  Heroku doesn’t support sqlite3 (they support postgresql) so we have to change that.  Remove gem 'sqlite3' and put it near the bottom under group :development do
  2. At the very bottom of Gemfile, type
    group :production do
    gem 'pg'
    end
This lets us use postgresql while developing but sqlite3 when we actually produce.

To get this to actually take effect, we need to commit to our repository.  We do this by typing this in shell: bundle install --without production.  Then log in to heroku.com and find instructions for installing heroku toolbelt on local machine.  The course wasn’t clear about how to install locally, but I think this code should do it. curl https://cli-assets.heroku.com/install.sh | sh. I think the piece we are trying to install is called CLI (used to be called Toolbelt?). Type heroku -v to make sure heroku was installed correctly.

Now log in to heroku using heroku login. You’ll be redirected to a browser to login. We need to create an application in heroku for our application. To do that, use heroku create. If you then use git status you’ll see what hasn’t been committed and what has. Remember to use git add -a and git commit -m "whatever you want the message to be" to add the changed files to your commit.

Lastly, we need to add our ssh key to heroku.  If I don’t, it will continually ask me for my username and password.  Just use the codeheroku keys:add.   Once this is done, you should be able to push your application to heroku. When I tried to push the application to heroku, I ran into an issue because bundler had been upgraded to bundler 2.  I first had to run this command:  heroku buildpacks:set https://github.com/bundler/heroku-buildpack-bundler2 but then after that, I was able to git push heroku master to send the app to heroku.

That is completed and here is the site. To rename the site, use the code: heroku rename new-name-of-site (whatever you want it to be).