includes v. indexOf

Noticed some Javascript was breaking only in IE. Must have forgotten: Instead of string.includes use string.indexOf(‘x’)>-1.

Or better yet add the polyfill noted on the MDN String.prototype.includes() page!

Posted in dev, Uncategorized | Comments closed

Bashing

There’s always something satisfying to solving problems, even small ones, via programming.

As chief cook and bottle washer on my work site, I’m not only architecting, designing, coding and programming, but also frequently preparing new content. Often this content comes with its own small headaches.  For instance, we receive product image files from vendors whose file names begin with the product ID (good) but end with some other text (bad).  With a few files of course the fastest fix is just to edit the titles directly, but when scores (or hundreds, or thousands) need fixing, it’s time to automate.

I could write a PHP CLI script for this, and it would be a good time to explore Node; but then again, Bash is there at hand.  Simple is usually (always?) best.

I’m not a Bash pro, though I’m on the command line all the time. Fortunately the Internet is at our fingertips. Shell script lookup! The need to learn is an itch needing a scratch.

Just a few lines: Iterate the files, split the file names on spaces or whatever, mv to the new name, and Robert remains your mother’s brother.

Posted in Uncategorized | Comments closed

Product Slideshow Revisited

It’s been awhile since my last post; clearly I’m not a natural blogger.  Most of life seems ok by itself without clothing (cloaking?) it in meta.  But then again….

Noticed awhile ago I posted about improving the Image Conscious web site by changing the slideshow image generation from manual layouts to a programmatic rotation through an array of slides, each of which pulls up another array of product shots already on the web site, in other words updating it became as easy as updating an array, avoiding all that tedious mucking about in InDesign (apologies to the heirs of Douglas Adams, and Adobe – nothing against the mighty and fine InDesign program, which I love).

That was a huge improvement, and a real timesaver.  However, the spiffiness began to pall as I still had to plug in array values for the image scaling – the images would auto-size themselves to the same height, but horizontal ones could look huge, vertical ones would look small, etc.  I’d upload the array of product IDs and then spend a bunch of time adjusting the scaling values over and over again.  Tedious to say the least. Time for a rewrite!Screen Shot 2015-02-19 at 8.21.28 PM

The new code now finds the image set for a given slide, polls their dimensions, works out their proportions, figures out scaling factors to equalize their area ( = visual size), then works out a second scaling factor so the group fits in the slide area.  Less tedium for me, a nice head-scratching little coding project, and more rapid updates.  Miles better!

Posted in design/art, self-promotion, webdev | Comments closed

AcademyX JS for Programmers + jQuery Brush-Ups

Just completed two courses at AcademyX SF: Javascript for Programmers and JQuery Fundamentals, both very ably taught by Ben Jaffe. The classes were a great review of both. There are always things to catch up on, techniques I just haven’t used before; plus I’m always rotating between PHP, HTML/CSS not to mention Photoshop and InDesign. Time to write some code and hammer it all in with some practice!

I was checking some code with “console.log(‘blar’)” and Ben mentioned he usually uses “blarg,” so the log is blarging or not. Blarging seems better than blarring, right? Learn something every day.

The jQuery team deserves a pony for putting out such an awesome set of tools. I’ve got to review my code and see where I can use some judicious JS/jQuery to thin out some tortuous server-side code here and there.

Posted in design/art, education | Comments closed

AcademyX Marks the Spot

Started the PHP/MySQL web developer course at AcademyX last night.

The instructor Ron obviously knows way more than is healthy about HTTP and server protocols, and is eager to communicate what he knows — I’m getting a dose of my own medicine from cramming way too much Photoshop into hapless students on a bimonthly basis for the last dozen years. Poetic justice!

So far so good, next topics are Apache and IIS. But I’m bracing for the MySQL portion, hope I have the brain cells to spare! In any case it will be productive to get on things that I can do, but in which I need more practice and confidence.

Posted in education | Tagged | Comments closed

new multilayer 3-d vertical scroll effect


AirBNB Jobs page graphicCheck out the jobs page on the  AirBNB web site. There’s a multilayer vertical scroll effect emulating depth which I have never seen before.

It’s visually pretty rocking-cool.  I wonder where else it’s being used, if anywhere — I don’t recall seeing it elsewhere.  Very cool!

Posted in design/art | Tagged | Comments closed

A better slideshow for Image Conscious

Image Conscious slide show

Yesterday I rewrote the code for the slide show / carousel on my site at Image Conscious.

Up till now I’ve had a bit of a process for updating the content on the slide show, which frankly was seriously making it hard to promptly deliver changes.  It involved gathering product shots, building an InDesign layout, exporting each page individually to JPG, renaming for scripting purposes, and uploading the image files to the site.

Now all I have to do to update slide show content is change an array of headlines, slide show links, and product shot image paths (the products shots are all on the site already). The script takes care of scaling the links for height and width, plus an optional array element allows for scaling of individual images in case some should be smaller than others.

Much as I like InDesign, I’d rather script content on the web, and the total pixel weight is less this way too. That’s rating a yay from me.

Posted in design/art, Uncategorized | Tagged | Comments closed

Photoshop Workshop

It’s that time again. Teaching my longtime Beginning Photoshop workshop the next two Saturdays at Kala Art Institute — which has many more interesting classes besides.

Posted in self-promotion | Tagged | Comments closed

San Francisco Silent Film Festival event: Napoleon

Apparently the Holy Grail of silent film experiences, the current restoration of Napoleon plays at the Paramount Theatre in Oakland this weekend and next.

My web site for The San Francisco Silent Film Festival has been holding up well so far, fun to watch the Google Analytics logs with all of the media attention driving traffic to the site.

Can’t wait to see the film!

 

Posted in design/art, self-promotion | Tagged | Comments closed

XSS attempt = captcha

Seems that a hacker finally had a go at the silentfilm.org press accreditation form, about 100 attempts in a minute or so. Hopefully some basic newline character filtering stymied them, and the new recaptcha widget will slow future attempts.

Posted in design/art | Comments closed