Site Notes

Featured

…on the KV5R server project…

open-source software

This site is running WordPress (and some other stuff), via Ubuntu and Nginx, on an unmanaged VPS in a big datacenter. I used to hand-code all my sites in asp/vbscript on shared hosting servers, but I wanted to get into Linux server administration, PHP, and WordPress. Needless to say, learning to install and configure an Internet-facing server is quite a challenge. After about eight months, I finally have it stable enough to get back to some writing!

May 2013 Update— email server was broke for a while, so I didn’t get registration notifications. Meanwhile, about 50 spam-bots registered. All have now been deleted, and I’ve installed aggressive anti-spam features. If you registered before (and you were not a spam-bot) you will need to re-register before you can post comments.

Then, the VPS went down for four days, dot.tk cancelled my .tk URL, and googlebot freaked out, since the site was down. When it came back up, I spent another 30 or so hours cleaning up the server and getting the articles cleaned up and getting a new sitemap built. I’d rather be writing new articles!

April 2013 Update— KV5R.COM URL is now pointed here, and the private server is officially online as the main site. Old .asp URLs are redirected by the hundreds. Please update your links!

December 2012 Update— Most of the content (from kv5r.com) has been installed in this WordPress blog. Some pages still need some editing. Also, installed a tree-type menu system that expands and collapses based on the page you are viewing. This keeps the menu (200+ pages) from going on forever.

The Ubuntu server is pretty stable, with Nginx, PHP-FPM, memcache, MySql, PostFix, Dovecot, RoundCube, Pure-FTP, and Bind9 all performing nominally. ISPConfig3 is working, though a little buggy. has been ripped out, I just couldn't make it work right.

September 2012 Update— I am was testing WordPress on a Windows server (2008R2), to see if it can be de-bugged enough to run as a regular site. The database abstraction plugin was working for regular day-to-day admin and display, but things like update and repair were not working. And the IIS server's implementation of PHP was blocking WP's incoming and outgoing features (no rss, akismet, etc.).

But now I’ve given up on that, and this site is now being built on a private server! As if setting up WordPress and writing articles isn’t enough, now I’m also building a web hosting server from scratch… There’s so much to learn! But it’s coming along; a few more thirty-hour days should get it whipped into shape.

If it all works, the ultimate purpose of this blog will be to keep my readers up to date on what's happening, and allow comments on my many popular web articles, which I hope to move from shared hosting to this new server. We'll see how that li'l plan goes…

If you'd like to comment on one or more of my articles, look for the corresponding blog entry — once I get them made! But please be patient, because this blog is brand-new and it'll take a while to get it all working and polished, and that’s after I get this whole web server admin thing under control.

You will need to have a user account to post comments and replies, and all will be moderated (for spam control), at least for now.

Stay Tuned!

—kv5r, owner

WordPress and HoverIntent

fixing spastic menus…

The Problem

Don’t you just love all those web sites with pull-down and fly-out menus that unexpectedly flash in your face when you don’t want them, and then disappear when you do want them? Let’s face it: our mouse movements are never perfect, and hover events need to take this into account to avoid irritating the user.

The Fix

The easy fix is a neat little jQuery plug-in called hoverIntent, by Brian Cherne. What it does is add a little delay the mouseOver event, and optionally the mouseOut event, waiting until the user has definitely hovered, or un-hovered, the menu. In effect, it “eats” unintended mouse events. The effect is nice—no more flashing unexpected menus in your face, and no more menus that fly away while you’re trying to use them. Try it on the menu above and see the effects.

Using hoverIntent for WordPress Nav Menus

I’ve used hoverIntent before on hand-made sites, but recently I decided to put it in my WordPress site. But Not So Fast! The way WordPress builds pages has a rather steep learning curve. First of all, you can just edit the header.php file of your theme and put in the link to load the hoverIntent script, followed by some jQuery in a document.ready handler (just under wp_head() ) to make hoverIntent work on the desired menu, in the desired ways:

The Usual Way

<script type='text/javascript' src='/path/to/jquery.min.js'></script>
<script type='text/javascript' src='/path/to/hoverIntent.min.js'></script>
<script type='text/javascript'>
jQuery(document).ready(function(){
  jQuery('.menu ul li').hoverIntent({over:navover, out:navout, timeout:400});
  function navover(){jQuery(this).children('ul').fadeIn('slow');}
  function navout(){jQuery(this).children('ul').fadeOut('fast');}
});
</script>

Something like that will get it going, after you have disabled the :hover effects in the nav menu portion of your CSS file. But is that really the right way to do it in WordPress? Well… no.

The WordPress Way

WordPress has built-in ways of handling the dependencies and proper load-order of things, so we should do it the WordPress way, which is to make a couple functions in functions.php and then tell it to “enqueue” the hoverIntent script (that comes with WordPress), and also load the instantiation in the head section of the generated page to tell hoverIntent what to do.

I couldn’t find any applicable examples on-line, so after many hours of fiddling I ended up with this, which goes in functions.php in the template:

// make a little function to enqueue hoverIntent:
function enq_hoverIntent() { wp_enqueue_script('hoverIntent'); }
// now make WP run it:
add_action('wp_enqueue_scripts', 'enq_hoverIntent');

// enclose some jQuery script in a php function:
function init_hoverIntent() { ?>
<script type='text/javascript'>
  jQuery(document).ready(function(){
    jQuery('.menu ul li').hoverIntent({
      over : navover,
      out : navout,
      timeout : 400
    });
    // (how to use both fade and slide effects!):
    function navover(){
      jQuery(this).children('ul')
        .stop(true,true)
        .fadeIn({duration:600,queue:false})
        .css('display','none')
        .slideDown(600);
    }
    function navout(){
      jQuery(this).children('ul')
        .stop(true,true)
        .fadeOut({duration:300,queue:false})
        .slideUp(300);
    }
  });
</script>
<?php }
// now make WP load that into the head section of the html page:
add_action('wp_head', 'init_hoverIntent');

And that’s it! Assuming you already have a working CSS-based drop-down or fly-out menu in your header.php file, you don’t need to add anything else to it. WordPress will now load hoverIntent at the right place (and it will also load jQuery, if not already loaded). And when it runs wp_head() it’ll add your initialization script that ties hoverIntent to your nav menu.

Notes

  1. You need to study your document tree a bit to see what tags, IDs, and classes your nav menu uses, which will vary with different themes.
  2. You can’t use $ for jQuery in WordPress—it loads it in “noConflict” mode.
  3. Be sure your CSS (1) hides the sub-menu ULs on page-load, but (2) doesn’t show them on :hover, as that would override the effect and you’ll think it isn’t working.
  4. If you have not defined a custom menu in WordPress Admin, WP will use wp_page_menu() to build the menu when wp_nav_menu() is called. The menu will be built in levels according to the parent and menu order settings of all your pages.
  5. The hoverIntent “timeout” setting refers to the mouseOut delay, which defaults to 0, so you need to instantiate it as shown above to use timeout. 400 (milliseconds) is a decent setting to keep the menu open while you are navigating it and cutting corners along the way.
  6. Since we now have jQuery handy, we might as well add some nice animation to the menu. We could just use show() and hide(), but it’s much more pleasing to use slideDown() slideUp(), or fadeIn() fadeOut(), or even better, both! We could even use jQuery animate() to make the menu display in other neat ways by animating various CSS properties of the drop-down ULs.

—KV5R

Security Certificates

when your browser scares you with the infamous “this site is not trusted”

When you first go to register or log-in on this site, your browser puts a big scary security warning in your face. But really, what does it mean?

Well, two things: (1) it has switched to secure (https:) mode, and is now encrypting all communications, and (2) it’s doing so with my self-signed SSL certificate.

Now, let’s put this into perspective.

First, you can either have an un-encrypted, plain-text connection on http port 80. Or, you can have an encrypted connection, that cannot be intercepted en-route, on https port 443. Anyone and everyone can create their own certificate that enables this transport encryption.

Second, the encryption certificate can come from anyone, or it can be issued (for a whopping fee of $100-$1500 a year) by some “approved” certificate authority (CA). These CA root certs are already in your browser, and if some site has a cert from one of them, you don’t get the nasty warning — but you do know for sure that the identity of the web site has been independently verified. This is a very good thing when you need to be sure that your bank really is your bank!

So we see two things in play: (1) https encryption and, (2) identity verification. Unfortunately, the “power-that-be” have decided that one = other. But does it?

Cases: (1) you go to log into a free site so you can post a comment. Your connection should be https, port 443, encrypted, to keep prying eyes from reading your password. Or, (2) You go to a commerce site to buy something: Your connection should be encrypted, and you should “trust” a “certificate authority” to have verified the “ownership” of the secured connection. I mean, would you really transfer money otherwise?!

In the first case, you are logging into a free site, and no personal or financial information is requested or transmitted. You really don’t need to care about a verified identity, you just want your password hidden en-route. Such sites, like this one, use a self-signed (free) SSL certificate, which causes your browser to go SSL but put that warning in your face. But if you elect to continue, you still get 100% secure mil-grade encryption of the connection. You are not buying anything, and if the site asks you for financial details, you just dump it. Simple!

In the second case, you are buying something (or accessing your financial accounts) and you need both a secure connection and verified identity. In this case, DO NOT continue past the browser’s “not trusted” warning! Any real bank or e-merchant will have the “trusted” certificate, with their identity verified by a CA that is known to your browser. After all, they’re making millions off you and can afford a verified identity at those high prices.

So, the long and short of it is, any site (like this one) can use a free self-signed certificate to encrypt your log-in/registration page, and you browser will show a warning. All that warning means is that the encryption certificate isn’t backed by some CA (at $100-$1500/year rip-off price) — but WTH, it’s just a free log-in, and if you continue, you’ll have an encrypted connection, just as good as any, with which to transmit your log-in or registration.

The opposite side is when you are buying something, plan to enter your CC# — in that case, never, never, never continue past a security warning!

Hey, you’re not buying anything here, we don’t ask you for any financial stuff, and so we don’t pay some CA $100-$1500/year to verify our identity. If we did, we’d have to bill you for access! And if you choose to Donate to this site, well, that’s handled by PayPal and their trusted CA, not us.

In my opinion, combining encryption with identity verification is a big scam: both encryption and identity verification should be free for everyone — or there should be low-cost (non-profit) alternatives for non-commercial sites. Yes, there are few “free” verified SSL certificate providers, but then you get to the fine print: if you even have so much as a Donate button or Google ad on the site, they consider it “commercial” and deny your request! Then they try to up-sell you into one of their expensive commerce certs.

I, for one one of millions, do not have the money to pay to officially “trust” my identity, but you can still enjoy the fruits of my labor, including an encrypted log-in.

Smart web browsing is both an art and a science.

Hope this helps,
—kv5r

Contributions

times are tough…

When I see one of those “Contribute” buttons on a web site I think, “yeah, like I’m really gonna just send some money to a total stranger…” But this case is different.

Having a chronic illness, I can’t do much, but I can sit at the computer, so I spend thousands of hours attempting to write free articles for total strangers to read and enjoy. And my writing is always based on the idea that good content should be both useful and appreciated, so I tend to cover my subjects in such a way as to take them from beginner to intermediate levels, along with the enthusiasm of new accomplishments.

If you find the articles on this site interesting and useful, please consider a small contribution to help cover expenses. There’s a PayPal button at the bottom of the page (you don’t need a PayPal account, any plastic will do) and you can rest assured that it’s secure.

If you’ve already contributed, I’d like to say a big Thanks! It’s very much appreciated!

—kv5r

Vape Liquid Viscosity

blending your own custom e-juice, at the right viscosity…

…also, notes on rebuilding a Protank atomizer…

I recently got into the fascinating “e-cig” hobby, whereby one dumps the dirty, ashy smoking of tobacco products, with its 4,000 toxic, carcenogenic chemicals, and starts “vaping” (vaporizing) glycerin (glycerol) and nicotine, with one’s choice of favorite flavors. We’ve all seen the “water vapor, not smoke” e-cig ads on TV, but that’s but one of many options for vaping. A large and growing industry for vaping now exists, and clever people are offering many options for electrical devices and fluids that provide nicotine-laden vapors instead of tobacco smoke. Yup, it’s really better. 🙂

The advantages are many: (1) while nicotine is a potent and highly addictive toxin, it’s relatively safe in small, measured quantities, particularly when we eliminate the many other toxins in tobacco products, and (2) vaping is a lot cheaper than smoking, if you do it right. For example, you can get the hardware and about a 3-4 month supply of flavored nicotinic liquid for around $60, a small fraction of what one might pay for smoking highly-taxed and high-restricted cigarettes. Furthermore, you can vape almost anywhere, and if they complain, you just say, “Sorry, but this is a vaporizer, and it doesn’t contain any tobacco products.” How sweet! 🙂

The most cost-effective system is a “tankomizer” (tank-type atomizer) that holds ~ 1.5-3 milliliters (ml) of liquid, vaporizing it with a ~ 2.5 Ohm heater coil, powered by a ~ 3.7-volt lithium rechargeable battery unit. One can buy the liquid pre-mixed, or buy the components (glycerine, propylene glycol, nicotine, and flavor), and mix one’s own “juice”, as desired. One decides the base liquid blend, which determines the viscosity; the nicotine percentage (usually 12-24 mg/ml), and any of several hundred flavors. These need not be tobacco flavors, but can be anything from Dunhill to Cappuccino to Strawberry Cheesecake, as desired. Not to mention, good ol’ menthol.

Types of e-cigarettes

First is the cigarette-sized (mini) vaporizers like the Blu. These use disposable cartridges and small rechargeable batteries. Quite expensive. From there one moves up to the replaceable “cartomizer” type, where a replaceable liquid cartridge plugs into an atomizer, which screws onto a rechargeable battery. These are somewhat larger (about like a cigarillo), and last substantially longer than the mini-e-cig types. Beyond that are the clear tanks (clearomizers), which are designed to be refilled many times. Beyond that are the rebuildable tanks with replaceable atomizers. Atomizer heater coils typically last only a couple of months, and there’s really no point in throwing away a whole e-cig just because it needs a new atomizer. These initially cost more, but are cheaper in the long run.

In the clearomizer tank there is a vaporizer tube containing the atomizer heating coil. It is fed a thick liquid via either a fiber wick (top heater) or tiny holes (bottom heater), and the rate of liquid feed is largely determined by the viscosity of the liquid. Glycerine has a very high viscosity index (VI), while propylene glycol has a relatively low VI, and since both are safe for human consumption, they are blended to provide the correct viscosity. However, some people have allergies and/or objections to propylene glycol, so pure vegetable glycerine, thinned a bit with water, is used instead. I have determined experimentally that a mixture of glycerine and about 3.5% water (96.5% Aqueous Glycerine (AG)) has about the same viscosity profile as 50:50 glycerine:glycol, which is commonly used, and a 6% water in glycerine (94% AG) has about the same viscosity profile as 30:70 glycerine:glycol, also commonly used.

Viscosity Profiles

viscosity chart
click for large

I spent way too many dozen hours looking up all the available data on glycerine and propylene glycol, put it it all into a spreadsheet, and generated a Viscosity Profile chart:

Note that, in the chart, P.Glycol is hidden by 80% AG.

Note that the numbers for Aqueous Glycerine are accurate, from an old chemistry book, whilst the numbers for 50:50 and 30:70 glycerine:glycol mixtures are mathematically interpolated, and may or may not be accurate—I’m not a chemist, and I didn’t grind it right down to molecular weights, but I see no reason why they might not be close to reality.

From this data, we can see the interesting conclusions:

  • 97% AG nearly matches the profile of 50:50.
  • 94% AG nearly matches the profile of 30:70.
  • 80% AG nearly matches the profile of 100% PG.
  • A 20% water AG has a nearly flat profile from 60 to 3 cPs.s. This is probably too thin for most clearo/tankomizers.

The flow rate into an atomizer will initially be controlled by the Room Temp viscosity, but will increase rapidly as the atomizer heats up the tank – so, the flatter the curve, the better, but it must not be too low or the atty will flood and gurgle. The flow rate is also determined by the user’s draw—the air inlet is restricted, so when the use draws, it lowers the pressure in the atty, causing more liquid to flow into the wicks. Furthermore, a nearly empty tank will flow more (when drawn) than a nearly full one, because there’s more air-space in the tank. As the liquid level drops it creates a partial vacuum in the tank, reducing the flow, then, after the draw, a little bubble of air goes through the wicks and normalizes the pressure inside…and the lower the tank level, the less frequently this needs to happen (this applies to bottom-coil tanks).

From what I have read on many vaping forums, it seems that a lot of people are somewhat confused as to why their PV (personal vaporizer) performs so much differently with various pre-mixed fluids, and various coil powers (e.g., wattage = voltage × amperage, where amperage = voltage ÷ resistance — E=IR and P=EI). It seems to me that for a given room-temp (i.e., 25°C) viscosity, a certain amount of liquid will move into the heating coil (by osmosis), and for that amount of flow, a certain amount of power is required to vaporize it. Thus, if you’re gonna blend your own juice, you should understand its viscosity profile and the amount of power needed for said viscosity profile.

Back to the chart, it becomes apparent that the flatter the viscosity profile the better, since vaping warms up the whole carto/clearo/tanko, and the viscosity rapidly drops during a vaping session. And, as you can see, the higher the percentage of glycerine, the steeper the curve! Example: You start out vaping pure glycerine at 25C room temperature, and it has a viscosity of 995 centiPoise—about like honey. But after 2-3 minutes of vaping, it has warmed to 40°C and dropped to <300 cPs.s! But your atto coil is designed to vaporize at a certain rate and wattage. You start out with a light, dry vape, and end the session with a heavy, wet vape, and maybe even flooding and gurgle in the PV. All this is due to the drop in viscosity as the tank warms up. The vape becomes much more consistent as we add water (or, to a lesser extent, propylene glycol) and thin the glycerine, flattening it’s viscosity profile. But we can go too far: Though some recommend 20% water in glycerine, we see from the chart that this is ~= to straight PG, and is way too thin for tankos, but about right for cartos, which hold the liquid in a pack of fiber.

Empirical

I’ve just started testing these assertions, in a KangerTech Protank, and will in the future months provide results. Meanwhile, your feedback is both welcomed and appreciated! My goal is to help mature this hobby with better, scientifically-controlled information.

I therefore propose a standardized measure of viscosity, which I call 10-5, to be measured in a 10cc syringe body (plunger removed) with a #12 x 1/2" blunt needle, where the liquid drops from 10 to 5 ml in n seconds. This may be correlated to centiPoise if someone wants to drag out a multi-thousand-dollar lab-grade viscometer, or we can just use 10-5 cc drop (spec: through a #12x1/2" needle at 25°C) time to compare fluids. We probably don’t need to get into densities and measure things in centiStokes kinematic, as just knowing if it’s “honey” or “maple” will likely be sufficient to select and blend juices at ~ the proper vis for the popular clearos.

If you wanna participate in these viscosity experiments, I will be using as viscometers:

  • http://www.amazon.com/dp/B008MLV3NM/ is (6) Amico Stainless Steel Luer Lock Dispensing Needle Tip, 12 Gauge, 2.05mm ID x 2.8mm OD x 1/2" Length, $5.09 f/s.
  • http://www.amazon.com/dp/B002RUI8WS/ is (5) B-D Luer Lock 10ml syringes, $2.83 f/s.

…you’ll need to fabricate a 10cc B-D syringe holder, and acquire some 30ml catch bottles, etc. And a cheapo digital thermometer. And a stopwatch!

Hey, it might be fun! It might even help mature this hobby a bit.

Updates

May 8, 2013 — I finally received the #12 blunt needles, and have tested my current batch, which is 96.5 AG. It dropped from 10-5 cc in the B-D syringe in a reasonable 72 seconds, so it looks like the choice of the #12 needle was about right. My next batch will be 93% AG, which should bring the viscosity down to about same as 30:70 glycerol:glycol.

May 21, 2013 — Made the next 30ml batch at 7% water and 20mg/ml nic. Too thin! The Kanger Protank floods and gurgles, doesn’t vape well, and needs to be completely washed out every couple of days. The 10-5 drop time viscosity is 47 seconds. Looks like 4-5% water in glycerine is gonna be the right number for the next batch.

Jan 2, 2016 — Wow! I forgot I hadn't updated this for so long! After a year or so I got tired of all the above and just started using 100% VG, no water. It vapes OK, and without the water it doesn't crackle or spit.

To catch up, that first year I went through 2 Ego Twist batteries; they don't last nearly long enough. Then I discovered VisionSpinner batteries, much better! They cost less and last twice as long.

For juice, I get 1 liter of 10% (100mg/ml) nicotine in glycerine, mix that with 2 liters of glycerine, yielding 3 liters of 3.3% (33mg/ml) nicotine. About $75 at MyFreedomSmokes.com. Add to that a couple VisionSpinners and 10 protank coils, totals about $125 for 3+ years of vaping. Can't do better than that!

CAUTION: If you buy 10% bulk nicotine, handle and store it with all possible care — it's very toxic at that strength. Even with the 3.3% mix I always wash hands and wipe down the tanko and countertop after a refill. Just to be safe.

Another thing I do sometimes is drink my dose. Just keep some 3.3% in a little plastic eye-drop bottle and add 5 or so drops (~¼cc) to a liter water bottle and you're good for 2-3 hours. Not as satisfying as vaping, but keeps away cravings when/where you can't vape.

TIP: Keep some Q-tips next to your charger. Always swab out the battery contact in the end of the battery before screwing it onto the charger, else it'll corrode the charger contact.

Rebuilding an Atomizer Coil

My first 2.5-Ohm Protank heater burned out after 6 weeks. I had a spare, but decided to disassemble the bad one and see if it could be fixed. Indeed, the coil wire broke right where it goes into the little rubber bushing in the bottom, so I lost about ¼″ of wire. The coil and wick was encased in a load of black crud. I removed that and un-wound the coil wire and cleaned it. Then wound it around 3 new wicks, leaving two wire tails about ¼″ long, laid it in place, inserted the battery contact bushing and battery contact (one wire is pinched outside the bushing against the outer part; the other wire is pinched inside the bushing against the inner battery contact part). Then laid two wicks on top, trimmed the wicks close with small wire-cutters, installed the top stem and bushing, then tried it. It worked like new, but it quickly flooded and gurgled. Removed the top stem again and added two more wicks on top of the coil, trimmed, and reassembled. Now it works great!

See, the ends of the wicks stick out of two slots, and the upper rubber bushing pushes down over that, closing off the top of the slots above the wicks. If the remaining slot-space below the bushing isn’t full of wicks, it will leak around them, causing flooding of the air tube. So, if your tanko is flooding, you might be able to disassemble the atty and add 2-3 more wicks. That will both fill up the wick-slots, as well as compress the existing wicks some, slowing the flow. It is not necessary to re-wind the wire around more wicks, just lay them on top and don’t mess with trying to rebuild the coil, unless it’s broken or totally gunked in burned carbon crud.

—kv5r