drupal

Take Note of this Noteworthy Advice

Note-taking with a Flat Stanley tribute on the Newton 2000

For many years, I've taken notes nearly every day. Here's a nearly exhaustive list of the ways I've done so, in approximate chronological order:

  • yellow legal pads
  • Handspring visor (through grafiti)
  • Handsprint visor (with keyboard)
  • Apple Newton (with keyboard)
  • Moleskine or other bound journal
  • Palm LifeDrive (with keyboard)
  • Evernote
  • Livescribe Pens (starting with the Pulse, then a number of Echos and a Sky)
  • Notational Velocity
  • NvAlt
  • Quivver (a Mac app supporting markdown)
  • Neo smartpen (more than one)
  • Field Notes books
  • Wipeboard (laminated pages for dry erase markers in a notebook)
  • Apple Notes
  • Microsoft OneNote


Attempts to keep better notes has been a many year endeavor.

There have been overlaps in many of these systems. In fact, I've been using Evernote (where I am drafting this right now) with varying regularity since 2011.

What I haven't done with any success to keep to any kind of system. I know of people who do. I have always felt it a failing that I don't, a lack of discipline or consistency: a moral failing of some kind. I still feel that way.

The problem is that technology changes. I loved Notational Velocity for its simplicity and speed. I have never found an application I liked better to quickly note something on my computer. But I'm not always at my computer. 

And what if I wanted a screenshot or a table, which Evernote is particularly good for? Livescribe Sky pens were even able to automatically upload to to Evernote, making that ever-elusive promise of the best of both worlds.

Livescribe in Evernote
Livescribe Sky pens would upload directly to Evernote via Wifi (when they actually did so).

What if I just wanted to take notes during a meeting where typing on a computer would either be rude or disruptive? In those cases, I've used a notebook of some kind (Livescribe, Neo smartpen, Field Notes, journal) and found a way to upload pictures of the pages to Evernote.

I suppose if there's any system that has lasted, it has been this hybrid one of writing by hand (when necessary or appropriate) and capturing an image of the notes in Evernote or typing directly into Evernote and pasting screenshots, links and other rich media. 

When I had to update this Drupal 7 site, I used Evernote to track my work, any issues I ran into and any log messages I deemed worth saving.

Keeping track of a Drupal 7 site update
When doing an update of a site, it's all the more important to take notes of process and any hiccups along the way.

On the inestimably valuable freeCodeCamp site, Tom Hombergs wrote a great post about what he'd wished he'd known as a junior developer. I have shared it with the junior developers that report to me and think it chock full of simple advice that is not that easy to follow: keep a block, take notes and have a system, volunteer for things you don't know (among other gems). I can attest to the value of his advice and to the difficulty in following it. 

Nevertheless, system or not: take notes. You probably have a better memory than mine, but even so, your notes will help ingrain the ideas of others better, help you articulate your own thoughts better and be a trail of your own experience that will be worth revisiting.

RSS Feed into Drupal Site with SSL

Getting RSS on a Drupal page shouldn't be hard, should it?

We had a request to get a student newsletter that is sent out through MailChimp to appear on a webpage. There was already an RSS feed to the archives, so I just need to bring the content into the site.

Here was the issue, though:

Any Googling for RSS and Drupal brought up messages about importing through Aggregator. The problem with that was that the description in the RSS for MailChimp emails had a whole HTML page in it. It was not really a typical structured feed, but a title, a date and a description with the entire newsletter, including <head> and <body> tags. How was that going to work? I sure didn't know.

The Drupal Mailchimp module was not much better, as it seems to be suited more to managing lists and publishing campaigns, rather than importing old newsletters into the Drupal side.

So then it was off to the RSS widgets which populate the web to see what I could bring in from the feed and render on the page. This was more difficult than it seemed, as any RSS widgets that came up on a Google search only returned those without SSL. Unfortunately, our site has https everywhere, so the iframe kept throwing an error by the XSS auditor.

Thankfully, I found https://feedity.com/tools.aspx. This allowed me to bring in the feed titles and dates and display them in a simple but tasteful way (instead of trying to iframe in the entire newsletter archive, which looked like a big old janky hack).

Here's the resulting page:
https://admissions.creighton.edu/contact-us/student-news-and-events

The good thing about feedity is that it had some simple configuration options that helped:

<script language="JavaScript" type="text/javascript">
<!--
// Customize the widget by editing the fields below
// All fields are required

// Your Feedity RSS feed URL
feedity_widget_feed = "https://feedity.com/yoursite/feedid.rss";

// Number of items to display in the widget
feedity_widget_numberofitems = "5";

// Show feed item description (values: yes or no)
feedity_widget_showdescription = "no";

// Show feed item published date (values: yes or no)
feedity_widget_showdate = "no";

// Widget box width (in px, pt, em, or %)
feedity_widget_width = "250px";

// Widget box background color in hex or by name (eg: #ffffff or white)
feedity_widget_backcolor = "#ffffff";

// Widget text & link color in hex or by name (eg: #000000 or black)
feedity_widget_fontcolor = "#000000";
//-->
</script>
<script language="JavaScript" type="text/javascript" src="https://feedity.com/js/widget.js"></script>

Pretty simple. I set title and date to "yes" and description (which contained an entire newsletter) to "no."

I'm not entirely sure how it works, but the call to the feed and widget.js both use https, so the connection wasn't blocked and the content came across the transom. 

Voila!

Making one view look like another one

To take one view and make it look like another can be pretty trivial. 

Let's call them "old style view" and "new style view". 

In my case, most of the presentational work of both views was being done with custom text, which means that I was bringing the fields in earlier in the view, but excluding them from displaying. Then, I used the tokens created by the view of those excluded fields in a custom text field, wrapping them in tags and classes that made sense. 

<!-- vertical -->
<div class="event-item">
<div class="event-calendar-left">    
    <div class="event-calendar-box">
        <div class="box-top-month">
            [field_imported_cal_event_date_2]
        </div>
        <div class="box-bottom-day">
            [field_imported_cal_event_date_3]
        </div>
    </div><!-- END of .event-calendar-box -->
</div><!-- END of .event-calendar-left -->
    <div class="event-calendar-right">
        <div class="event-brief-desc">
        <div class="event-desc-top">
            <div class="event-name">
            [title]<br>
        </div>
        <div class="event-date">
            [field_imported_cal_event_date_1]
        </div>
        <div class="event-time">
            [field_imported_cal_event_date_4]
        </div>

        </div><!-- .event-desc-top -->
        <div class="event-desc-bottom">
            <div class="event-summary">[body]</div>
            <div class="event-more-info"><a href="[field_imported_cal_link]">More Information</a>
            </div>
        </div><!-- .event-desc-bottom -->
    </div><!-- .event-brief-desc -->
    </div><!-- .event-calendar-right -->
</div><!-- .event-item -->

Drupal Module Development with Jon Peck and the Paamayim Nekudotayim

We have all had that missing semicolon moment, when the entire app comes screeching to a halt because you hit return instead of semicolon and then return. The same thing happened today with “canvas”, which I spelled “convas” (not a word, apparently, and most certainly not one that Google Maps Drupal Plugin could use, when it was looking for canvas to be spelled correctly).

This led to an error with was really not right: “null is not an object.” Thanks, Javascript.

I swear I ran a diff on the PHP code I wrote and that of the exercise file but because of tabs and an extra return or two could not find the problem.

Instead, I grabbed the HTML output of my bad code from the browser and put it in TextWrangler. Then, I took the PHP from the Lynda.com exercise files and replaced my module PHP. Saved and lo! and behold, a map showed up. I grabbed the HTML output of that, compared the two front windows in TextWrangler and there it was: “convas” where “canvas” should be. (Update: later in the day, I had a very similar thing happen with a colon in place of a semicolon.)

“Where does he get all those wonderful toys?”

This is, of course, the best line in the 1989 Batman, said by Jack Nicholson’s Joker to his henchman. This is also what I’m wondering as I hear Jon Peck say that we need to use Drupal’s hook_block_info function. I can’t help but wonder how he knows that, because I know that I don’t know it, and I’m assuming he had to learn it. Did he do so by reviewing all of Drupal’s hook functions? That sounds crazy. Did he build a lot of sites and learn little bits of this stuff along the way? (Update: at the end of the tutorial he talks about how he spent time going through Drupal’s API, so I guess that’s not so crazy.)

Well, here’s a page about Drupal’s hooks, which I suppose is helpful, given that it was the top search result. It also contains links in the comments to the most used hooks, which is another bonus.

Links

PHP Scope Resolution Operator (::) or Paamayim Nekudotayim

What I Learned

  • The name of ::
  • What other people call -> and =>

What I Knew

  • PHP (somewhat)
  • Drupal (somewhat)

As I was going through the tutorial, I couldn’t help but wonder why PHP uses the “->” to describe methods or properties of objects. In the process of looking around, I learned more about the Scope Resolution Operator or Paamayim Nekudotayim, which is used to describe the methods of classes, not objects. I had wondered why one was used sometimes and not the other.

Perhaps I don’t know the answer, but I know now that I’m not alone in wondering about these operators:

Links

Making a Drupal site in Dreamhost

What I learned today

  • Copying files one directory up and removing them
  • Drush site-install

What I knew

  • Setting up sites with Dreamhost (domain, hosting, database hostname and creation)
  • Drush (somewhat)
  • Drupal

My steps

  1. Register domain (with Dreamhost)
  2. Host domain (with Dreamhost)
  3. Create hostname (with Dreamhost)
  4. Create database (with Dreamhost)
    1. Username
    2. Password
    3. Database name
  5. SSH to home directory
  6. Drush dl
  7. Copy files from drupal to the home directory (
  8. Remove the drupal subfolder
  9. drush site-install –db-url=mysql://{username}:{password}@{hostname}{database}
  10. Login with credentials on the new site

Links

How can I copy the contents of a folder to another folder in a different directory using terminal?
site-install - Specifically the “Install using the specified DB params.”