Rookie Javascript Mistakes

Screen Shot 2015-01-26 at 10.11.53 PM

I frequently can accomplish things by cobbling together code I find on Stack Overflow and various tutorials/examples found elsewhere. Sometimes I have a decent idea what’s going. Other times . . . my lack of real understanding slows me down much more than I’d like.

The following bits of increased knowledge come from playing around with three javascript plugins for jquery. You can see all of them in action at the site1 above.

  • Chart.js – simple HTML 5 carts that are animated on construction
  • countUp.js – does those rolling numbers
  • ToolTipsy – slick customized tooltips

“By seeking and blundering we learn.” – quite possibly Goethe2

Here are two easy things I did wrong when playing with way too many javascript libraries on the ECAR demo site.

Lesson one – If a library is a jquery plugin then the script you write (initiator?) AND the plugin reference3 have to load after jquery. That order is just a little bit important. I had previously thought far less about the plugin source URL and probably accidentally put it in the right order. In my head it wasn’t a script.4 I thought about more like a reference put into action later and so I never really thought about the order. This is basic competency stuff but I did it wrong and spent a while trying to figure out why things were failing before I noticed.

Lesson two – You can’t assign more than one function to window.onload. You can, however, merge the code chunks pretty easily.5

So something like this . . .


	window.onload = function() {
			sturesp.start();
			institute.start();
			countries.start();
			facresp.start();
			var ctx = document.getElementById("laptop-chart-area").getContext("2d");
			window.myPie = new Chart(ctx).Pie(laptoppieData);

instead of

	window.onload = function() {
			sturesp.start();
			institute.start();
			countries.start();
			facresp.start();
}

	window.onload = function() {

			var ctx = document.getElementById("laptop-chart-area").getContext("2d");
			window.myPie = new Chart(ctx).Pie(laptoppieData);

1 I probably need to write a post about what I did there and why.

2 I don’t really care who said it. It’s not like I hold Goethe up as a model for education. I’d also replace “blundering” with some other word less indicative of carelessness and more focused on moving without excess timidity. So maybe I’m not so good at using quotes.

3 I don’t know if these are the right words. The URL that points to the plugin code.

4 Clearly it is by my head is a strange place most of the time.

5 A solution but in the future it seems like options other than onload will be preferable.

Weekly Web Harvest (weekly)

Posted from Diigo. The rest of my favorite links are here.

It Could Be Beautiful: Aspirational vs Operational EdTech


creative commons licensed ( BY ) flickr photo shared by ellyjonez1

This is a bit of brainstorming for a presentation I’m doing in a few months. It’s a bit of a remix of some stuff I’ve highlighted before but there are a few new examples in the mix (bolded below). I think they’re well worth looking at more deeply- especially Math Box and Keshif.

I like Math Box because it tightens up the equation/interactive visualization connection in math. It’s one of the reasons I love Fluid Math. Math Box is not for the faint of heart (javascript library) but it starts to lead towards different expectations around how we might see and interact with math concepts.

Keshif incorporates many of the elements that have had me chasing Simile Exhibit and FacetWP. It does it in a really slick visual package that enables some really interesting options. I really believe there’s depth to the different kind of understandings we can come to when data can be quickly sifted and sorted. It is interactive data visualization that can change the kinds of questions we ask.

Have better examples? Am I getting too flaky? Throw some feedback my way in the comments or write in the document.2


A great deal of energy and attention has been focused on using technology to automatically grade quizzes, to “capture” lectures, to make the most massive MOOC . . . to McDonaldize education. There is another path. Technology can humanize. It can augment, extend, and empower. There is real transformative power for students and instructors when they interact and build with these tools. The ability to make useful products, to unite the abstract and concrete, to compress action/feedback cycles, to allow for fluid and interactive presentation of data towards new and deeper understandings – this is where technology starts to matter.

These are new possibilities that should not be ignored. We can rethink what we see as educational, consider how interaction shapes understanding, and take advantage of new ways to build what we really want. The work and worth of the academy can be more visible and powerful than ever before.

A few of the sites/resources/tools/communities that will be highlighted include-


1 Thanks to Alan for making the Flickr attribution helper which is really slick in all sorts of ways. I finally got around to reinstalling it.

2 Seriously. Write in the document.

WordPress Multisite- Quick Delete to Reuse Email

Wordpress Schwag Image thanks to Armando.

In WordPress Multisite, a user can sign up under an email address. They then decide to delete their account for some odd reason. If they try to sign up again under that same email, it’ll say the email address is being used and will become available in a few days. In a situation like ours (all accounts are restricted to VCU email addresses) that’s a problem.

You can jump right into phpMyAdmin and delete the row that contains this information in the wp_signups table. That’s no big deal unless you have a giant database and then using phpMyAdmin1 is a very special kind of slow motion misery.

The following two piece solution allows me to just go to a website, enter the email address I wish to expunge and presto change-o the email is available to be used again.

This isn’t rocket science (but it may be helpful) and there may be alternate paths. Those who know better, feel free to warn and/or educate me.

Piece 1

A little tiny HTML form.

<form action="deduplicate.php" method="post">
        	//form action above links to whatever you've named your php file
	Email to destroy: <input type="text" name="killuser" /><br />
	<input type="submit" name="submit" value="Submit me!" />
</form>

Piece 2


if(isset($_POST['submit'])) {
// sql to delete a record that matches the variable (killuser) from the web form
$sql = "DELETE FROM wp_signups WHERE user_email LIKE '$killuser'";

//then the confirmation or non-confirmation message
if ($conn->query($sql) === TRUE) {
	echo "Zombie Destroyed. Go in peace.";
} else {
	echo "You cannot kill me! Error deleting record: " . $conn->error;
}
}


1 It’s likely someone with more skills would just use the command line to knock all this out but I’m not there yet. I’m working on it.

Photography – Year in Review

It is still January right?

Instead of looking through all my images or even culling the weekly summaries I opted to see which ones had lingered in my head. These are the ones I remembered. Some of them were pretty popular on the Internets but others received little attention.

my grandfather's funeral
This is an unposed image of my grandfather’s girlfriend at his funeral.

I went through the desert . . .

ride to school

of the city

A For Adventure - Wonder - Jackson Ward

I don't even like cats

Clinton - Stranger #47

Stranger #48 - Eugene Wallace

a kiss

One of the pictures I missed that lingered. I can’t find or erased another of a woman holding her hand up to the glass of a window at night. I must do a better job with metadata.
just part of the scenery

Weekly Web Harvest (weekly)

Posted from Diigo. The rest of my favorite links are here.

Weekly Web Harvest (weekly)

  • ” It’s absolutely amazing and horrifying and hilarious. It’s a really good indication of what’s happening in tech: people who don’t understand something are trying to solve it with something else they don’t understand.”

    tags: tech technology education weekly

  • This stuff is pretty impressive. Well worth checking out if you do anything with math.

    “MathBox is a library for rendering presentation-quality math diagrams in a browser using WebGL. Built on top of Three.js and tQuery, it provides a clean API to visualize mathematical relationships and animate them smoothly.”

    tags: github mathbox math js javascript library weekly

  • “This is a habit of mine, and no doubt the accidental inspiration for the “practice paying attention” assignment. In fact, I think of this as self-assignment?—?study payphones in Manhattan (where are they clustered, where are they sparse, how many are broken?), security cameras around San Francisco (which ones are conspicuous and which are stealthy?), defaced Neighborhood Watch signs in Savannah, and so on. The point is to attend to some recurring thing that is ubiquitous, but that nobody is making any particular effort for me to notice.

    Historian Matthew Frye Jacobson’s collection of “Space Available” signs is a great example of the same idea. And David Wondrich and Kenneth Goldsmith once took this sort of thinking to a delightful extreme by looking explicitly for flaws in the urban landscape?—?dinged signs, chipped architectural details, etc.?—?cataloging them under the title “Broken New York.””

    tags: weekly attention ds106 lens tweet

  • “To be clear: I’m not saying kids’ movies should become a weepfest like the first 15 minutes of Up (no matter how amazing they were). I’m not advocating for gratuitous pathos-mashing like (mild spoiler!) Toy Story 3’s completely unnecessary incinerator scene.  I don’t think Baymax’s fist bump ruined Big Hero Six by any stretch of the imagination (I actually liked it). What I’m saying is that the hashgag has turned into a “pull in case of emergency” lever. When, six months out from release, the people behind the movie aren’t confident in how it’s turned out, they pull  it, because it’s safe and simple. Problem is, it cheapens the movie. It leads to a homogenization of the genre, where one movie chases the success of another by resorting to panicky, lowest-common-denominator filmmaking.

    tags: movies hashtag socialmedia weekly animation kids

  • “A joke tweet about a fake charity from The Colbert Report official account referencing, obliquely, Washington Redskins owner Daniel Snyder’s foundation to benefit Native Americans misfired and prompted a huge backlash. The problem? The lack of appropriate context surrounding a tweet endorsing the “Ching-Chong Ding-Dong Foundation for Sensitivity to Orientals or Whatever.” The ensuing call to get #CancelColbert to trend, sparked by digital activist Suey Park, turned into the kind of free-for-all trouncing of context and nuance, including a #GamerGate-subsidized backlash against the backlash, that only Twitter can provide.

    tags: twitter socialmedia weekly context

  • “These two environments, Twitter and Tumblr, have something important in common, which they share with most social media sites: they invite you to measure people’s response to you. For many people this probably means nothing, but on me it has always had an effect. Over the years I developed a sense of how many RTs a tweet was likely to earn, how many reblogs or likes a Tumblr post would receive – and I couldn’t help checking to see if my guesses were right. I never really cared anything about numbers of followers, and for a long time I think I covertly prided myself on that; but eventually I came to understand that I wanted my followers, however many there happened to be, to notice what I was saying and to acknowledge my wit or wisdom in the currency of RTs and faves. And over time I believe that desire shaped what I said, what I thought – what I noticed. I think it dulled my brain. I think it distracted me from the pursuit of more difficult, challenging ideas that don’t readily fit into the molds of social media.”

    tags: socialmedia likes currency shaping perception weekly

  • “The internet encourages us all into performative piety. People spend time online not just chatting or arguing, but also playing the part of the person they want others to see them as. Anyone who has run a news organisation will tell you that some stories are shared like crazy on social media, but barely read. Leader columns in newspapers used to show the same pattern: research showed that people liked to read a paper with a leader column in it – they just didn’t actually want to read the column.”

    tags: weekly socialmedia reality performance

Posted from Diigo. The rest of my favorite links are here.

Photography – Weeks 56 & 57

IMG_8308.jpg

crested gecko
There is something strange about geckos. This is my oldest son’s new pet. We’ve gone without pets for some time.

IMG_8246.jpg
Harder to see in this smaller size but I liked the shadows here. Hopefully I say this in a way that is different from the way people convince themselves they taste nuances in wine. I simply like the shadows. I would not pay extra money for them and would be happy if they came from light I bought at a gas station.

Beautiful wigs
There were a long series of these ads in large and small sizes. They felt a bit like folk art. It was pretty much the middle of nowhere yet the need for wigs must have been great.

dunes
It is hard to take pictures of dunes that don’t feel boringly repetitive. I’m not sure I succeeded here but I though the way the light hit the single dune like a spot light was worth capturing.

IMG_8191.jpg
I try to take pictures of this building often- usually from the highway. It’s a pretty cool building and this was taken at the end of a 12 hour car ride. The light at that time of night mixed with the street light and rain created an interesting effect.

inspecting dawn

driftwood
It was freezing cold when I took this shot. It was on the south end of the island and wind was blowing hard off the water. The whole place felt pretty surreal.

IMG_7928.jpg
Trying again to capture images that might be a bit interesting/original of subjects that have been done many times. The attempt here was to focus on the texture of the sand and water.

even feathers have weight
This is on the same end of the island. Even feathers here offered protection from the scouring wind. There’s probably something poetic there.

at rest

ferns macro
Many of the live oak trees on the barrier island had ferns growing on the limbs. I love things like that. Other than hurricanes, I think that life on a barrier island would be good.