A quick way to keep your accounts from getting hi-jacked or otherwise vulnerable to security risks is to take care of passwords in cleartext in e-mails.
What do I mean by that? Well, often when you reset your password on a website, they’ll send you an e-mail back with a one-time-use link for resetting your password via the website itself. However, some poorly-written websites will just send you your username and password in a normal e-mail that could be sniffed by a hacker as it’s being sent.
Frankly, the website shouldn’t even have your password in a non-encrypted form. The proper way they should have their site set-up is to store your password in an encrypted form, then when you type it in to log in, they encrypt and check the password entered against your encrypted password in their database
To fix this:
Then, I would boycott the site(s) that violated your password privacy. If you really must use a particular site, you could give it a completely unique password and write it down somewhere safe (I suggest an online note-taking tool so that you have access to it wherever you have Internet access).
That’s it! repeat every once in a while, or just watch for new e-mails with passwords in them. Some services will send your password monthly (i.e. the MailMan mailing list server), so those are ones that should definitely be unique.
Until next time… good luck!
In my recent exploration of jQuery, I came across the need to walk the DOM tree, depth-first.
After playing around in FireBug, I came up with an ad-hoc soltution that involves:
.offset() to figure out where my element positions were going fractional)The initial code I entered into FireBug for it looked like this:
// sets the first node var node = $('body'); // walks to the next element and spits it and it's offset out; // repeat as many times as you want (until the node is "[]" and the offset is "0, 0") [ node = (node.children(':first')[0]) ? node.children(':first') : ( (node.next()[0]) ? node.next() : node.closest(':not(:last-child)').next() ), node.offset() ];
And it worked! From my tests, it walks each node, as expected.
Then I got to thinking. This would be useful all over. I could… make it a jQuery-ized function! So I tried this:
jQuery.fn.walk = function() { var firstChild = this.children(':first'); if (firstChild[0]) { return firstChild; } else { var nextSibling = this.next() if (nextSibling[0]) return nextSibling; else return this.closest(':not(:last-child)').next(); } }
Then you just walk from the initial element node like this:
node = node.walk();
Once I had this working, I thought, “I can do better still”. After poking around on John Resig’s blog a bit, and playing with different ways of allowing an expression for an argument, I realized that this is either going to be really slow (by grabbing all the elements in the document and finding the next logical one) or really really slow (by using recursion in a fashion similarto above). It might be plausible with full XPath, but I just don’t know enough about Sizzle to make it work efficiently.
Perhaps someday, though! For now, it’s pretty easy to just put the walk in a loop until you get the element type you’re looking for. Best of luck and be sure to correct me if I’m doing this “the hard way”!
I’ve often longed for a way to render something or redirect_to somewhere and finish the action’s execution at that point. Often, I resort to something messy like this:
if cant_move render :nothing => true return end
While playing with Rails today, I realized that there’s no reason (in the world of Ruby) that this shouldn’t work instead:
return render :nothing => true if cant_move
And it does work! I don’t know what it returns (if anything), but it doesn’t matter, since Rails doesn’t do anything with it. It looks a little funny at first with the return ren... in there, and although many Rubyists aren’t a huge fans of using the return keyword, it’s necessary for an “early-out” situation like this.
Now I need to go refactor a bunch of my code…
I’ve recently made the jump to using tests in Rails (2.3 as of this writing); coming from a background in game development, I’ve long stuck to the principle of “build it now, have QA test it later”. However, there comes a time in every programmer’s life when they feel the need to “code smarter, not harder”.
In the process of getting tests into one of my in-development apps, I came across one particular blunder. When trying to run rake test:units for the first time, I received this lovely output:
(in /Users/slippyd/Sites/orgclut2)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/specific_thing_test.rb" "test/unit/helpers/nodes_helper_test.rb" "test/unit/invite_test.rb" "test/unit/mailer_test.rb" "test/unit/node_test.rb" "test/unit/cool_thing_test.rb" "test/unit/pile_test.rb" "test/unit/nifty_thing_test.rb" "test/unit/thing_test.rb" "test/unit/rad_thing_test.rb" "test/unit/better_thing_test.rb" "test/unit/awesome_thing_test.rb" "test/unit/user_test.rb"
Loaded suite /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
EEEEEEEEEEEEEEEEEEEEEEEE
Finished in 0.204718 seconds.
1) Error:
test_the_truth(SpecificThingTest):
ActiveRecord::StatementInvalid: Mysql::Error: Table 'orgclut2_test.things' doesn't exist: DELETE FROM `things`
...
24) Error:
test_should_unset_remember_token(UserTest):
ActiveRecord::StatementInvalid: Mysql::Error: Table 'orgclut2_test.things' doesn't exist: DELETE FROM `things`
24 tests, 0 assertions, 0 failures, 24 errors
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]
Immediately, I knew the cause of the problem, my abstract parent class, “Thing”:
class Thing < ActiveRecord::Base self.abstract_class = true def self::class_from_type(type) if type.instance_of?(Class) && type.superclass == Thing type else type = type.to_s.classify type << 'Thing' unless type.match(/Thing$/) type = type.constantize end end # ... end
After Googling for a bit and only finding some hints as to the solution (apparently, there aren’t as many people using abstract_class as there are using STI), I tried deleting my Thing fixture (test/fixtures/things.yml).
Voila! All is well again in Test-Land. I hope this helps any future Rubyists who come across this some problem.
You want your website’s liquid/flexible-width or more-narrow-than-normal fixed-width layout to use a smaller width on mobile platforms with zoomable bowsers (i.e. iPhone OS, Android, WebOS).
Check the user-agent string (server-side or with JavaScript) for one of the pre-existing zoomable browsers and enforce the width.
It will break for any browser (past, present, or future) that you didn’t account for. It will probably break if a future device has a screen sizeIt may break if somehow, the user-agent check matches a non-zoomable browser.
Check if the rendered page’s width is larger than the browser window’s width. Also check if the browser’s screen width is less than the minimum width that your site needs in order to render correctly. If both of these are true, insert the necessary <meta name="viewport" .../> tag.
Include this snippet in a JavaScript file that’s referenced between the <head> tags:
// Platform-Independent Zoomable Screen Detection // Copyright 2009 Slippy Douglas. // No rights reserved other than making sure this is free to use, modify, redistribute, whatever for forever and ever. // set the minimum width your site needs to render properly here var kPageMinWidth = 320; function writePageMinWidthAdjustment() { // if the screen's width is smaller than the page's width // (i.e. a zoomable mobile device like the iPhone) if (window.screen.width < window.innerWidth) { // set the meta-data to the larger of the device's width or the minimum the site needs newWidth = Math.max(kPageMinWidth, window.screen.width); // will write the meta tag right into the <head/> document.write('<meta name="viewport" content="width=' + newWidth + '"/>'); } } writePageMinWidthAdjustment();
And voila! Mobile browsers use the correct width. Enjoy.
Note: I’ve decided to publish this post before it’s finished, so that anyone interested can see how far I am (I likely won’t finish today, anyway). Therefore, you may refresh at-will to see the latest updates (you’ll know I’m done when this message goes away).
I’ve been meaning for a while to write up a list of my essential software installs and setup procedures for a new Mac. Now that I finally have my new Mac Pro Quad Xeon Nehalem, I plan on sharing every significant step after start-up that I’ve taking, for future reference. Here we go!
chflags hidden /Volumes/swap/I was walking home the other day, poking at my iPhone (as usual), and for the eleven billionth time frustration arose over my disorganized Delicious tag library. It's not that I don't have tag naming standards or that I've been neglectful. It's just hard to remember whether the tag I tend to use is idea or ideas or whether it makes more sense to tag something as PalmPre or two tags: Palm and Pre.
So why haven't the folks at Delicious added much-needed features1 like tag aliasing, parenting, and contextual categorization to their service? Why was their last major release merely a performance improvement with no real new features? (Okay, they added new features, just nothing too exciting.)
Then it hit me: Delicious is simply a basic yet open-ended social network for bookmarking; much like Twitter is for micro-blogging. However, unlike Twitter, I've seen very few attempts2 to add functionality to Delicious through it's tagging system; only tools that aggregate existing Delicious content.
With this said, I think it's time for us web app developers to build tools for Delicious that:Here's my first shot at an agreed syntax to help achieve these goals (so all our tools work together), based on conventions in use and non-conflicting characters:
context:…I tried to think of any use-cases that wouldn't fit into these constructs and the only situation I found was if you didn't want to rely on 3rd-party search/viewing tools. In that case, Apple>iPhone>3GS could be expanded by a tool into the additional tags Apple, iPhone, 3GS, and Apple>iPhone, iPhone>3GS; but that's just unnecessary messiness and complexity (such as matching pieces of those hierarchies to each other).
I also wanted to stay away from floating categorization tags (i.e. just OperatingSystems> or work:), since I believe that tying a category to a particular tag promotes better tag use and cleans up situations like bookmarking a site for multiple purposes. Plus, this is what tag bundles were built for (although a tool could automatically populate bundles…). There may still be a need for a tool that sweeps your bookmarks and fixes capitalization or pluralization, but that's probably best handled off-site and not tied to the tagging systems (don't get me started on the horrors of inventing tags like settings:depluralize:true).
So that's it; I'm going to start converting my tags over to these new syntaxes in preparation for new tools that view my bookmarks based on these formats; for the time being, I think I'll code up a portion of this site to show context:… tags of my choice as a proof-of-concept.
Fellow Delicious-ers, you may commence your opinion-penning below.
1 As currently (June 7, 2009) detailed on Wikipedia's page on Social Bookmarking.
2 FoxyPlayer seems to have the right idea.
To all who will someday dig through the archives of this blog and find this post (since I know no one is currently reading my previous sham of a blog): Welcome!
I’m (once again) relaunching my personal website/blog in the hopes that I can maintain it and keep it up-to-date, unlike my previous attempts. The difference this time Radiant CMS, which is a fairly open-ended CMS with plenty of extensions to add this or that feature (i.e., a typical blog requires enabling or installing the Archive, Blog, Comments, Paperclipped, and Tags extensions), most of which work seamlessly together. It’s also fairly easy to add custom Ruby/Rails code without having to “hack the source”, as I’ve had to do with every CMS I’ve used in the past. Overall, I’m liking it.
For the record, here’s a rundown of the major revisions of my personal website(s), what I used for each, and what worked and didn’t work:
So there it was and here we are; thanks for reading and hopefully there will be many more wonderful posts ahead. Arevaderche!
It has recently come up that I've written a few utilities that would be useful to others. Since many could benefit from these simple scripts, I'm sharing them in their beta state for any and all.
Basically, they all relate to modifying and removing color profiles from PNGs and JPEGs, primarily so that images match other graphics and CSS hexadecimal colors on web pages and look consistent across all browsers and platforms, whether they support color profiling or not.
All of the tools are simple "droplet" apps, just drop image file(s) on them and they churn out new, fixed images replacing the old ones.
They are free to use and feel free to contact me if you have any problems or have found a bug. Inside, they're really just interfacing with other scripts, but there may still be something I can do about it.
Download AdobePNG Cleaner and ICC Color Profile Suite in the "Play" section (for now).
I've gotten in the habit of locking my work computer whenever I walk away from it. It's a great added layer of security and it takes just a split second to lock and a moment (or two) to unlock. Not that I have much to hide, but it's just good to know that someone won't see something and take it the wrong way or muck with my settings as a practical joke. Unfortunately, it's not as easy as "Meta"-L on a Mac.
Enter Butler. A tremendously useful customization tool to some; a light-weight background task to satiate my need for a simple, but missing feature on the Mac. I've simply set it up to respond to Command-Shift-L by pulling up the Login Window, which is essentially the same effect as Windows' screen lock.
Set-up (once Butler is installed) is simple:
Again, I have nothing against using Butler to its fullest; I just have my bookmarks in my Delicious tab that's always open or nearby, web search in the corner of my browser window, dictionary search in the same place or on my Dashboard, quick Volume/HD/App/Home access in my Docs, you get the point. Regardless, I couldn't find a tool that does what I need better.
Get it at <http://www.manytricks.com/butler/>
Deliciously hand-crafted and maintained by Slippy Douglas. All questions/comments may be directed to him, whether he likes it or not.
Powered by Radiant CMS, running on Rails, running on Ruby Enterprise Edition, running on Phusion Passenger, running on Apache, running on Debian Linux, running on Love.
Part of the Slippy Douglas family of sites: SlippyD.com | ClutterApp | DeliTag | R•Node.net | Nectar Games | 6BITT.com
Copyright © 2003-2010, Slippy Douglas. All rights reserved, unless otherwise specified or conflicting, in which case:
“Copyright © the-appropriate-year, the-appropriate-copyright-holder.”