<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Ryan McCormick</title>
	<atom:link href="https://rtmccormick.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://rtmccormick.com</link>
	<description>Dedicated Dad, Software Engineer and Lover of Coffee</description>
	<lastBuildDate>Sun, 12 May 2019 14:09:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.7</generator>
<site xmlns="com-wordpress:feed-additions:1">159510624</site>	<item>
		<title>Force Quit Kill all Chrome Windows MacOS</title>
		<link>https://rtmccormick.com/2019/05/12/force-quit-kill-all-chrome-windows-macos/</link>
					<comments>https://rtmccormick.com/2019/05/12/force-quit-kill-all-chrome-windows-macos/#respond</comments>
		
		<dc:creator><![CDATA[user]]></dc:creator>
		<pubDate>Sun, 12 May 2019 14:09:47 +0000</pubDate>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[kill chrome]]></category>
		<category><![CDATA[quit chrome]]></category>
		<guid isPermaLink="false">http://rtmccormick.com/?p=2811</guid>

					<description><![CDATA[<p>Most modern front end tooling offers up all kinds of great features like autosave, hot module reloading, auto refresh. Great tools, I love them. Sometimes these tools can get you into trouble in browserland. Infinite loops, app hanging after a crash, or serious performance hit, whatever. The point is that you need to kill chrome [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2019/05/12/force-quit-kill-all-chrome-windows-macos/">Force Quit Kill all Chrome Windows MacOS</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Most modern front end tooling offers up all kinds of great features like autosave, hot module reloading, auto refresh. Great tools, I love them.</p>



<p>Sometimes these tools can get you into trouble in browserland. Infinite loops, app hanging after a crash, or serious performance hit, whatever. The point is that you need to kill chrome quick so you can start it back up and keep working. </p>



<p>After trying to use the GUI way of quitting chrome with great failure, I used to always resort to the command line and figure out some kind of <code>ps aux | grep -i chrome</code> magic sending a kill -9 (sigkill) to one of the billion chrome processes running. </p>



<p>I built this little gem about a year ago with the help of an <a href="https://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex">excellent answer from stackoverflow:</a> 
<pre lang="bash"><code>#!/bin/bash
kill -9 $(ps aux | grep -i '[c]hrome' | awk '{print $2}')
</code></pre>



<p>Basically, the command finds every process id from the results of the grep search for chrome and applies a kill -9 against it. I have this saved in a file that I can just run whenever I need it.</p>



<p></p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2019/05/12/force-quit-kill-all-chrome-windows-macos/">Force Quit Kill all Chrome Windows MacOS</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2019/05/12/force-quit-kill-all-chrome-windows-macos/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2811</post-id>	</item>
		<item>
		<title>SOLVED: Angular 6 CLI Karma Stuck in Single Run &#124; Karma Stops Running</title>
		<link>https://rtmccormick.com/2018/05/03/solved-angular-6-cli-karma-stuck-in-single-run-karma-stops-running/</link>
					<comments>https://rtmccormick.com/2018/05/03/solved-angular-6-cli-karma-stuck-in-single-run-karma-stops-running/#comments</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Fri, 04 May 2018 01:58:38 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angular 6]]></category>
		<category><![CDATA[angular cli]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[karma]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2756</guid>

					<description><![CDATA[<p>Angular 6 was released only a few hours ago and I was eager to start working with it. As I was working through some of the many features, I found that the test runner exits after a single test run despite the settings explicitly setting defaults (autoWatch: true, singleRun: false). I have already logged this [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2018/05/03/solved-angular-6-cli-karma-stuck-in-single-run-karma-stops-running/">SOLVED: Angular 6 CLI Karma Stuck in Single Run | Karma Stops Running</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>				Angular 6 was released only a few hours ago and I was eager to start working with it. As I was working through some of the many features, I found that the test runner exits after a single test run despite the settings explicitly setting defaults (autoWatch: true, singleRun: false). I have already logged this issue with the CLI team on Github but wanted to share my workaround.</p>
<h2>Karma autoWatch Workaround</h2>
<p>By adding <code>--watch</code> after the <code>ng test</code> in the package.json file (looks like `ng test &#8211;watch`) and running `npm run test` from the command line, I was able to make the runner stay in watch mode. This can also be accomplished by running `ng test &#8211;watch` from the command line as well.</p>
<p>That is all I have for today, happy coding!		</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2018/05/03/solved-angular-6-cli-karma-stuck-in-single-run-karma-stops-running/">SOLVED: Angular 6 CLI Karma Stuck in Single Run | Karma Stops Running</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2018/05/03/solved-angular-6-cli-karma-stuck-in-single-run-karma-stops-running/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2756</post-id>	</item>
		<item>
		<title>How to Manually Install Java 8 on Ubuntu 18.04 LTS</title>
		<link>https://rtmccormick.com/2018/04/29/how-to-manually-install-java-8-on-ubuntu-18-04-lts/</link>
					<comments>https://rtmccormick.com/2018/04/29/how-to-manually-install-java-8-on-ubuntu-18-04-lts/#comments</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Sun, 29 Apr 2018 19:43:51 +0000</pubDate>
				<category><![CDATA[Linux/Unix Tips]]></category>
		<category><![CDATA[java 8]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[ubuntu 18.04 LTS]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2748</guid>

					<description><![CDATA[<p>I recently upgraded to the latest LTS version on my dev machine and needed to install Java. I couldn&#8217;t remember exactly what I did last time but knew that I needed to download the tarball from Oracle, save the extracted files somewhere, add the runtime (java), SDK compiler (javac) and webstart (javaws) executables to the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2018/04/29/how-to-manually-install-java-8-on-ubuntu-18-04-lts/">How to Manually Install Java 8 on Ubuntu 18.04 LTS</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I recently upgraded to the latest LTS version on my dev machine and needed to install Java. I couldn&#8217;t remember exactly what I did last time but knew that I needed to download the tarball from Oracle, save the extracted files somewhere, add the runtime (java), SDK compiler (javac) and webstart (javaws) executables to the ubuntu alternatives list and add a JAVA_HOME refererence for other tools like Gradle.</p>
<p><p>This post is to document how I did this for future reference, but will hopefully be useful to other people solving the same problem. I understand that there is an apt package that I can add and do it that way but it is not owned, maintained or controlled by Oracle. Because I am who I am, I do it manually. This is my own opinionated approach and it works. This is meant to be a guide, I take zero responsibilty for any problems you may encounter while performing the next few steps. All of that being said, please post questions/comments if you encounter issues.</p>
<p>Lets get started.</p>
<h2>Step #1: Download the Java 8 SDK from Oracle.</h2>
<p>Because of the speed at which technology changes and Java is headed toward version 10, I am hesitant to share links. This link may or may not work by the time you are reading this. If in the case it no longer works, visit google and search for &#8216;Java SE Development Kit 8 Downloads&#8217;.</p>
<p><a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html" target="_blank" rel="noopener noreferrer">Java SE Development Kit 8 Downloads</a></p>
<p>I chose to download 8u172, Linux x64, the one ending in .tar.gz. If you are running RHEL (Redhat Enterprise Linux), CentOS or Fedora, you should download the rpm and be aware that these instructions won&#8217;t work for you at the point of updating the alternatives. This is a guide for Ubuntu.</p>
<h2>Step #2: Move tarball to Installation Reference Location.</h2>
<p>The subtitle for this section can be deceiving if you are not familiar with how symlinks or references work. But stay with me here.</p>
<p>Create a directory at /usr/lib called jvm-oracle. You will need to use the sudo command as this directory is at root level:<br /> <br />
<code>sudo mkdir /usr/lib/jvm-oracle</code></p>
<p>Copy your tarball over:<br />
<code>sudo cp ~/Downloads/(name of your tarball) /usr/lib/jvm-oracle</code>
</p>
<p>Move into the /usr/lib/jvm-oracle and extract your tarball:<br />
Move into: <code>cd /usr/lib/jvm-oracle</code><br />
Extract: <code>sudo tar -xvzf (name of tarball)</code>
</p>
<p>List out the directory contents and find your extracted folder: <br />
<code>ls -al</code>
</p>
<p>You should see a directory like &#8216;jdk1.8.0_172&#8217; which is mine at the time of this article. Move into your dir and the bin folder with cd and list out the contents.<br />
Move to new dir: <code>cd jdk1.8.0_172</code>. Tip: if you type a part of the directory name and hit the tab key, it should auto complete. If it doesn&#8217;t, type a little more of it and try hitting tab again.<br />
Move to bin: <code>cd bin</code><br />
List out Contents: <code>ls -al</code>
</p>
<p>This directory (bin) contains all of the executables you will need to reference for updating your alternatives. Get the path to this directory and copy/paste it into gedit or your favorite text editor.</p>
<h2>Step #3: Add to Ubuntu Alternatives.</h2>
<p>I like to prepare the next three command lines in a text editor so I can just copy/paste them into the command line and hit enter.</p>
<p>Here are mine, double check the jdk directory name before using them.<br />
<strong>NOTE: Be sure to paste them into a text editor before pasting to the command line. And paste/execute one line at a time.</strong></p>
<p>
<code></p>
<pre>
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm-oracle/jdk1.8.0_172/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm-oracle/jdk1.8.0_172/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm-oracle/jdk1.8.0_172/bin/javaws 1
</pre>
<p></code>
</p>
<p>Since references are directly symlinked to your path, you should immediately have the ability to check to see if your update-alternatives commands worked.<br />
Java Runtime Version: <code>java -version</code><br />
Java SDK Compiler Version: <code>javac -version</code><br />
Java Web Start Version: <code>javaws -version</code>
</p>
<p>You should see version output for the above commands when hitting enter after entering each one. If you don&#8217;t, re check your update-alternatives commands.</p>
<h2>Step #4: Add JAVA_HOME to your environment.</h2>
<p>Here is a fancy command that can be used to append a JAVA_HOME to the end of your .bashrc file. If you manually type, be sure to take notice of single quotes versus backticks. This is very important.<br />
<code>echo $'\nJAVA_HOME='`which java` >> ~/.bashrc</code>
</p>
<p>Check to make sure it appended: <br />
<code>cat ~/.bashrc</code>
</p>
<p>If you need to change anything, open in vim, nano or gedit to fix:<br />
<code>gedit ~/.bashrc</code>
</p>
<p>Alternatively, you can add it manually by opening your .bashrc file and setting <code>JAVA_HOME=/usr/bin/java</code></p>
<p>Close your terminal, reopen a new one and type <code>echo $JAVA_HOME</code> to ensure your environment var has been properly set. If you don&#8217;t see <code>/usr/bin/java</code> for output, close all terminal sessions, open a new terminal session and try the <code>echo $JAVA_HOME</code> again. If you are still having issues, check the entry in your .bashrc file again.</p>
<p>If you want to set a system-wide JAVA_HOME, add to your /etc/environment file. Note: Because /etc/environment is under the root path, you will need to use the sudo command before your editor command.</p>
<p>That is all I have folks. Be sure to post questions/comments. Happy coding!</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2018/04/29/how-to-manually-install-java-8-on-ubuntu-18-04-lts/">How to Manually Install Java 8 on Ubuntu 18.04 LTS</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2018/04/29/how-to-manually-install-java-8-on-ubuntu-18-04-lts/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2748</post-id>	</item>
		<item>
		<title>Remove VirtualBox from Ubuntu 16.04 Xenial</title>
		<link>https://rtmccormick.com/2018/03/03/remove-virtualbox-ubuntu-16-04-xenial/</link>
					<comments>https://rtmccormick.com/2018/03/03/remove-virtualbox-ubuntu-16-04-xenial/#comments</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Sat, 03 Mar 2018 22:11:54 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ubuntu 16.04]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2742</guid>

					<description><![CDATA[<p>I recently had to make some updates to my VirtualBox and Vagrant installations and decided to completely uninstall VirtualBox to reinstall the newest version to start fresh. I am creating this post as a future reference (mostly for the home folder info) but also to share. Step 1: Completely Remove All VirtualBox Packages and Folders [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2018/03/03/remove-virtualbox-ubuntu-16-04-xenial/">Remove VirtualBox from Ubuntu 16.04 Xenial</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>				I recently had to make some updates to my VirtualBox and Vagrant installations and decided to completely uninstall VirtualBox to reinstall the newest version to start fresh. I am creating this post as a future reference (mostly for the home folder info) but also to share.</p>
<h2>Step 1: Completely Remove All VirtualBox Packages and Folders from Ubuntu</h2>
<p>If you are interested in checking out all of the package versions on your system before uninstalling, you can run <code>dpkg -l | grep virtualbox</code></p>
<p>To uninstall and remove all packages, run <code>sudo apt-get remove virtualbox* --purge</code></p>
<p>This command does a couple of things:<br />
1. Identifies virtualbox packages to ensure all versions are targeted by using the asterisk wildcard.<br />
2. The purge option also triggers removal of any configuration files.</p>
<p>To also remove all of the VMs stored in the home directory, move to the next step.</p>
<h2>Step 2: Remove all VMs from Home Directory</h2>
<p><strong>NOTE:</strong> The <code>sudo rm</code> command with <code>-rf</code> is a very destructive command. Always pay attention to what your command is doing before hitting enter. </p>
<p><strong>ANOTHER NOTE:</strong> This will remove all VMs that have been installed to the default home folder location. If you don&#8217;t want to remove VMs, don&#8217;t complete this step.</p>
<p>Because &#8220;sudo rm -rf&#8221; is destructive, check to see if you even need to use the command by locating the files and attempting to delete without sudo.</p>
<p>1. Browse to your home directory (you can usually just type cd and hit enter).<br />
2. run <code>ls -al</code><br />
3. If you see the directory &#8220;VirtualBox VMs&#8221;, you can try to delete without sudo first <code>rm -rf ./"VirtualBox VMs"</code> (you need to use double quotes around the folder name because of the space). If you run into file permission problems, you can try to take ownership and then try deleting without sudo <code>sudo chown `whoami` -R ./"VirtualBox VMs"</code> and then try <code>rm -rf ./"VirtualBox VMs"</code>. If all else fails, and it makes sense, use sudo: <code>sudo rm -rf ./"VirtualBox VMs"</code>.<br />
4. Remove config files from home directory. Technically, when running your apt-get remove with purge, all config files should have been targeted, but it is good to check anyway. From your home directory, change into your .config folder <code>cd .config</code> and look for a folder named VirtualBox. Try removing without sudo at first (since it is located in your home folder, you should have the ability to do so) <code>rm -rf ./VirtualBox</code>.</p>
<p>At this point, all of your previous VirtualBox installation should have been removed.		</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2018/03/03/remove-virtualbox-ubuntu-16-04-xenial/">Remove VirtualBox from Ubuntu 16.04 Xenial</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2018/03/03/remove-virtualbox-ubuntu-16-04-xenial/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2742</post-id>	</item>
		<item>
		<title>Clear all Node Modules Folders Recursively Mac/Linux</title>
		<link>https://rtmccormick.com/2018/01/10/clear-node-modules-folders-recursively-mac-linux/</link>
					<comments>https://rtmccormick.com/2018/01/10/clear-node-modules-folders-recursively-mac-linux/#comments</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Thu, 11 Jan 2018 05:14:38 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[node_modules]]></category>
		<category><![CDATA[osx]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2735</guid>

					<description><![CDATA[<p>If you do any kind of front end development or front end development training, you have probably accumulated a bunch of projects with aging/stale &#8220;node_modules&#8221; directories. Are you going to take time to open every single old project you have to nuke the node_modules directory? Nobody has time for that. I wanted to migrate a [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2018/01/10/clear-node-modules-folders-recursively-mac-linux/">Clear all Node Modules Folders Recursively Mac/Linux</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>				If you do any kind of front end development or front end development training, you have probably accumulated a bunch of projects with aging/stale &#8220;node_modules&#8221; directories. Are you going to take time to open every single old project you have to nuke the node_modules directory? Nobody has time for that.</p>
<p>I wanted to migrate a bunch of old code to an archive drive and because of the size of each &#8220;node_modules&#8221; directory, I didn&#8217;t care to save &#8220;node_modules&#8221; archives with my old projects (especially since I can just run <code>npm install</code> to reinstall if needed).</p>
<h2>Clear all node_modules Directories | Mac and Linux</h2>
<p>Since I don&#8217;t have any control over how individual users use, input, modify or copy/paste the node_modules nuke command, it is only reasonable that I mention that I take zero responsibility for the outcomes of the use, misuse, etc&#8230; you get the picture.</p>
<p>TL;DR: I saved about 5GB after running this command:</p>
<ol>
<li>Open your terminal.</li>
<li>Browse to your master project directory or the top level of where you have a bunch of projects stored.</li>
<li>Run the command: <code>find . -name "node_modules" -type d -prune -exec rm -rf '{}' +</code></li>
</ol>
<h2>How it works</h2>
<p>Since this blog is driven towards educating about the process of solving problems versus just providing blind answers, lets take some time to break this command down into pieces to examine how it works.</p>
<ol>
<li><code>find .</code> Instructs the find program to search for files in the current directory <code>.</code>.</li>
<li><code>-name "node_modules"</code> Instructs the find program to search for files named &#8220;node_modules&#8221;.</li>
<li><code>-type d</code> Instructs the find program to only look for file directories named &#8220;node_modules&#8221;.</li>
<li><code>-prune</code> Instructs the find program to not descend into the current file/directory for it to exclude child &#8220;node_modules&#8221; directories. On Mac, since -d was specified, -prune has no effect on the find program&#8217;s lookup results (per the man pages). However, on Linux, -prune still instructs the find program to not descend into the current file/directory.</li>
<li><code>-exec rm -rf '{}' +</code> Instructs the find program to execute <code>rm -rf</code> on the matching results. The code <code>'{}' +</code> instructs the command line to be built by appending each selected file name at the end thus invoking the <code>rm -rf</code> command less times than the total number of &#8220;node_modules&#8221; directory matches. This helps with performance.</li>
</ol>
<p>And there you have it. As I mentioned above, I saved ~5GB by running this command. If you have a lot of projects, you could easily clear up more than ~5GB.		</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2018/01/10/clear-node-modules-folders-recursively-mac-linux/">Clear all Node Modules Folders Recursively Mac/Linux</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2018/01/10/clear-node-modules-folders-recursively-mac-linux/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2735</post-id>	</item>
		<item>
		<title>Webstorm adding spaces between imports and braces &#124; JavaScript and TypeScript</title>
		<link>https://rtmccormick.com/2017/09/29/webstorm-adding-spaces-imports-braces-javascript-typescript/</link>
					<comments>https://rtmccormick.com/2017/09/29/webstorm-adding-spaces-imports-braces-javascript-typescript/#comments</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Fri, 29 Sep 2017 06:58:36 +0000</pubDate>
				<category><![CDATA[Angular 2]]></category>
		<category><![CDATA[angular 4]]></category>
		<category><![CDATA[import statement spacing]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[typescript]]></category>
		<category><![CDATA[webstorm]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2727</guid>

					<description><![CDATA[<p>I have been working with Angular 4x and TypeScript in Webstorm a lot lately and have been guilty of the occasional sloppy import statement. If you found this article, you are probably doing the same thing. Because adding spaces between the import and braces is super tedious, I took some time to find a solution. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/09/29/webstorm-adding-spaces-imports-braces-javascript-typescript/">Webstorm adding spaces between imports and braces | JavaScript and TypeScript</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>				I have been working with Angular 4x and TypeScript in Webstorm a lot lately and have been guilty of the occasional sloppy import statement. If you found this article, you are probably doing the same thing. Because adding spaces between the import and braces is super tedious, I took some time to find a solution. </p>
<p>I can&#8217;t take all of the credit for this. Some awesome people posted the solution for JS imports on <a href="https://stackoverflow.com/questions/41920324/adding-spaces-between-imports-and-braces-in-webstorm" target="_blank" rel="noopener noreferrer">stackoverflow</a>. At the very minimum, I am creating this post so I have something to reference later on as well.</p>
<h2>Add Spaces Between Import and Braces in Webstorm Settings</h2>
<ol>
<li>Open Settings: <code>File > Default Settings</code></li>
<li>Expand Editor Menu on Left</li>
<li>Expand Code Style Menu under Editor Menu</li>
<li>Click JavaScript or TypeScript if you are using TypeScript</li>
<li>Click on the Spaces Tab in the right content area</li>
<li>Scroll Down to <code>Within</code> Settings</li>
<li>Select <code>ES6 import/export braces</code></li>
<li>Click <code>Apply</code> and <code>Ok</code> to close</li>
</ol>
<p>Enjoy looking at clean, consistent imports!</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/09/29/webstorm-adding-spaces-imports-braces-javascript-typescript/">Webstorm adding spaces between imports and braces | JavaScript and TypeScript</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2017/09/29/webstorm-adding-spaces-imports-braces-javascript-typescript/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2727</post-id>	</item>
		<item>
		<title>Get Column Names From Access Database Table with VBA</title>
		<link>https://rtmccormick.com/2017/08/11/get-column-names-access-database-table-vba/</link>
					<comments>https://rtmccormick.com/2017/08/11/get-column-names-access-database-table-vba/#respond</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Fri, 11 Aug 2017 05:34:36 +0000</pubDate>
				<category><![CDATA[Microsoft Access]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[get column names]]></category>
		<category><![CDATA[vba]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2719</guid>

					<description><![CDATA[<p>It has been a long time since I have added a VBA post, so here is something that I had to quickly put together for a little project that I am working on this evening. I have a really large table with a bunch of fieldnames that I need to query through to make some [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/08/11/get-column-names-access-database-table-vba/">Get Column Names From Access Database Table with VBA</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>				It has been a long time since I have added a VBA post, so here is something that I had to quickly put together for a little project that I am working on this evening. </p>
<p>I have a really large table with a bunch of fieldnames that I need to query through to make some sample data for another project. </p>
<p>I thought that it would be easiest to quickly grab all of the field names from my target table so I can filter out only the ones I need and not manually type a bunch of field names. </p>
<p>I am sure there are other trivial ways of doing this, but since you found my post, you are probably looking to do what I am doing here.</p>
<h2>Get Column Names from Access Recordset with VBA</h2>
<pre lang="vb" line="1">
Sub getFieldNamesFromTable(targetTable As String)
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strSQL As String
    
    Set db = CurrentDb
    
    strSQL = "SELECT TOP 1 * FROM " & targetTable
    
    Set rs = db.OpenRecordset(strSQL)
    
    For Each fName In rs.Fields
        Debug.Print fName.Name
    Next fName
    
    'Do While Not rs.EOF
    
    'Loop
    
    db.Close
    Set db = Nothing
    Set rs = Nothing
End Sub
</pre>
<p>And then to use this method, set up another sub in a module or wherever</p>
<pre lang="vb" line="1">
Sub tableNamesRunner() 
	getFieldNamesFromTable ("MyAccessDBTableName")
End Sub
</pre>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/08/11/get-column-names-access-database-table-vba/">Get Column Names From Access Database Table with VBA</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2017/08/11/get-column-names-access-database-table-vba/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2719</post-id>	</item>
		<item>
		<title>How to Get Linux Distro Name and Kernel Version from the Command Line</title>
		<link>https://rtmccormick.com/2017/07/31/get-linux-distro-name-kernel-version-command-line/</link>
					<comments>https://rtmccormick.com/2017/07/31/get-linux-distro-name-kernel-version-command-line/#respond</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Tue, 01 Aug 2017 04:12:22 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[get distro]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[unix]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2680</guid>

					<description><![CDATA[<p>If you are using Linux as a development environment, to install a new utility, or for an almost infinite number of other reasons, it may be helpful to get the current version from the command line. Get Current Ubuntu Version From Command Line If you are an Ubuntu or Debian user, you can get the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/07/31/get-linux-distro-name-kernel-version-command-line/">How to Get Linux Distro Name and Kernel Version from the Command Line</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>				If you are using Linux as a development environment, to install a new utility, or for an almost infinite number of other reasons, it may be helpful to get the current version from the command line.</p>
<h2>Get Current Ubuntu Version From Command Line</h2>
<p>If you are an Ubuntu or Debian user, you can get the latest distro from the command line by running the following:</p>
<pre lang="bash">
lsb_release -a
</pre>
<h2>Get Current Distro Version from Command Line Redhat/CentOS/Fedora</h2>
<p>CentOS and Fedora are based on Redhat. You can get the current distribution by issuing the following commands:</p>
<pre lang="bash">
# CentOS ONLY
cat /etc/centos-release 

# CentOS/Redhat/Fedora
cat /etc/redhat-release 
</pre>
<h2>Get the Current Linux Kernel Version from the Command Line</h2>
<p>Sometimes it is helpful to find the latest kernel version of the Linux distro you are running. You can get this info by running:</p>
<pre lang="bash">
uname -a
</pre>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/07/31/get-linux-distro-name-kernel-version-command-line/">How to Get Linux Distro Name and Kernel Version from the Command Line</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2017/07/31/get-linux-distro-name-kernel-version-command-line/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2680</post-id>	</item>
		<item>
		<title>SOLVED: Testing PATCH with Spring Boot TestRestTemplate</title>
		<link>https://rtmccormick.com/2017/07/30/solved-testing-patch-spring-boot-testresttemplate/</link>
					<comments>https://rtmccormick.com/2017/07/30/solved-testing-patch-spring-boot-testresttemplate/#comments</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Mon, 31 Jul 2017 02:51:18 +0000</pubDate>
				<category><![CDATA[Spring Boot]]></category>
		<category><![CDATA[http patch]]></category>
		<category><![CDATA[spring boot]]></category>
		<category><![CDATA[testresttemplate]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2673</guid>

					<description><![CDATA[<p>When writing integration tests for REST APIs in Spring Boot, it is common to use the org.springframework.boot.test.web.client.TestRestTemplate. Anyone who has attempted to test the PATCH method with Spring Boot&#8217;s default TestRestTemplate will find out that it doesn&#8217;t ship with the ability to use the PATCH method. As a workaround, org.apache.http.client.HttpClient can be added as a [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/07/30/solved-testing-patch-spring-boot-testresttemplate/">SOLVED: Testing PATCH with Spring Boot TestRestTemplate</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>				When writing integration tests for REST APIs in Spring Boot, it is common to use the <code>org.springframework.boot.test.web.client.TestRestTemplate</code>. Anyone who has attempted to test the PATCH method with Spring Boot&#8217;s default TestRestTemplate will find out that it doesn&#8217;t ship with the ability to use the PATCH method. </p>
<p>As a workaround, <code>org.apache.http.client.HttpClient</code> can be added as a substitute.</p>
<h2>Add Apache HttpClient as a Dependency</h2>
<p>Before you get started, you need to add the Apache HttpClient to your classpath manually or via build tool. </p>
<p>If you are using gradle, you can add the following to your build.gradle dependencies (Be sure to check the version). </p>
<pre lang="groovy" line="1">
dependencies {
	compile('org.apache.httpcomponents:httpclient:4.5.3')
}
</pre>
<p>If you are using Maven, you can add it to your pom.xml:</p>
<pre lang="xml" line="1">
<dependency>
	<groupId>org.apache.httpcomponents</groupId>
	<artifactId>httpclient</artifactId>
	<version>4.5.3</version>
</dependency>
</pre>
<h2>Use Apache&#8217;s HttpClient as a Substitute for TestRestTemplate</h2>
<p>To highlight the implementation, I have added three steps in the code comments below.</p>
<pre lang="java" line="1">
import com.example.Repository.ContactRepository;
import com.example.model.Contact;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.json.JSONObject;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;

import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.assertThat;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class UpdateContactsTest {

    // STEP #1
    // Add the TestRestTemplate
    @Autowired
    private TestRestTemplate restTemplate;
    private RestTemplate patchRestTemplate;
    // END STEP #1

    @Autowired
    private ContactRepository contactRepository;

    private Contact contact1;

    @Before
    public void setup() {
        contact1 = contactRepository.saveAndFlush(new Contact("NotRyan", "McCormick", "555-555-5555"));

        // STEP #2
        // Add Apache HttpClient as TestRestTemplate
        this.patchRestTemplate = restTemplate.getRestTemplate();
        HttpClient httpClient = HttpClientBuilder.create().build();
        this.patchRestTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient));
        // End Step #2
    }

    @Test
    public void updateContactOneWithPatch() throws Throwable {
        String resourceUrl = "/api/v1/contacts/" + contact1.getId().toString();

        // Create JSON Object
        // { "firstName": "Ryan" }
        JSONObject updateBody = new JSONObject();
        updateBody.put("firstName", "Ryan");
        
        // STEP #3
        // Use patchRestTemplate to make call with PATCH method
        ResponseEntity<Contact> responseEntity =
                patchRestTemplate.exchange(resourceUrl, HttpMethod.PATCH, getPostRequestHeaders(updateBody.toString()), Contact.class);

        // Ensure Status Code is 200 OK
        assertEquals(HttpStatus.OK, responseEntity.getStatusCode());

        // Ensure Content-Type is application/json
        assertEquals(MediaType.APPLICATION_JSON_UTF8, responseEntity.getHeaders().getContentType());

        // Ensure that PATCH updated firstname
        // from "NotRyan" to "Ryan"
        Contact updatedContact = responseEntity.getBody();
        assertEquals("Ryan", updatedContact.getFirstName());
        assertEquals("McCormick", updatedContact.getLastName());
    }

    // Moved Over from TestHelper for Blog Post
    public HttpEntity getPostRequestHeaders(String jsonPostBody) {
        List<MediaType> acceptTypes = new ArrayList<MediaType>();
        acceptTypes.add(MediaType.APPLICATION_JSON_UTF8);

        HttpHeaders reqHeaders = new HttpHeaders();
        reqHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
        reqHeaders.setAccept(acceptTypes);

        return new HttpEntity<String>(jsonPostBody, reqHeaders);
    }
</pre>
<p>After setting up the TestRestTemplate like the example above, PATCH should now be available. </p>
<p>As always, please comment with questions, suggestions, improvements, etc&#8230;</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/07/30/solved-testing-patch-spring-boot-testresttemplate/">SOLVED: Testing PATCH with Spring Boot TestRestTemplate</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2017/07/30/solved-testing-patch-spring-boot-testresttemplate/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2673</post-id>	</item>
		<item>
		<title>Refactor Legacy AngularJS Controller to ControllerAs Syntax</title>
		<link>https://rtmccormick.com/2017/07/30/refactor-legacy-angularjs-controller-controlleras-syntax/</link>
					<comments>https://rtmccormick.com/2017/07/30/refactor-legacy-angularjs-controller-controlleras-syntax/#respond</comments>
		
		<dc:creator><![CDATA[Ryan McCormick]]></dc:creator>
		<pubDate>Mon, 31 Jul 2017 00:32:44 +0000</pubDate>
				<category><![CDATA[AngularJS (1x branch)]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[controlleras syntax]]></category>
		<guid isPermaLink="false">https://rtmccormick.com/?p=2659</guid>

					<description><![CDATA[<p>There are a lot of resources and examples available on the web for learning AngularJS(1.x branch). Some are good, some are bad and some are super ugly and confusing. The recommended approach for building scalable applications with AngularJS is to follow the controllerAs syntax. In this post, I will be breaking down a really ugly [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/07/30/refactor-legacy-angularjs-controller-controlleras-syntax/">Refactor Legacy AngularJS Controller to ControllerAs Syntax</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>				There are a lot of resources and examples available on the web for learning AngularJS(1.x branch). Some are good, some are bad and some are super ugly and confusing. The recommended approach for building scalable applications with AngularJS is to follow the controllerAs syntax.</p>
<p>In this post, I will be breaking down a really ugly legacy controller and converting it to controllerAs syntax.</p>
<h2>Legacy Ugly Angular Controller Example</h2>
<p>It can probably get uglier than this, but this is going to be our starting point.</p>
<pre lang="javascript" line="1">
// File: app.js
var app = angular.module('myApp', []);

app.controller('AppController', ['$scope', '$log', function($scope, $log) {
  $scope.title = 'Welcome to My App';
  $scope.setTitle = function(newTitle) {
    $log.log('New title is ' + newTitle);
    $scope.title = newTitle;
  };
}]);
</pre>
<h2>ControllerAs Conversion</h2>
<p>Before we break the above example to controllerAs, we need to analyze to see what it is doing. The example above declares the main app module and sets a controller on it in the same file. </p>
<p>If this was the whole app, it would be just fine but since this scenario is almost never the case, we need to break it out into seperate files.</p>
<h3>Create app.module.js file</h3>
<pre lang="javascript" line="1">
(function() {
  'use strict';

  angular.module('app', []);

})();
</pre>
<h3>Create app.controller.js file</h3>
<pre lang="javascript" line="1">
(function() {
  'use strict';

  angular
    .module('app')
    .controller('AppController', AppController);

  AppController.$inject = ['$log'];

  /* @ngInject */
  function AppController($log) {
    var vm = this;
    vm.title = 'Welcome to My App';
    vm.setTitle = setTitle;
    
    function setTitle(newTitle) {
      $log.log('New title is ' + newTitle);      
      vm.title = newTitle;
    }
  }

})();
</pre>
<h2>Convert to ControllerAs Syntax Summary</h2>
<p>So what did we do?</p>
<ol>
<li>Use module setter in app.module.js file and use getter from app.controller.js file. By following this approach, we set the module once and get it from the controller. If we had a directive or service, we would also be only setting the module once in the app.module.js file and getting it once in the respective service or directive file. This approach helps prevent variable collisions and leaks.
</li>
<li>Wrap all methods in a Javascript Immediately-Invoked Function Expression (IIFE) to prevent global variable scoping and enforce local variable scoping. This approach also helps make code more minifiable.</li>
<li>Enable strict mode with <code>'use strict'</code>. I am not going to go into all of the benefits of strict mode here. There is an excellent article by John Resig <a href="https://johnresig.com/blog/ecmascript-5-strict-mode-json-and-more/" target="_blank" rel="noopener noreferrer">ECMAScript 5 Strict Mode, JSON, and More</a> that goes into more detail if you are interested.</li>
<li>Use named functions which removes callbacks and nested callbacks to produce more readable code.</li>
<li>Use an injection schema that is more conducive to making code minifiable when using a build process with gulp, grunt, webpack, etc&#8230;</li>
</ol>
<h2>More ControllerAs Syntax Resources</h2>
<ol>
<li>If you are interested in learning more about the controllerAs syntax, I highly recommend the <a href="https://github.com/johnpapa/angular-styleguide/tree/master/a1" target="_blank" rel="noopener noreferrer">Angular style guide by John Papa</a></li>
<li>I also highly recommend John Papa&#8217;s course on Pluralsight: <a href="http://www.shareasale.com/m-pr.cfm?merchantID=53701&#038;userID=1570502&#038;productID=551543274" target="_blank" rel="nofollow noopener noreferrer">AngularJS Patterns: Clean Code</a> that goes into great detail about each section of the style guide listed above.</li>
</ol>
<p>Please comment with questions, suggestions, best practices.</p>
<p>The post <a rel="nofollow" href="https://rtmccormick.com/2017/07/30/refactor-legacy-angularjs-controller-controlleras-syntax/">Refactor Legacy AngularJS Controller to ControllerAs Syntax</a> appeared first on <a rel="nofollow" href="https://rtmccormick.com">Ryan McCormick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rtmccormick.com/2017/07/30/refactor-legacy-angularjs-controller-controlleras-syntax/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2659</post-id>	</item>
	</channel>
</rss>
