Wednesday, May 31, 2017
Friday, May 26, 2017
css children
Nothing too rocket-sciency, but I decided to try messing with CSS for showing and hiding things based on if 1, 2, or 3 buttons are showing, rather than using scripting logic: the first one shows something different if the button is the only one, the second set is a way of saying "I have exactly two things here" (in this case, if there's only a single button it's not the one I'm worried about"
.fixedButtonBar .fixedButton:last-child{
border-right: none;
}
.fixedButtonBar .fixedButton:only-child .multipleButtonCaption {
display: none;
}
.fixedButtonBar .fixedButton:not(:only-child) .singleButtonCaption {
display: none;
}
.hideWhenCramped {
display:none;
}
/* when exactly two items */
.fixedButtonBar .fixedButton:nth-child(1):nth-last-child(2) .hideWhenCramped,
.fixedButtonBar .fixedButton:nth-child(2):nth-last-child(1) .hideWhenCramped {
display:inline-block;
}
/* when exactly two items */
.fixedButtonBar .fixedButton:nth-child(1):nth-last-child(2) .showWhenCramped,
.fixedButtonBar .fixedButton:nth-child(2):nth-last-child(1) .showWhenCramped {
display:none;
}
I guess it might be a little too clever-clever. I liked it over the scripting approach in part because I would have had to repeat calculations to count which buttons were showing, but I'm not sure this css states its intentions very clearly
Thursday, May 25, 2017
sending via gmail smtp
Just some quick notes, nothing canonical:
I was trying to use PHP's built in mail, and my server's sendmail, and stuff to my work address arrives but stuff to gmail just got devoured; I guess they don't trust my server even enough to stamp stuff Spam!
I install Pear Mail and the NET_smtp thingy, and then I had Allow Less Secure Apps - and I think maybe Display Unlock Captcha.
Not crazy about having my private password so close to my source code, tbh.
I was trying to use PHP's built in mail, and my server's sendmail, and stuff to my work address arrives but stuff to gmail just got devoured; I guess they don't trust my server even enough to stamp stuff Spam!
I install Pear Mail and the NET_smtp thingy, and then I had Allow Less Secure Apps - and I think maybe Display Unlock Captcha.
Not crazy about having my private password so close to my source code, tbh.
Monday, May 22, 2017
this...is...JEOPARDY...sort of...
Helped my GF make up a version of Jeopardy for an ice breaker for her company using GameshowMaker (this newer version has a few skins to make it look like various other shows as well.) A little old, and some of the setup is fiddly (and kind of weird, how like the show-specific .ini file you load in for the skin overrides the settings you have in the main setup, and also by default the space allotted for Category names is WAY smaller than Jeopary standard) and it's all Flash, but still, if you need a quick thing that can be run locally or online, it is pretty solid.
Friday, May 12, 2017
when character encodings attack!
Last year I made up a new one-page-app version of the Somerville Porchfest Site, and it survived the onslaught of people hitting the site that day, unlike in previous years.
This year I ran into weird late minute problems as they changed how my files were served up. One was that the "bands.json" file was somehow turned into a html redirect message. My hack for that was to have the process that cleaned the JSON prepend a "var bandjson =" to it and then include the file as .js
But then things were still crashing and burning Autolinker.js, or rather. Autolinker.min.js , was crapping out in the console, with an "Uncaught SyntaxError: Invalid regular expression:" followed by a whole lot of goobly-gook.
Long story short the problem wasn't in how Autolinker.min.js was served, but rather the encoding used in the index.html page. When I got my apache server, it had the default of UTF-8 for everything in the headers, so it had a line like
Content-Type:text/html; charset=UTF-8
But their server only had text/html.
Adding this to the <head> seemed to fix it:
seems a little weird this can be fixed either as a server config or a page thing, but that's the way of the world.
This year I ran into weird late minute problems as they changed how my files were served up. One was that the "bands.json" file was somehow turned into a html redirect message. My hack for that was to have the process that cleaned the JSON prepend a "var bandjson =" to it and then include the file as .js
But then things were still crashing and burning Autolinker.js, or rather. Autolinker.min.js , was crapping out in the console, with an "Uncaught SyntaxError: Invalid regular expression:" followed by a whole lot of goobly-gook.
Long story short the problem wasn't in how Autolinker.min.js was served, but rather the encoding used in the index.html page. When I got my apache server, it had the default of UTF-8 for everything in the headers, so it had a line like
Content-Type:text/html; charset=UTF-8
But their server only had text/html.
Adding this to the <head> seemed to fix it:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
Thursday, May 11, 2017
the allure of facebook
I was thinking about the allure of Facebook. Previously I attribute it's dominance to a combination of "stream/wall" (ala Twitter, Tumblr, Instagram) with real identities, a strong bias to guide you to connect with people you know in real life vs anonymous internet strangers. But there's something else: the "also commented on X's post" notification. I just now posted a second comment on friend's post on feeling blue and the seemingly masochistic desire to watch or listen to sad stuff there, two passages relevant to the topic (this passage and the Mr. Blue thing it links to) and it feels great that I know people interested in that topic will get a nudge and probably see what I put there. Old school web forums have this feature but they don't have the stream that brings content front and center, or the "real world friend" aspect.
(Heh, I remember when I would read Usenet on an old academic account, I had a perl script that would scrape and find me continuations of threads I had participated in.)
(Heh, I remember when I would read Usenet on an old academic account, I had a perl script that would scrape and find me continuations of threads I had participated in.)
Wednesday, May 10, 2017
unpaid plug - testing old browsers with ease
My company started using BrowserStack, that looks like its giving a full-browser-screen pass through to a little VM to test old browsers without setting up the damn OS. Super easy to use.
Also, I wrote their support suggesting that dialog would be improved with tooltips showing what % of the market different versions are, and what year the browser came out.
w3schools browser info shows that - wow, IE/Edge and Safari are both separately less than 5% of the traffic? Huh, wonder if that is desktop only though... I know a lot of companies see about a 50/50 desktop/mobile split, with mobile on the rise...
Also, I wrote their support suggesting that dialog would be improved with tooltips showing what % of the market different versions are, and what year the browser came out.
w3schools browser info shows that - wow, IE/Edge and Safari are both separately less than 5% of the traffic? Huh, wonder if that is desktop only though... I know a lot of companies see about a 50/50 desktop/mobile split, with mobile on the rise...
Tuesday, May 9, 2017
k.i.s.s.: too long command lines in bash etc
So for my porchfest work I was making up a thumbnail using ImageMagick, but there were so many files I was running into errors since it was bigger than whatever buffer bash was using. I thought I'd have to learn xargs or something fancy... But then I realized I could just make a bunch of short lines, each ending with a \\ and then a \n , and that copy and pasted fine.
Monday, May 8, 2017
a rant against arcane js syntax
Elements of JavaScript Style -- I'm having trouble wrapping my head around #2 there, "Omit needless code", where
function secret (message) {
return function () {
return message;
}
};
is considered blatantly inferior to
const secret = msg => () => msg;
I remember one of the reasons people starting dumping on Perl (and just dumping Perl) was because of arcane syntax... I think there's a strength in looking like other languages.
I guess some of the problem is the trivialness of the currying example - even without the syntax that will be less familiar to people steeped in other languages the need for a curry (mm, curry) is a little arcane to begin with - and in this example, it's not even clear where functional code would sit! Like if the original was
function secret (message) {
return function () {
return message.split("").reverse().join("");
}
};
A coworker says that would boil down to
const secret = message => () => message.split('').reverse().join('')
There's something anti-egalitarian in use of this much bleeding edge syntax.
function secret (message) {
return function () {
return message;
}
};
is considered blatantly inferior to
const secret = msg => () => msg;
I remember one of the reasons people starting dumping on Perl (and just dumping Perl) was because of arcane syntax... I think there's a strength in looking like other languages.
Concise code is critical in software because more code creates more surface area for bugs to hide in. Less code= fewer places for bugs to hide = fewer bugs.This reminds me of a scifi story that talked about an alien language that was SO EFFICIENT that they could say in a single, accented, nuanced word what a human would need to say in a sentence or a paragraph.The trouble is that kind of sci-fi think misses the reality that redundancy in a language is a feature, not a bug; for example, it means the meaning is likely to be preserved over "noisy transmission" - like when someone isn't paying full attention, for example, or when fidelity over the wire isn't perfect.
Concise code is more legible because it has a higher signal-to-noise ratio: The reader must sift through less syntax noise to reach the meaning. Less code = less syntax noise = stronger signal for meaning transmission.
I guess some of the problem is the trivialness of the currying example - even without the syntax that will be less familiar to people steeped in other languages the need for a curry (mm, curry) is a little arcane to begin with - and in this example, it's not even clear where functional code would sit! Like if the original was
function secret (message) {
return function () {
return message.split("").reverse().join("");
}
};
A coworker says that would boil down to
const secret = message => () => message.split('').reverse().join('')
There's something anti-egalitarian in use of this much bleeding edge syntax.
Subscribe to:
Posts (Atom)