Shallow Thoughts : : web
Akkana's Musings on Open Source Computing, Science, and Nature.
Mon, 17 Dec 2012
Conversation today with a bank person over the phone:
Me:
Can I get you to start sending me statements in the mail again?
Bank rep:
We've gone all online now! It's so easy and convenient!
Me:
I prefer to limit how much banking I do online, for security reasons.
Bank rep:
Oh, but we have two factor security! It's secure!
You can change your account name so it doesn't have to be your social
security number -- AND you can set a security question so only you can
reset your password!
Me:
Right.
(The conversation progresses. She promises to send me a statement,
but meanwhile it develops that there are some questions I need
answered that can't be done easily over mail and require an
online account. We proceed to set that up ...
Bank rep:
... and now you're at the password screen, right?
Me
(reviewing the list of security questions):
Um, you know that every one of your security questions is something
that anyone could look up, right? Last 4 digits of driver's license?
Last 4 digits of phone number? Last 4 digits of credit card?
Bank rep
(astonished):
What? Aren't there any that couldn't be looked up?
Me
(scanning through list again):
Well, the one on "last 4 digits of your best friend's phone number"
at least requires guessing who your best friend is before they
look up the number.
Seriously, every single one of their security questions was "last 4 digits of"
something that's either a matter of public record, or something that's
probably trivially available for $5 on shady websites.
Of course, you're thinking, you don't have to use the real 4-digit
numbers for any of these. No, of course you don't! You can make up
a number and use it as the answer for any of these.
In which case a better, more honest, security question would be:
"Please enter a 4-digit PIN."
Tags: security, web
[
14:59 Dec 17, 2012
More tech/web |
permalink to this entry |
comments
]
Tue, 07 Aug 2012
Quite a few programs these days use XML for their configuration files
-- for example, my favorite window manager,
Openbox.
But one problem with XML is that you can't comment out big sections.
The XML comment sequence is the same as HTML's:
<!-- Here is a comment -->
But XML parsers can be very picky about what they accept inside
a comment section.
For instance, suppose I'm testing suspend commands, and I'm trying
two ways of doing it inside Openbox's menu.xml file:
<item label="Sleep">
<action name="Execute"><execute>sudo pm-suspend --auto-quirks</execute></action>
</item>
<item label="Sleep">
<action name="Execute"><execute>sudo /etc/acpi/sleep.sh</execute></action>
</item>
Let's say I decide the second option is working better for now.
But that sometimes varies among distros; I might need to go back to
using pm-suspend after the next time I upgrade, or on a different
computer. So I'd like to keep it around, commented out, just in case.
Okay, let's comment it out with an XML comment:
<!-- Comment out the pm-suspend version:
<item label="Sleep">
<action name="Execute"><execute>sudo pm-suspend --auto-quirks</execute></action>
</item>
-->
<item label="Sleep">
<action name="Execute"><execute>sudo /etc/acpi/sleep.sh</execute></action>
</item>
Reconfigure Openbox to see the new menu.xml, and I get a
"parser error : Comment not terminated". It turns out that you
can't include double
dashes inside XML comments, ever. (A web search on
xml comments dashes will show some other amusing problems
this causes in various programs.)
So what to do? An Openbox friend had a great suggestion: use a CDATA
section. Basically, CDATA means an unparsed string, one which might
include newlines, quotes, or anything else besides the cdata end tag,
which is ]]>. So add such a string in the middle of
the configuration file, and hope that it's ignored.
So I tried it:
<![CDATA[ Comment out the pm-suspend version:
<item label="Sleep">
<action name="Execute"><execute>sudo pm-suspend --auto-quirks</execute></action>
</item>
]]>
<item label="Sleep">
<action name="Execute"><execute>sudo /etc/acpi/sleep.sh</execute></action>
</item>
Worked fine!
Then I had the bright idea that I wanted to wrap it inside regular
HTML comments, so editors like Emacs would recognize it as a commented
section and color it differently:
<!-- WARNING: THIS DOESN'T WORK:
<![CDATA[
<item label="Sleep">
<action name="Execute"><execute>sudo pm-suspend --auto-quirks</execute></action>
</item>
]]> -->
<item label="Sleep">
<action name="Execute"><execute>sudo /etc/acpi/sleep.sh</execute></action>
</item>
That, sadly, did not work. Apparently XML's hatred of double-dashes
inside a comment extends even when they're inside a CDATA section.
But that's okay -- colorizing the comments inside my editor is less
important than being able to comment things out in the first place.
Tags: web, xml
[
19:20 Aug 07, 2012
More tech/web |
permalink to this entry |
comments
]
Tue, 24 Apr 2012
When I upgraded to Firefox 11 a month or so ago, I got a surprise:
I couldn't invoke firefox from other applications any more.
Clicking on a link in an app such as xchat just gave me the Firefox
Profile Manager dialog, instead of opening the link in the browser
I was already running.
I couldn't find anything written about it, so I've been putting up
with it, copying each link then switching to the desktop where Firefox
is running and middleclick-pasting it into the browser. But this morning,
I did a new round of searching, and finally found the answer, in
bug 716110.
and its duplicate,
716361.
Quoting from bug 716110::
[The developers] changed the -no-remote flag's behavior in a
surprising, backward incompatible way. Before, it just meant "start a
new instance." Now, it also means "don't listen for remote commands."
Apparently the change went in for Firefox 9, because of
bug 650078.
Indeed, that was the problem. I have multiple Firefox profiles, so
I use -no-remote -P profilename when I start Firefox, so
each profile doesn't conflict with one that might already be running.
But with Firefox 9 or later, you can't do that. Instead, run your
first, primary profile without -no-remote; then if you start up other
profiles later, run them with -no-remote so they don't conflict with
the first one. That works okay for my typical usage, fortunately: I
have a main Firefox window I run all day, and only start up other
profiles for short periods.
But since not everyone uses this model, fortunately, some upcoming
Firefox version will fix the problem by adding a new runtime flag,
-new-instance, to do what -no-remote used to do:
start up a window for a new profile, rather than talking to the
running Firefox. Here's the new --help text:
| -no-remote | Do not accept or send remote commands; implies -new-instance.\n
|
| -new-instance | Open new instance, not a new window in running instance.\n
|
The web
Command
Line Options page doesn't seem to have been updated yet, but
perhaps it will when the Firefox with the fix is released.
Of course, it would have been much simpler if Firefox just honored
the -P flag and used whatever profile it was given, as suggested by a
commenter
in bug 650078. But bsmedberg replies that the complexity of the code
makes that difficult.
The new arguments look more sensible than the old -no-remote, though
it's frustrating that it was so hard to find information about changes
like this. All three bugs are filled with comments from people who,
like me, lost a lot of time trying to figure out what broke and how to
launch URLs remotely after the change. Thanks to Ryan for clarifying
the issue and filing the bug to fix the problem, and to Jed, who added
the new flag with his first Mozilla patch. Hooray for open source!
Tags: firefox, mozilla
[
10:26 Apr 24, 2012
More tech/web |
permalink to this entry |
comments
]
Sun, 09 Oct 2011
A group of us were commiserating about that widely-reviled
feature, Google Instant. That's the thing that refreshes your Google
search page while you're still typing, so you always feel like you
have to type reallyreallyfasttofinishyourquerybeforeitupdates.
Google lets you turn off Instant -- but only if you let them set and
remember your cookies, meaning they can also track you across the web.
Isn't there a more privacy-preserving way to get a simple Google
page that doesn't constantly change as you change your search query?
Disable Instant
It turns out there is. Just add complete=0 to your search
queries.
How do you do that? Well, in Firefox, I search in the normal URL bar.
No need for a separate search field taking up space in the browser window;
any time you type multiple terms (or a space followed by a single term)
in Firefox's URLbar, it appends your terms to whatever you have set as
the keyword.URL preference.
So go to about:config and search for keyword, then double-click on
keyword.URL and make sure it's something like
"http://www.google.com/search?complete=0&q=".
Or if you want to make sure it won't be overridden,
find your
Firefox profile, edit user.js (create it if you don't have one
already), and add a line like:
user_pref("keyword.URL", "http://www.google.com/search?complete=0&q=");
Show only pages matching the search terms
I use a slightly longer query, myself:
user_pref("keyword.URL", "http://www.google.com/search?complete=0&q=allintext%3A+"
Adding allintext: as the first word in any search query tells
Google not to show pages that don't have the search terms as part of
the page. You might think this would be the default ... but The Google
Works in Mysterious Ways and it is Not Ours to Question.
Disable Instant Previews
Finally, just recently Google has changed their search page again to
add a bunch of crap down the right side of the page which, if you
accidentally mouse on it, loads a miniature preview of the page over on
your sidebar. You have to be very careful with your mouse not to have
stuff you might not be interested in popping up all the time.
A moment's work with Firebug gave me the CSS classes I needed to hide.
Edit chrome/userContent.css in your Firefox profile (create it
if you don't already have one) and add this rule:
/* Turn off the "instant preview" annoying buttons in google search results */
.vspib, .vspii { display: none !important; }
Really, it's a darn shame that Google has gone from its origins as a
clean, simple website to something like Facebook with things popping
up all over that users have to bend over backward to disable.
But that seems to be the way of the web.
Good thing browsers are configurable!
Tags: firefox, mozilla, web, google, annoyances, user interface
[
21:31 Oct 09, 2011
More tech/web |
permalink to this entry |
comments
]
Fri, 30 Sep 2011
So everybody's complaining about that new Facebook ticker. You know,
the thing that sits on the right sidebar and constantly and distractingly
updates with stupid stuff you don't care about and wouldn't be able to
click on quickly enough even if you tried.
My mom forwarded me a link to a neat page she'd seen with instructions on
removing the ticker using Adblock Plus.
A good idea -- I hadn't thought about using Adblock, though it does
seem obvious in retrospect.
But I don't currently have Adblock installed in the profile I use for
Facebook -- I keep Facebook separate from my everyday browsing,
since I don't want Facebook tracking all the other sites I visit.
Could I do the same thing with userContent.css?
It turned out to be quite easy. Copying the exact pattern didn't work,
but a minute or two with Firebug told me the CSS class of the ticker.
I edited chrome/userContent.css in my profile. If you don't
have one already, just look for userContent-example.css and create
a new file in the same directory without the -example part, named
just userContent.css. I added this line:
.tickerOnTop { display: none !important; }
Restart firefox, and presto! No more ticker.
Tags: web.firefox, mozilla, annoyances, user interface
[
20:58 Sep 30, 2011
More tech/web |
permalink to this entry |
comments
]
Tue, 16 Aug 2011
Google has been doing a horrible UI experiment with me recently
involving its search field.
I search for something -- fine, I get a normal search page page.
At the top of the page is a text field with my search terms, like this:
Now suppose I want to modify my search. Suppose I double-click the word
"ui", or drag my mouse across it to select it, perhaps intending to
replace it with something else. Here's what happens:
Whoops! It highlighted something other than what I clicked, changed the
font size of the highlighted text and moved it. Now I have no idea what
I'm modifying.
This started happening several weeks ago (at about the same time they
made Instant Seach mandatory -- yuck). It only happens on one of my
machines, so I can only assume they're running one of their
little
UI experiments with me, but clearing google cookies (or even banning
cookies from Google) didn't help.
Blacklisting Google from javascript cures it, but then I can't
use Google Maps or other services.
For a week or so, I tried using other search engines. Someone pointed
me to Duck Duck Go, which isn't
bad for general searches. But when it gets to technical searches,
or elaborate searches with OR and - operators, google's search
really is better. Except for, you know, minor details like not being
able to edit your search terms.
But finally it occurred to me to try firebug. Maybe I could find out
why the font size was getting changed. Indeed, a little poking around
with firebug showed a suspicious-looking rule on the search field:
.gsfi, .lst {
font: 17px arial,sans-serif;
}
and disabling that made highlighting work again.
So to fix it permanently, I added the following
to chrome/userContent.css in my Firefox profile directory:
.gsfi, .lst {
font-family: inherit !important;
font-size: inherit !important;
}
And now I can select text again! At least until the next time Google
changes the rule and I have to go back to Firebug to chase it down
all over again.
Note to Google UI testers:
No, it does not make search easier to use to change the font size in
the middle of someone's edits. It just drives the victim away to
try other search engines.
Tags: tech, google, css, web
[
21:05 Aug 16, 2011
More tech/web |
permalink to this entry |
comments
]
Mon, 09 May 2011
Mostly the transition to Firefox4 has pretty smooth. But there's been one
big hassle: middlemouse content load URL doesn't work as well as it used to.
Middlemouse content load is a great Firefox feature on Linux and other Unix
platforms. You see a URL somewhere that doesn't have clickable URLs --
say, a plaintext mail message, or something somebody typed in IRC.
You highlight it with the mouse --
no need to Copy explicitly -- X does that automatically whenever you
highlight text). Then move to the Firefox window and click the middle mouse
button somewhere in the content window -- anywhere as long as it's not
over a link or text input -- and Firefox goes straight to the URL you pasted.
A few silly Linux distros, like Ubuntu, disable this feature
by default. You can turn it back on by going to about:config,
searching for middlemouse, and setting
middlemouse.contentLoadURL to true.
Except, in Firefox 4, much of the time nothing happens. In Firefox 4,
contentLoadURL only works if the URL you pasted is a complete URL,
like http://example.com. This is completely silly, because
most of the time, if you had a complete URL, it would have been
clickable already in whatever window you originally found it in.
When you need contentLoadURL is
when someone types "Go to example.com if you want to see this".
It's also great for when
you get those horrible Facebook or Stumbleupon or Google URLs like
http://www.facebook.com/l/bfd4f/example.com/somelink
and you want just the real link (example.com/somelink),
without the added cruft.
Hacking the jar
Hooray! It turns out the offending code is in browser.js,
so it's hackable without needing to recompile all of Firefox.
You just need to unpack omni.jar,
patch browser.js, then zip up a new omni.jar.
In other words, something like this (on Ubuntu Natty,
starting in an empty directory):
$ cp /usr/lib/firefox-4.0/omni.jar ~/omni-jar.sav
$ unzip /usr/lib/firefox-4.0/omni.jar
[ edit or patch chrome/browser/content/browser/browser.js ]
$ rm -f /tmp/new-omni.jar; zip /tmp/new-omni.jar `find .`
$ sudo cp /tmp/new-omni.jar /usr/lib/firefox-4.0/omni.jar
Getting Firefox to notice code changes
Except, as I was testing this, I discovered: I could make changes and
most of the time Firefox wouldn't see them. I would put in something
obvious like alert("Hello, world");, verify that the alert
was really in omni.jar, run Firefox, click the middle mouse button and --
no alert. Where was Firefox getting the code it was actually running,
if not from omni.jar?
I'll spare you the agonizing details of the hunt and just say that
eventually I discovered that if I ran Firefox from a different profile
on the same machine, I got a different result.
It turns out that if you remove either of two files,
extensions.sqlite and XUL.mfasl,
Firefox4 will re-read the new code in omni.jar.
Removing XUL.mfasl seems to be a little safer: extensions.sqlite
contains some details of which extensions are enabled.
Of course, back up both files first before experimenting with
removing them.
Why these files are keeping a cache of code that's already in omni.jar is
anybody's guess.
The Patch: fix contentLoadURL
Oh, and the change? Mikachu came up with a cleaner fix than
mine, so this is his. It accepts partial URLs like
example.com and also bookmarklet keywords:
--- browser.js.sav 2011-05-07 16:40:03.672540242 -0700
+++ omni/chrome/browser/content/browser/browser.js 2011-05-08 16:29:28.943313984 -0700
@@ -10597,12 +10597,10 @@
clipboard.replace(/\s*\n\s*/g, "");
let url = getShortcutOrURI(clipboard);
- try {
- makeURI(url);
- } catch (ex) {
- // Not a valid URI.
- return;
- }
+ var URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
+ .getService(Components.interfaces.nsIURIFixup);
+ url = URIFixup.createFixupURI(url, 1).spec;
+ // 1 is FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP
try {
addToUrlbarHistory(url);
Tags: firefox, mozilla, programming, browsers
[
19:28 May 09, 2011
More tech/web |
permalink to this entry |
comments
]
Mon, 05 Jul 2010
We had a server that was still running Debian Etch -- for which
Debian just dropped support.
We would have upgraded that machine to Lenny long ago except for one
impediment: upgrading the live web server from apache 1 to apache 2.2.
Installing etch's apache 2.2.3 package and getting the website running
under it was no problem. Debian has vastly improved their apache2 setup
from years past -- for instance, installing PHP also enables it now,
so you don't need to track down all the places it needs to be turned on.
But when we upgraded to Lenny and its apache 2.2.9, things broke.
Getting it working again was tricky because most of the documentation
is standard Apache documentation, not based on Debian's more complex setup.
Here are the solutions we found.
Enabling virtual hosts
As soon as the new apache 2.2.9 was running, we lost all our
websites, because the virtual hosts that had worked fine on
Etch broke under Lenny's 2.2.9. Plus, every restart complained
[warn] NameVirtualHost *:80 has no VirtualHosts.
All the web documentation said that we had to change the
<VirtualHost *> lines to
<VirtualHost *:80>. But that didn't help.
Most documentation also said we would also need the line:
NameVirtualHost *:80
Usually people seemed to find it worked best to put that in a newly
created file called conf.d/virtualhosts. Our Lenny upgrade had
already created that line and put it in ports.conf, but it
didn't work either there or in conf.d/virtualhosts.
It turned out the key was to remove the NameVirtualHost *:80
line from ports.conf, and add it in sites-available/default.
Removing it from ports was the important step: if it was in ports.conf
at all, then it didn't matter if it was also in the default virtual host.
Enabling CGI scripts
Another problem to track down: CGI scripts had stopped working.
I knew about Options +ExecCGI, but adding it wasn't helping.
Turned out it also needed an AddHandler, which I
don't remember having to add in recent versions on Ubuntu.
I added this in the relevant virtual host file in sites-available:
<Directory />
AddHandler cgi-script .cgi
Options ExecCGI
</Directory>
Enabling .htaccess
We have one enduring mystery: .htaccess files work without needing
a line like AllowOverride FileInfo anywhere. I've
needed to add that directive in Ubuntu-based apache2 installations,
but Lenny seems to allow .htaccess without any override for it.
I'm still not sure why it works. It's not supposed to. But hey,
without a few mysteries, computers would be boring, right?
Tags: web, apache, debian
[
20:46 Jul 05, 2010
More tech/web |
permalink to this entry |
comments
]