PHP rjust

Python has a neat feature that does right alignment of strings with the syntax:

string.rjust(padding,fill_char)

> The method rjust() returns the string right justified in a string of length width. Padding is done using the specified fillchar (default is a space). The original string is returned if width is less than len(s).

Below you can find how to do it in PHP

##php rjust function

// by techblog.willshouse.com
function rjust($string,$total_length,$fillchar=’ ‘)
{
// if the string is longer than the total length allowed just return it
if(strlen($string) >= $total_length)
{
return $string;
}

$total_length = intval($total_length);

// total_length must be a number greater than 0
if( ! $total_length )
{
return $string;
}

// the $fillchar can’t be empty
if(!strlen($fillchar))
{
return $string;
}

// make the fill character into padding
while(strlen($fillchar) < $total_length) { $fillchar = $fillchar.$fillchar; } return substr($fillchar.$string, ( -1 * $total_length )); } ### test php rjust function header('Content-type: text/plain'); $items = array('one','a','superduper'); foreach($items as $item) { echo rjust($item,15); echo "\n"; } ### php rjust function output one a superduper

Posted in Tech Tips, Web Development | Tagged | 1 Comment

GMail: Get the Old Compose Back

Here’s how to get the old compose email back with G-mail.

Google is warning that the change back may only be temporary – but I hate the new compose style so perhaps with enough feedback from other users they will allow the old-school style of compose to stick around.

GMail: Get the Old Compose Back

Posted in Tech Tips | Tagged , | 1 Comment

How do I choose and install regulators when installing 2psi natural gas lines?

When installing natural gas, I was under the impression that the appliances would hook directly to the gas lines at 2psi but the inspector said that they are rated in water columns – here is the tag from my dryer:

How do I choose and install regulators when installing 2psi natural gas lines?

Converting w.c. to psi shows that 4 w.c. is around 0.144 psi and 10.5 w.c. is around .379 psi so I suppose the appliance is not supposed to take 2psi directly or 55 w.c. – but I have never heard of putting regulators at all the appliance connections and the inspector did say it is a new thing.

I searched and it seems like this is the best regulator for the job, if I do in fact need one:

[MAXITROL 1/2″ IPS NATURAL GAS REGULATOR MODEL325-3L](http://www.amazon.com/MAXITROL-325-3L-12A09-Regulator-Pressure/dp/B000LDCTVE?&tag=amazsr-prodct-20)

How do I choose and install regulators when installing 2psi natural gas lines?

I believe the “L” model is the vent-limiting model that can be used indoors and it has some blue paint to show the difference.

Specifications are as follows:

How do I choose and install regulators when installing 2psi natural gas lines?

Here is how I’m thinking about hooking it all up:

How do I choose and install regulators when installing 2psi natural gas lines?

Posted in Tech Tips | Tagged , | Leave a comment

Does Amazon ec2 have “Get System Log” for the command line (CLI) API?

Yes! I didn’t realize this at first. I was searching for `API tool for getting system log` and `ec2 command line system log` and I even looked at all the ec2 command looking for the word `log` – but there is a trick. If you want to be able to grab the data that you grab via the web interface at `console.aws.amazon.com`:

I hope this answer the following questions:

  • ec2 “get system log” command line
  • ec2 “get system log” command line
  • ec2 cli system log
  • ec2 get system log
  • amazon ec2 api get system log
  • amazon ec2 system tools

“get system log” command line

Then you need to use the following ec2 command:

ec2-get-console-output

####SYNOPSIS

ec2gcons ([ec2-get-console-output])

ec2gcons [GENERAL OPTIONS] [-r] INSTANCE

####GENERAL NOTES

> Any command option/parameter may be passed a value of ‘-‘ to indicate that values for that option should be read from stdin.

####DESCRIPTION

> Display the instance’s console output. The INSTANCE parameter is the ID of the instance’s console to retrieve.

####SPECIFIC OPTIONS

-r, –raw-console-output
Raw output. Do not escape the console output. If not specified ^ESC
is escaped and multiple blank-lines are folded into one.

Posted in Uncategorized | Tagged , , | Leave a comment

Google: Resend Verification Email

If you have signed up for a Google account using another e-mail address, you will need to verify your Google account before using it.

If you did not verify your account or if you did not get the original e-mail that Google sent, just follow these instructions in order to get google to resend the verification e-mail to your inbox:

Google: Resend Verification Email

###Step 1: Google Account Re-send Verification

Visit the site http://www.google.com/accounts/ and sign in with your new account

###Step 2: Click on the link to Re-send the Verification Email

Before you proceed with signing into the service you’ll need to verify your email address associated with your Google Account. If you’d like to use a different email address, you can change it.

That’s it – you’re done!

Posted in Tech Tips | Tagged | 1 Comment

Does Hyundai Genesis V8 Come In Manual Transmission?

Does Hyundai Genesis V8 Come In Manual Transmission?

The chart below shows which transmissions come with which Hyundai Genesis engines and body styles:

Genesis Engine Genesis Body Style Genesis Transmission
4 cyclinder 2D Coupe Manual / Automatic / Sport Shift
6 cyclinder 2D Coupe Manual / Automatic / Sport Shift
V8 2D Coupe coupe not available in v8
4 cyclinder 4D Sedan Automatic / Sport Shift
6 cyclinder 4D Sedan Automatic / Sport Shift
V8 4D Sedan Automatic / Sport Shift
Posted in Uncategorized | Tagged , | Leave a comment

Mac: Edit Sidebar Items in Finder

Recently I put a CD in my drive but it didn’t show up in my sidebar in the finder. I was confused. I remembered editing the items there before, but couldn’t remember how I did it.

I know how to add items to the finder’s sidebar – you find the folder or file you want and drag it in there – you can even rearrange things that way:

Mac: Edit Sidebar Items in Finder

But that didn’t give me this – which is the window I remembered using to edit Mac OSX’s sidebar items (screenshot from Mac OS X Lion but it is very similar in Snow Leopard):

Mac: Edit Sidebar Items in Finder

After a little searching and trial and error I remembered that I could do this by using the finder’s `menu bar` » `Preferences`:

Mac: Edit Sidebar Items in Finder

Problem solved!

Posted in Mac, Software, Tech Tips | Tagged | Leave a comment

“mozilla/5.0 (windows nt” “opera/9.80 (windows nt”

”mozilla/5.0 (windows nt” “opera/9.80 (windows nt” is part of a user agent string that you may see in your access logs. Part of that string (it is not complete) is listed in the [Most Common User Agents](https://techblog.willshouse.com/2012/01/03/most-common-user-agents/)

It is possible that this user agent string is a bot – it seem to refer to Windows XP and very frequently Windows XP useragents, especially IE6, are bots.

“mozilla/5.0 (windows nt” “opera/9.80 (windows nt”

Here are two very common BOT useragents that are similar to the `”mozilla/5.0 (windows nt” “opera/9.80 (windows nt”` string:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MRA 5.8 (build 4157); .NET CLR 2.0.50727; AskTbPTV/5.11.3.15590)

And also:

Opera/9.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.01

If you have a browser that has a console (like google chrome) you can type `navigator.userAgent` to see what your browser’s useragent is:

“mozilla/5.0 (windows nt” “opera/9.80 (windows nt”

Posted in Tech Tips | Tagged , | Leave a comment

Viper Toilet by Gerber

Viper Round Front / Elongated Front Toilet

Viper Toilet by Gerber

 

  • 1.6 gpf Gravity
  • Two-piece toilet
  • bowl sku #0021552 – $111.00
  • tank sku #0028595 – $119.00
  • Round Front Bowl
  • 10″ Rough-in
  • Large water surface keeps bowl clean
  • Fully Glazed Trapway
  • Non corrosive solid brass tank-to-bowl bolts
  • Double nut, multi-point tank-to-bowl mounting system for easy installation and tank stability
  • Non-kinking stainless steel beaded chain
  • Chemical resistant silicone flapper
  • Color-matched front metal tank lever with brass arm
  • Fluidmaster® Fill Valve
  • Toilet seat not included
  • Limited lifetime warranty
  • Industry MaP Rating:800g

Posted in Marketing | Tagged | 1 Comment

Avalanche Toilet by Gerber

Avalanche Toilet by Gerber

Avalanche Toilet by Gerber

  • HET High Efficiency Toilet
  • 1.28 gpf Gravity
  • Round Front Bowl
  • Two-piece toilet
  • bowl sku #HE21852 – $180.00
  • tank sku #HE28895 – $143.00
  • 10″ Rough-in
  • WaterSense certified
  • Large water surface keeps bowl clean
  • Fully Glazed Trapway
  • Non corrosive solid brass tank-to-bowl bolts
  • Double nut, multi-point tank-to-bowl mounting system for easy installation and tank stability
  • Non-kinking stainless steel beaded chain
  • Chemical resistant silicone flapper
  • Dual fed siphon jet
  • Color-matched side metal tank lever with brass arm
  • Fluidmaster® Fill Valve
  • Toilet seat not included
  • 3″ flush valve
  • Limited lifetime warranty
  • Discontinued — Available while supplies last
  • Industry MaP Rating:800g

Posted in Marketing | Tagged | Leave a comment