Posted by & filed under Code Tips.

Quick little snippet to toggle the value of a checkbox with jQuery.

jQuery('#checkbox_id').prop('checked', !jQuery('#checkbox_id').prop('checked'));

I needed this a couple days ago using a span with a font awesome image to take the place of a checkbox. Still needed an actual checkbox underneath for the form handler to work with. So I used this little piece of code to toggle the state of a hidden checkbox and then used the state of that checkbox to determine what CSS class to use for the fake checkbox.

Posted by & filed under Programming.

Is XAMPP slow?

I’ve used XAMPP for pretty much as long as I’ve been doing web development. It makes it trivial to get Apache, MySQL, and PHP set up.Since upgrading from Windows 7 to Windows 10 though I’ve noticed it was running much slower. I just assumed that XAMPP is slow. There was also an upgrade to XAMPP as part of that, although I don’t remember what versions.

The slowness was especially noticeable working on Moodle plugins. It was almost unusable, although that’s not too surprising with the 250-300 database tables that Moodle uses.

Googling brought a bunch of potential solutions

  • Disable IPv6
  • Edit hosts file to point to localhost
  • Exclude Apache, MySQL, and PHP from firewall

And all of these seemed to help just a little bit, but so little that it could have just been psychological. Read more »

Posted by & filed under WordPress.

Always Edit in HTML Plugin ScreenshotThis is another one of those plugins that I’d thought about writing and Google kept me from needing to.

Sometimes when building a WordPress site I’ll need to create pages using straight HTML instead of the WYSIWYG editor. Without fail though I’ll accidentally click on the Visual tab and the editor will clear out most of my HTML I’ve thought that it would be nice to be able to disable the visual editor, but only for specific posts. Turns out, I wasn’t the only one.

The Always Edit in HTML WordPress plugin takes care of it.

Take a look at the screenshot on the right. Check the box and save your post and the visual editor is gone. Nothing to foul up the HTML.

Posted by & filed under Computers & Internet.

Epson DS-510 ScannerA couple of months ago we bought an Epson DS-510 scanner. Although I haven’t run it long enough to know how well it holds up, it’s been doing really well so far.

One big snag though. The goal was to scan receipts. And most of the time it worked flawlessly. But really long receipts would always jam, even though it’s supposed to support scans up to 36 inches. And it wasn’t really even jamming. It was just stopping and showing a jam message.

Thanks to a comment reply on Amazon I discovered it’s not really jamming. It’s just that the scanner only scans up to about 16 inches if auto paper size is selected. By changing from auto size to a manually selected size it scans longer receipts without a hitch.

Posted by & filed under Moodle.

Moodle LogoIt’s happened at least a dozen times. I’ll punch in a bunch of short answer questions into Examview so that I could inmport into Moodle. Then I go through the hoops of exporting it from Examview into Blackboard so I can import into Moodle.

Then, I remember. Moodle imports short answer questions exported like this as an essay question. That means that the automatic grading doesn’t work.

Apparently this is a pretty common issue. I came across an explanation in the Moodle forums explaining why it works that way, and I totally get the reason. But it’s still annoying.

Turns out all of the explanations stop a little short of a quick and easy fix. Instead of creating short answer questions in Examview, create Completion questions. The fields in Examview are exactly the same. You type in the question on the top and the answer on the bottom. But, when Moodle imports them they come in as Short Answer along with all the automatic grading goodness.

Posted by & filed under Coding.

Spent more time than I’d like to admin banging my head against my keyboard when NetBeans wouldn’t minify a specific JavaScript file. Instead of correctly minifying, the minified version would end up blank.

Finally got frustrated enough to start tracking it down and found the cause in the line 2 pasted here.

Turned out that I was using a keyword as a property name. Wrapping class in quotes cleared everything up and NetBeans is happily minifying away again.



Posted by & filed under Coding.

For a project that I’m working on I needed a way to fade out an image before overlaying text on to it. Text I’ve done. That’s not an issue. But I haven’t ever done anything with PHP with fading out an image.

Turns out there’s a library called Jaguar that makes it, and other image manipulation, really easy for PHP.

The code below loads an image and covers it with a white overlay to fade it out.

I left out the part where the text is added, but Jaguar makes adding text pretty easy as well.

And if you’re interested, the final result is used on the featured image on a font website that I’m setting up.

Posted by & filed under Computer Science, teaching.

I’ve been using NetBeans to teach Computer Science for a while now, but it’s always seemed a bit heavy. Came across a post on the Oracle blogs with a few tips for making NetBeans a little more classroom friendly. So here are a few tips from there along with a couple of tips I’ve come up with along the way.

Alt-Mouse Wheel Let’s you enlarge and shrink the font. I have a “Screen” setting for fonts for display and another for when I’m working without kids watching. But alt-scroll works really well when a student asks me a question about their code. Makes it easier to see their code.

Alt-Shift-Enter Swap to full screen. No menu bars. Gives me a little more space on the screen.

Ctrl-Shift-Enter Puts NetBeans into a presentation mode that shows only the code window without all of the other mess.

Alt-Shift-F Auto formats the code. Cleanly formatting code is something that students always struggle with. Auto formatting the code makes it much easier to help them.

A Perfect Editor?


What I’d really like is some way, short of writing a plugin for NetBeans, that would strip out some of the menu options that aren’t needed for teaching new coders. That may be my next step though.

Posted by & filed under Moodle, teaching.

For a review leading into AP testing I like to give my students a review test where they’ll take a set of 5 questions out of a banks of a few hundred. To get a grade, they’ll need to get 80% or higher a set number of times. This six weeks we’re doing 2 points per attempt with a score of 80% or higher, up to 120 points for a test grade. So if they get an 80 or higher 53 times between now and the end of the six weeks I’ll put a 106 in the gradebook.

Catch is that it’s really time consuming for me to go through and count how many attempts 100 plus students tried.

Enter a plugin for Moodle called ad-hoc database queries.

With the plugin you can write SQL that’s run on your Moodle database and it will kick out a table with the results. The SQL below is what I used.

A couple of things to add that aren’t there yet is I’d like to add a prompt for the course ID. Right now it’s prompting for the module ID and the minimum grade you want to count. And, it’d be nice if it would sort by groups instead of just lumping everybody together.

But for now, it’s still way better than scrolling through and counting.

Posted by & filed under Coding, WordPress.

I’ve usd the 320press Bootstrap WordPress theme as a parent theme on a couple of projects, including this site. Overall, it’s great. But there’s been one little nagging “feature” that I’d like to get rid of.

The theme adds a lead class to the first paragraph of each post. And the parent CSS for .lead causes the text to be bigger than the rest of the paragraphs.

On this site I just put an !important tag in my child CSS for .lead to make it the same size. But that didn’t feel like a clean enough solution.

What I’ve done on another site, and it works without a hitch, is to take out the filter that the parent theme is using to put .lead on the first paragraph. The code below goes in the functions.php file for your child theme.

[snippet id=”344″]

I had tried to remove the filter before, but it has to go inside something called after both themes load since the child functions.php file is loaded first.