Two courses that have recently been made available (though I haven’t yet had the opportunity to take) at Code School are Powering Up With React (for React) and an HTML/CSS class called The Elements of Web Design.
Summertime – which is rapidly approaching – is a good time to commit to spending time picking up new skills and refreshing old ones. I have little experience with React, so this presents an excellent opportunity to see what capabilities are made available there.
Whether you choose to take the above courses, or look elsewhere for learning, commit to spending a little time each day studying to pick up new skills – it may not sound like much effort to spend toward a large task, but the results could surprise you!
While I think the venerable Ruby on Rails Tutorial is still the best way to learn Rails, jumping into this tutorial can be challenging for those who are new to programming.
With the fourth and latest beta of Rails 5 being released this past week, it is appropriate that Michael Hartl, the creator of the Rails Tutorial, has devised yet another tool to help new and experienced developers learn enough to make the most of it.
Appropriately, the title of this site is “Learn Enough to Be Dangerous”.
The cost is $29 per month, the same as Code School (if you subscribe on a per-month basis to CS). Unlike CS, there is not yet a discounted yearly rate.
Since I’m excited to see the new Rails Tutorial as soon as it’s released, I’ve decided to sign up. Were it not for the access to this mammoth resource, I don’t know that I would pay this price – but considering that the Rails Tutorial with screencasts generally costs about $150 by itself, it seems like a reasonable deal. At any rate, I’ve come to expect only the highest quality learning materials from Dr. Hartl, so I am definitely looking forward to the upcoming classes.
I’m still working on upgrading some older CF8 applications to CF11. I came across an interesting problem, the exact cause of which I have not found, but I do have a solution of sorts.
When the particular application I’m working on now was written, the standard browser that would be accessing it was Internet Explorer 8. Over time, as we have upgraded our browsers, but not had time to make changes to the application to accommodate those new browsers, we had used the dreaded Compatibility View to keep the look and feel of the application unchanged.
This is the result:
After stepping through the code using Internet Explorer’s Developer Tools, I determined that the reason this “createCFWindow” function threw an exception was because the ColdFusion.window.create function was returning null rather than a new window.
When testing the website on Chrome – which this application was not designed to use – I discovered that the error did not occur, and decided to turn off Compatibility View. Sure enough, this error disappeared in IE 11 – though a host of other issues have now developed.
Now, I’m working to upgrade the application to be HTML5-compliant so it will work on IE 11 or Chrome.
Apparently, using CF UI tags became unfashionable quite some time ago, but that type of advice isn’t always heard or heeded until long after it’s announced.
Any future applications I build will use jQuery instead for this sort of thing.
I was looking at the cached pages on the Wayback Machine and decided to find out if that site had an API. (It does.) I wanted to find a way to use this API to submit links to the Wayback Machine database. As it turns out, a Ruby gem called WaybackArchiver has already been written for just this purpose!
Now that I had an easy way to submit multiple URLs, I got to thinking about how this could be more easily automated. What if I had a sitemap that contained all of the links I wanted to submit? What if there is already a gem to parse a sitemaps.org-compliant sitemap, such as the one on WordPress sites that use the Google Sitemap Generator Plugin?
Even though all of these things exist, I have not found where they have been combined, so I did just that. The Ruby script I wrote requires several gems:
1. WaybackArchiver, for submitting links, sitemaps, or pages to the Wayback Machine
2. Sitemap-Parser, for parsing sitemaps
3. OpenURI, for opening websites
4. Nokogiri, for parsing XML (also HTML, SAX, and Reader) files
If these gems are not installed already, you can install them at the Ruby prompt with “gem install” and the name of each gem.
The script, which I named map.rb, is below.
require 'wayback_archiver' require 'sitemap-parser' require 'open-uri' require 'nokogiri' mainSitemapURL = ARGV if not mainSitemapURL.nil? puts 'Running...' #+ mainSitemapURL #mainSitemap = SitemapParser.new mainSitemapURL mainSitemap = Nokogiri::HTML(open(mainSitemapURL)) #puts mainSitemap mainSitemap.xpath("//sitemap/loc").each do |node| #puts node.content subSitemapURL = node.content subSitemap = SitemapParser.new subSitemapURL arraySubSitemap = subSitemap.to_a (0..arraySubSitemap.length-1).each do |j| #puts arraySubSitemap[j] WaybackArchiver.archive(arraySubSitemap[j], :url) end end end puts 'Finished.'
This script works unaltered with WordPress sitemaps created by the plugin mentioned above. These sitemaps actually produce a sitemap index, with individual sitemaps being linked here – so each of the linked sitemaps are also parsed. The above script can be run at the Ruby prompt with “ruby map.rb URL“, substituting the URL for the sitemap.
Should your sitemap be organized differently, this code may not work as-is, but may require changes depending on the node tag names.