Category: Web

Using multiple Gmail accounts with mailto: links in Firefox

By , August 19, 2012 8:36 pm

For a while now, Google has allowed you to sign in to multiple Google accounts and switch back and forth between them quite easily. Firefox also allows you to use Gmail as the default application for mailto: links.

This is all fine and dandy, until you click a mailto: link and decide you don’t want to send that e-mail using your primary Gmail account. In my case, this happens when replying to posts on craigslist. I always assumed there wasn’t a “clean” solution, resigning myself to copying and pasting the e-mail and subject lines, or even at times clicking the mailto: link on my Android phone, which allows me to select any account on my phone to send the e-mail from.

Finally decided to do some research and found a solution on the mozillazine forums.

To summarize:

  1. Go to about:config in Firefox
  2. Set gecko.handlerService.allowRegisterFromDifferentHost = true
  3. Open the Web Developer scratchpad. (Firefox> Web Developer> Scratchpad or Tools>Web Developer > Scratchpad)
  4. In the scratchpad, type the following line of JavaScript:
navigator.registerProtocolHandler("mailto",
  "https://mail.google.com/mail/b/[email protected]/?extsrc=mailto&url=%s",
  "Description of your Gmail Account");
  1. Repeat the line as many times as necessary, once for each of your Gmail accounts.
  2. Once you have created all the necessary lines, go to Execute > Run.
  3. The “information bar” will pop up in your main Firefox window, asking you if you want to add your Gmail account as a handler for mailto: links. Accept once for each account.
  4. That’s it. Now when you click a mailto: link, you’ll be prompted which Gmail account to use.

Simple PHP script to display user’s IP address

By , June 13, 2012 1:22 pm
< ?php
// Stolen from: http://www.cyberciti.biz/faq/php-howto-read-ip-address-of-remote-computerbrowser/
// and http://roshanbh.com.np/2007/12/getting-real-ip-address-in-php.html
// with CSS from http://www.w3schools.com/css/css_examples.asp
 
function getRealIpAddr()
{
    if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
    {
      $ip=$_SERVER['HTTP_CLIENT_IP'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
    {
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
      $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}
 
$adresseip = getRealIpAddr();
?>
<html><head>
<title>Adresse IP: < ?php echo $adresseip; ?></title>
<style type="text/css">
div { font-family:"Segoe UI","Lucida Grande","Calibri","Tahoma","Sans"; }
div.ip { font-size:250%; }
div.desc { font-size:200%; }
</style>
</head>
<body>
<div><img src="csdccs-blanc.png" alt="logo CSDCCS" /></div>
<p><div>Votre adresse IP: </div>
<div>< ?php echo $adresseip;?></div>
</p>   
</body>
</html>

Add Google search provider to IE or Firefox

By , October 2, 2011 3:08 pm

Use this link to add the default Google search provider to IE or Firefox. Useful for IE, or Firefox on Linux Mint.
For Firefox:Google.xml

For IE: MS-Google.xml

CNet Download.com hosting adware/malware

By , September 23, 2011 12:29 pm

I had noticed this a little while ago, but it seems they’re stepping it up.

Seriously, does CBS have no better revenue generation method than to install crapware on people’s computers?

See for example Pidgin Portable: http://download.cnet.com/Pidgin-Portable/3000-2150_4-10834880.html?tag=mncol;3

and this post on UltraVNC forums

https://forum.ultravnc.net/viewtopic.php?f=6&t=28692

Modified photo.html.php for widewind gallery3 theme

By , September 20, 2011 11:49 pm

This enables dynamic resizing of the photo displayed, and enables the pseudo-lightbox popup to view the “full” resized image for users that can’t view the true full image.

< ?php defined("SYSPATH") or die("No direct script access.") ?>
 
<!-- Use javascript to show the full size as an overlay on the current page -->
<script type="text/javascript">
  $(document).ready(function() {
    full_dims = [< ?= $theme->item()->width ?>, < ?= $theme->item()->height ?>];
    $(".g-fullsize-link").click(function() {
      $.gallery_show_full_size(< ?= html::js_string($theme->item()->file_url()) ?>, full_dims[0], full_dims[1]);
      return false;
    });
    resize_dims = [< ?= $theme->item()->resize_width ?>, < ?= $theme->item()->resize_height ?>];
    $(".g-resized-link").click(function() {
      $.gallery_show_full_size(< ?= html::js_string($theme->item()->resize_url()) ?>, resize_dims[0], resize_dims[1]);
      return false;
    });
    // After the image is rotated or replaced we have to reload the image dimensions
    // so that the full size view isn't distorted.
    $("#g-photo").bind("gallery.change", function() {
      $.ajax({
        url: "< ?= url::site("items/dimensions/" . $theme->item()->id) ?>",
        dataType: "json",
        success: function(data, textStatus) {
          full_dims = data.full;
        }
      });
    });
  });
</script>
<style>
img.g-resize {
        width: 100%;
        height: auto;
}
</style>
<div id="g-item">
  < ?= $theme->photo_top() ?>
 
  < ?= $theme->paginator() ?>
 
  <div id="g-photo">
    < ?= $theme->resize_top($item) ?>
    < ? if (access::can("view_full", $item)): ?>
    <a href="<?= $item->file_url() ?>" title="< ?= t("View full size")->for_html_attr() ?>">
    < ? else: ?>
        </a><a href="<?= $item->resize_url() ?>" title="< ?= t("View full size")->for_html_attr() ?>">
    < ? endif; ?>
    < ?= $item->resize_img(array("id" => "g-item-id-{$item->id}", "class" => "g-resize")) ?>
        </a>
    < ?= $theme->resize_bottom($item) ?>
  </div>
 
  <div id="g-info">
    <h1>< ?= html::purify($item->title) ?></h1>
    <div>< ?= nl2br(html::purify($item->description)) ?></div>
  </div>
 
  < ?= $theme->photo_bottom() ?>
</div>

How to dynamically resize an image using CSS

By , September 20, 2011 11:03 pm
 <style> 
img.g-resize { 
        width: 100%;
        height: auto;
}
</style>

Where g-resize is the class assigned to the img you want to have dynamically resized.

Thanks to http://michelf.com/weblog/2005/liquid-image/

The kindergarten browser wars

By , June 25, 2011 11:15 pm

A friend posted this on Facebook today:

Quite an accurate depiction.

Image credit: The Shoze Blog

Web browser market share: Modern browser edition

By , April 9, 2011 3:23 pm

Microsoft was quick to boast of Internet Explorer 9′s 2.5 million downloads in its first 24 hours—a number quickly eclipsed by Firefox 4, which garnered 7.1 million in its first day.

via Web browser market share: Modern browser edition.

Oh, Microsoft, just give up on IE already. Focus on Windows, Office and Sharepoint instead.

Restore one-click message selection in Gmail

By , March 29, 2011 9:37 pm

If you’re like me, you REALLY miss the ability to select all your unread (or read) conversations with one click. With the new Gmail interface, you have to first click the drop-down menu, the click the desired selection option. That’s one click too many IMO, and extra mouse mileage that’s wearing down the poor little thing.

But naturally, when the Internet has a problem, the Internet also has a solution.

Using some CSS, and the Stylish extension for Firefox, it’s possible to get the old links back, and they actually look even better than before.

@namespace url(<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>);
/*
 Gmail: Select "links" restored
*/
@-moz-document domain("mail.google.com") {
 
/* move search results text down below Select links */
.VP5otc-pzeoBf.D.E .yS { padding-top: 25px !important; }
 
/* same height as before (more or less) */
.VP5otc-pzeoBf.D.E .nH { height: 22px !important; }
 
.VP5otc-pzeoBf.D.E &gt; .nH &gt; .nH.Cq &gt; div &gt; div &gt; .J-M.AW:nth-child(7) {
 position: relative !important;
 top: -4px !important;
 left: 15px !important; /* line up with 'Search ...' */
 display: inline !important;
 height: 16px !important;
}
.VP5otc-pzeoBf.D.E &gt; .nH &gt; .nH.Cq &gt; div &gt; div &gt; .J-M.AW:nth-child(7) &gt; .SK:before {
 content: "Select: " ; font-family: Arial ; color: black ;
}
.VP5otc-pzeoBf.D.E &gt; .nH &gt; .nH.Cq &gt; div &gt; div &gt; .J-M.AW:nth-child(7) &gt; .SK {
 -moz-box-shadow: none !important;
 -webkit-box-shadow: none !important;
 padding-top: 4px !important;
 padding-bottom: 2px !important;
 background-color: transparent !important;
 font-family: Verdana !important;
}
.VP5otc-pzeoBf.D.E &gt; .nH &gt; .nH.Cq &gt; div &gt; div &gt; .J-M.AW:nth-child(7) &gt; .SK.AX &gt; .J-N {
 display: inline-block !important;
 padding-left: 8px !important;
 padding-right: 8px !important;
 -moz-border-radius: 3px !important;
 -webkit-border-radius: 3px !important; /* WebKit */
 cursor: pointer !important;
}
.VP5otc-pzeoBf.D.E &gt; .nH &gt; .nH.Cq &gt; div &gt; div &gt; .J-M.AW:nth-child(7) &gt; .SK.AX &gt; .J-N:hover {
 background-color:#406480 !important;
 color:white !important;
}
/* optional bg: sort of a button look (dark/light bg with light/dark text) * /
.A1.D.E &gt; .nH &gt; .nH.Cq &gt; div &gt; div &gt; .J-M.AW:nth-child(7) &gt; .SK.AX &gt; .J-N:not(:hover) {
 background-color: #406480 !important;
} /* dark blue [Planets bg] */
 
}

Thanks to Matt Kruse. Original script source: http://userscripts.org/topics/67827

Virtual LAN with NAT/PAT for OpenVZ containers

By , October 13, 2009 9:07 pm

This blog is running from an OpenVZ container on a server with a single public IP. There is no separate router; the eth0 interfaces is connected directly to the Internet. Therefore, I had to create a vlan with private IPs for my containers which would share the one public IP. Here’s how I did it.

/etc/network/interfaces

auto eth0
iface eth0 inet static
address x.x.x.x
netmask 255.255.255.254
gateway x.x.x.x
 
auto venet0:0
iface venet0:0 inet static
address 172.29.247.100
netmask 255.255.255.0

Note that the venet0 interface is created when installing OpenVZ. By default it has no IP. I assigned a static IP of 172.29.247.100 and netmask of 255.255.255.0 to allow space for a whole lot of containers. Now for the fun part, messing with iptables.

# NAT VM subnet (247) to external ip
/sbin/iptables -t nat -A POSTROUTING -s 172.29.247.0/24 -o eth0 -j SNAT --to x.x.x.x
 
# Allow all traffic for venet0 interface
/sbin/iptables -A INPUT -i venet0 -j ACCEPT
 
# ssh to containers
/sbin/iptables -t nat -I PREROUTING -p tcp -d x.x.x.x --dport 2222 -j DNAT --to 172.29.247.103:22
/sbin/iptables -I FORWARD -p tcp -d 172.29.247.103 --dport 2222
/sbin/iptables -t nat -I PREROUTING -p tcp -d x.x.x.x --dport 2223 -j DNAT --to 172.29.247.102:22
/sbin/iptables -I FORWARD -p tcp -d 172.29.247.102 --dport 2223

It may not be the optimal solution, but it works, it’s stable, and I’m quite proud of myself.

Custom theme by me. Based on Panorama by Themocracy

You own a dog, but you can only feed a cat.