Lojic Technologies

Posts Tagged ‘browser

Automatically Delete Unwanted Cookies in Firefox

with one comment

I prefer to not have cookies stored in my browser, but it’s impractical to not store any cookies since this would require repeatedly logging in to authenticated sites that I frequently use. A simple solution in Firefox is the following:

From the Edit menu, choose Preferences and then click the Privacy tab. You should see a dialog similar to the following one:

firefox1.png

Check the “Accept cookies from sites” checkbox. For the “Keep until” setting, select “I close Firefox”. The latter is the key – it will erase all cookies from Firefox whenever you close the program. Of course, we don’t want to erase all the cookies, so click the “Exceptions…” button on the right and you’ll see a dialog similar to the following:

firefox2.png

Just type the name of the web site you want to allow in the text box and click the “Allow” button, and Firefox will add it to the exception list so it won’t be deleted when you close Firefox. You can add a full URL such as http://www.MySite.com, or just the domain name MySite.com to allow cookies for any host in that domain. You an also add sites you want to disallow any cookies from by clicking the “Block” button.

I have about 30 sites that I allow Firefox to store cookies for, but this technique has helped me avoid accumulating tons of unwanted cookies in Firefox. I hope it’s helpful for you.

Written by Brian Adkins

January 26, 2008 at 1:06 pm

Posted in internet

Tagged with , , ,

Functional Features in JavaScript on Firefox

leave a comment »

I was reading an article about adding code to JavaScript to make it more functional, and one of the blog commenters mentioned some built-in features that were added to JavaScript 1.6 & 1.7 on Firefox, so I checked out the links (see below) – very cool stuff.

  • Array methods

    • indexOf
    • lastIndexOf
    • every
    • filter
    • forEach
    • map
    • some
  • Array & String generics
  • Generators & Iterators
  • Array Comprehensions
  • Block Scope w/ let
  • Destructuring Assignment
  • etc.

They won’t help if you have to target IE also, but it should be possible to conditionally include your own code to implement the ones that don’t require syntactic changes for pages loaded from IE. That would reduce network load for customers using Firefox.

New in JavaScript 1.6 (Firefox 1.5)

New in JavaScript 1.7 (Firefox 2.0)

Hopefully IE will catch up someday, but if not, I can see taking advantage of Firefox specific JavaScript enhancements for niche applications. Firefox is so easy to install, that it should be easy to convince customers to use it for certain custom applications.

Written by Brian Adkins

October 7, 2007 at 12:01 am

Greasemonkey Script for Netflix Half Star Ratings

with 3 comments

I wrote an article back in May about a way to give half star ratings on Netflix. It had the advantage of working in any browser and not requiring any software installation, but it wasn’t very user friendly.

Since then, I’ve been doing a lot of JavaScript coding, so I thought I’d give Greasemonkey a try. I found a script here to give half-star ratings, but I didn’t care for the hover captions and JSLint pointed out a few issues, so I cleaned it up a little:

Code

// ==UserScript==
// @name Netflix Half Stars
// @description allows half star user ratings on Netflix
// @include http://*netflix.com/*
// ==/UserScript==
// http://userscripts.org/scripts/review/8118
// Modified by Brian Adkins

if (!unsafeWindow.sbHandler) { return; }

var sbHandler = unsafeWindow.sbHandler;
sbHandler.sbOffsets = [8,18,27,37,46,56,65,75,84,94];

sbHandler.displayStrings[0.5] = ".5 stars";
sbHandler.displayStrings[1.5] = "1.5 stars";
sbHandler.displayStrings[2.5] = "2.5 stars";
sbHandler.displayStrings[3.5] = "3.5 stars";
sbHandler.displayStrings[4.5] = "4.5 stars";

sbHandler.sbImages[0.5] = new Image();
sbHandler.sbImages[0.5].src = sbHandler.imageRoot+"stars_2_5.gif";

for(var i = 2; i < 11; i++) {
sbHandler.sbImages[i/2] = new Image();
sbHandler.sbImages[i/2].src = sbHandler.imageRoot + "stars_2_" +
(Math.floor(i/2)) + (i % 2 === 0 ? "0" : "5") + ".gif";
}

sbHandler.getStarCount = function (evt) {
var x = unsafeWindow.getElementMouseCoordinate(evt, this.element);

for(var ii = 0; ii < 10; ii++) {
if(x <= this.sbOffsets[ii]) { return (ii + 1) / 2; }
}

return 0;
};

Installation

Save the JavaScript code with .user.js extension e.g. netflix_halfstar.user.js and then open that file in Firefox and Greasemonkey should prompt you to install it.

Written by Brian Adkins

August 27, 2007 at 4:38 pm

Social Bookmarking

leave a comment »

Here’s a video that explains why using a site such as del.icio.us can be useful. I think they may have failed to mention that you can mark bookmarks as private on del.icio.us, so it’s not necessary to expose your bookmarks to the world. However, in my case, I only mark a small fraction as private.

I’ve been using del.icio.us for quite some time. After I had been using it for a while, I realized that it had been a long time since I bookmarked something in my browser because I had developed a habit of bookmarking in del.icio.us. Most browsers force you into placing a bookmark into a hierarchical, or directory, structure, but on del.icio.us you can assign as many “tags” as you like to a particular bookmark so you can search for things more easily. del.icio.us also allows you to export your bookmarks so you aren’t at the mercy of a proprietary service.

Another thing that is handy is to subscribe to the del.icio.us feeds of your friends to be automatically notified when they bookmark something that may be of interest.

Written by Brian Adkins

August 7, 2007 at 8:34 pm

Posted in internet, video

Tagged with , ,

Surf Securely Using SSH

with one comment

This is so easy, you’re gonna love it! Thanks Tyler Pedersen.

Motivation

I’ve been using my laptop more frequently at wifi hotspots. Many web sites I visit encrypt traffic with SSL for authentication, but after that they send traffic in the clear which means the cookies that are used for authentication purposes are sent in the clear, so anyone with a sniffer within range of my laptop could easily intercept the traffic, steal my cookies and impersonate me on the web site. Not good! So, I went looking for a simple solution, and found a great article about using ssh for this purpose. Ya gotta love open source software 🙂

Prerequisites

I’ll assume the following:

  1. You’ve used ssh before
  2. You have access to a remote host running sshd

How To

Issue the following command on your local computer:

ssh -Nf username@hostname.com -D 1080

replace username@hostname.com with the appropriate information. Look at the man page for ssh, or read the article linked above for an explanation of the options.

The next step is to configure Firefox to use the SOCKS proxy you setup with the above command. I’m using Firefox 2.0.0.6 on Ubuntu 7.04 Linux.

Edit | Preferences | Advanced | Settings

Pulls up the following dialog:

socks.png

Notice how I’ve switched from “Direct connection to the Internet” to “Manual proxy configuration”. I’ve also set the SOCKS Host to be ‘localhost’ and the port to be ‘1080’.

I can now surf and have encrypted traffic between my local computer and the remote host I ssh’d to. The traffic between my remote host and the destination web site will be unencrypted, but hopefully that traffic is harder to sniff without being detected.

At this point, I tested it out and everything worked fine. I then killed my local ssh process and Firefox complained about the connection being reset, so I knew it was in fact sending data over the ssh tunnel.

The final step is optional, but if you want to avoid having the bad guys detect your DNS requests (or possibly redirect them – d’oh!), you can configure Firefox to route DNS requests through the proxy.

  1. Type about:config in the Firefox address bar.
  2. Look for network.proxy.socks_remote_dns and set the value to true

Is that easy or what? Thanks again Tyler.

Written by Brian Adkins

August 2, 2007 at 12:28 am

Posted in internet

Tagged with , , ,

Adblock Plus

with one comment

Facebook.com just ran an ad that was quite offensive to me. I should’ve taken Scott Moonen’s advice from his blog earlier, but better late than never. He has simple instructions for installing Adblock on his blog. Check it out and get rid of ads!

Written by Brian Adkins

July 23, 2007 at 12:29 pm

Posted in business

Tagged with , , ,

Head First HTML with CSS & XHTML

with one comment

I first noticed the covers of the “Head First” book series from O’Reilly a while ago, and I thought they looked unprofessional and simplistic, so I never really looked into them. Interestingly, I try to be careful about not being biased by nice book covers, but I think I’m more susceptible to dismissing books with “bad” covers.

I researched HTML books recently to help my aesthetically gifted wife get started designing web pages and the Head First HTML with CSS & XHTML title got great reviews on Amazon, so she picked up a copy.

I thought I’d flip through the book, and I ended up reading the entire thing 🙂 I really wish this book was available years ago when I started coding HTML; it’s an incredibly well written tutorial. It has a very unique style which the authors spend quite a few pages explaining:

Based on the latest research in cognitive science, neurobiology, and educational psychology, learning takes a lot more than text on a page. We know what turns your brain on.

After reading the book, I tend to agree with their approach. It was a very fun and informative read. Most of the book was review for me since I’ve spent years learning this stuff the hard way, but there were a handful of excellent points I learned from the book, and I understand a lot of the foundational aspects of XHTML & CSS much better than I did before. Expecting a newbie to get through a typical HTML reference book is unrealistic IMO.

For anyone wanting to learn the basics of (X)HTML & CSS, or would like a good review, I highly recommend this book. I don’t know if the other books in the “Head First” series are as good, but I’ll certainly consider them in the future based on my experience with this one.

UPDATE: I have found one thing to criticize about the book. The index leaves a lot to be desired. This is a particularly grievous deficiency with this book since it is organized as a tutorial as opposed to a reference book.

Written by Brian Adkins

July 14, 2007 at 4:46 pm

Posted in books, web design

Tagged with , ,