You can ssh from one box to another without typing in your password. This is done using a key pair. One key sits on the computer A, the other on computer B. Starting logged into computer A, here’s how you do it:
ssh-keygen -t dsa
ssh B mkdir ~/.ssh/
cat .ssh/id_dsa.pub | ssh B 'cat >> .ssh/authorized_keys'
When you run ssh-keygen, do not use a passphrase, just press enter. Also, change the bold B to the name or IP of computer B. If you were successful, you should be able to `ssh B` without a password.
To repeat for another computer, do not repeat ssh-keygen, just repeat line 2 & 3. If you run ssh-keygen again, your key will be overwritten and you’ll need to copy it again via line 3.
Using keys is an excellent security measure. You can even setup sshd to only allow keyed logins. No passwords allowed. If you do set this up, make sure you have physical access or a rescue/remote console or you’ll be locked out if you lose your key.
Posted by
James Date:
Thursday, December 17, 2009
Categories:
Linux, Tips
Tags:
login, security, ssh
On a laptop, there are a few keys that have a blue icon on them. These are function keys. They work when you hold down the blue “Fn” key, which is normally next to the Ctrl key.
There are tons of Fn keys. Not all will have the same icons on them. If you want to know what yours do exactly, there should be an easy to read table in your manual. If you don’t have the manual or can’t find it, check the manufacturer’s website.
Standard Fn Keys
There are volume and mute keys . Look for a speaker. One will be crossed through or X’ed out, that’s mute. Volume up will have a lot of sound waves coming out. Volume down will have small sound waves.
Also, there are two brightness keys. These look like a small computer screen with an icon in the middle. To brighten the screen, hold down Fn and press the one with the larger icon. Use the smaller icon to make it darker.
Another key will control the monitor. It should have two screens on it with a slash between. This will flip back and forth between the laptop screen and the monitor.
There’s usually a Number Lock. Sometimes, you’ll get a Scroll Lock or System Request, even though neither of those keys is really used today.
Bonus Fn Keys
There are a few keys that aren’t on all laptops. One is the wifi key. This will look like an antenna with waves coming off either side. It turns the wifi on and off.
You may have a bluetooth key. It will have that trademark bluetooth icon. You can guess what that one does.
Another key is the sleep key. The icon varies greatly. It may be some Z’s on it, but it will definitely remind you of sleep.
Posted by
James Date:
Wednesday, December 16, 2009
Categories:
Tips
Tags:
This entry is part of a series, html» In closing up the HTML series, we’re gonna cover stylesheets and differences between browsers.
Stylesheets
This is just a text document that holds all your style information. It is stored in a separate file so the webpages are smaller and keep traffic down on the webserver and the internet.
To set the style of all p tags, you would say:
p {
color: green;
text-align: center;
background: red;
}
That would make everything inside a p tag green, centered, and have a red background. You could do the same with a div tag, table tag, img tag, or any other tag. You can also use a class name:
.christmas {
color: green;
text-align: center;
background: red;
}
Any tag that has class=”christmas” would have those styles. You can combine the two:
p.christmas {
color: green;
text-align: center;
background: red;
}
Now, any p tag that has class=”christmas” will have the style.
The “p.christmas” in that last example is called the selector. There are plenty more types of selectors, including “ancestor descendant” and “parent > child”. Here is more information about selectors and style properties.
Linking
Putting this in the head section will link the page with a stylesheet at http://www.example.com/style.css:
<link rel="stylesheet" href="http://www.example.com/style.css" type="text/css" />
You can even set a print css, only used when printing the page:
<link rel="stylesheet" href="http://www.example.com/print.css" type="text/css"
media="print" />
A document can have multiple stylesheets. The second one will supercede the first if there’s any duplication. There is one exception. If the first file says this:
p.error {
color: red !important;
}
Then the second file will have to use “!important” if it is to supercede the color.
Browser Differences
From time to time, you’ll run across something that looks fine in one browser and totally funky in another. If you run into this, do a quick search or two. Odds are that someone else has run into it too.
Many times, the answer will be an IE conditional statement or some sort of CSS Hack. The IE conditional works like this:
<!--[if IE]>
<p>According to the conditional comment this is Internet Explorer</p>
<![endif]-->
It’s really one big html comment! IE will show it. Firefox and the rest will ignore it. You can even say:
<link rel="stylesheet" href="http://example.com/overall.css" type="text/css" />
<!--[if IE 6]>
<link rel="stylesheet" href="http://example.com/ie6.css" type="text/css" />
<![endif]-->
That will tell only IE 6 to use an additional stylesheet.
<link rel="stylesheet" href="http://example.com/ie.css" type="text/css" />Linking
Posted by
James Date:
Monday, December 14, 2009
Categories:
Programming, Web
Tags:
css, html, tutorial
This entry is part of a series, html» An HTML form is pretty much anything that requests the user for information. They can be used for just about anything from leaving a comment on a blog to uploading a picture to facebook. Even logins are very simple HTML forms.
Here’s an example login, in html:
<p>Please log in.</p>
<form action="http://example.com/login.php" method="post">
Username: <input name="username" /><br />
Password: <input name="password" type="password" /><br />
<input type="submit" value="Log In" />
</form>
The form tag is where the magic happens. It has an action attribute which is where the form sends the information. The form can use one of two methods to send the information: post or get. Post is more secure, and prefered when doing logins.
There are three inputs. The name attribute of the input is sent back to the web server as the name of the data. The type is the type of input, text being the default. You can also use “password”, “submit”, “file”, “checkbox”, “hidden”, or “radio”.
Also, note that all inputs for the form are contained in the form element.
The previous code makes this form:
Please log in.
Get Vs. Post
The main difference between Get and Post is how the data is sent. Get data is encoded into the URL. For example, http://www.google.com/search?q=compguyaug is the URL when searching for “compguyaug” on google. This makes get form results bookmarkable, in most cases. Therefore, get works great for searches and data lookups.
Post sends the data separate from the URL. This makes it more secure and should be used for logins and adding/editing/updating any data. That way, the end user can’t bookmark adding a certain customer and keep opening that bookmark and unintentionally adding that customer.
Note on Files
When creating a form for file uploads, make sure you use post. Also, a special encoding type must be specified:
<form enctype="multipart/form-data" method="post"
action="http://example.com/uploader.php">
...
Also, some servers have a limit as to how large of a file can be uploaded.
Posted by
James Date:
Thursday, December 10, 2009
Categories:
Programming, Web
Tags:
html, tutorial
This entry is part of a series, html» Tables are one of the fundamentals of html. At one point in time, everyone’s site was built inside a table. It was really easy to do this. Also, whitespace, including spaces, tabs, and new lines, don’t matter much in html, but there are ways to get the whitespace you desire.
Tables
Here’s a 2×2 basic table:
<table border="1">
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
</tr>
</table>
Which looks like this:
| Row 1, Cell 1 |
Row 1, Cell 2 |
| Row 2, Cell 1 |
Row 2, Cell 2 |
Note that I put border=”1″. If I put border=”0″, no border would be added, like this:
| Row 1, Cell 1 |
Row 1, Cell 2 |
| Row 2, Cell 1 |
Row 2, Cell 2 |
Spanning
Each cell in the table can span across, down, or both directions. This is very similar to the merge cell function in Excel. There are a few points to keep in mind. When you span several columns, the next cell in the html code will be the next cell on the screen. Likewise, when you span several rows, you have to skip that cell on the following row(s). Here’s an example:
<table border="1">
<tr>
<td rowspan="2">I span 2 rows.</td>
<td colspan="2">I span 2 columns across.</td>
</tr>
<tr>
<td>I am a single cell.</td>
<td>I am a single cell.</td>
</tr>
</table>
| I span 2 rows. |
I span 2 columns across. |
| I am a single cell. |
I am a single cell. |
Whitespace
Did you notice that the table in the last example could use some text alignment? Maybe vertically align the rowspan cell to the top? Maybe center the colspan cell? How about making the rowspan cell into two lines? Let’s take a look.
Here’s how to vertically align to the top:
<table border="1">
<tr>
<td rowspan="2" style="vertical-align: top">I span 2 rows.</td>
<td colspan="2">I span 2 columns across.</td>
</tr>
<tr>
<td>I am a single cell.</td>
<td>I am a single cell.</td>
</tr>
</table>
| I span 2 rows. |
I span 2 columns across. |
| I am a single cell. |
I am a single cell. |
You could also set vertical-align: bottom for the bottom or middle for the middle.
Centering the colspan cell:
<table border="1">
<tr>
<td rowspan="2">I span 2 rows.</td>
<td colspan="2" style="text-align: center">I span 2 columns across.</td>
</tr>
<tr>
<td>I am a single cell.</td>
<td>I am a single cell.</td>
</tr>
</table>
| I span 2 rows. |
I span 2 columns across. |
| I am a single cell. |
I am a single cell. |
Other possibilities are “left”, “right”, and “justify”.
And finally, inserting a line break:
<table border="1">
<tr>
<td rowspan="2">I span<br />2 rows.</td>
<td colspan="2">I span 2 columns across.</td>
</tr>
<tr>
<td>I am a single cell.</td>
<td>I am a single cell.</td>
</tr>
</table>
I span
2 rows. |
I span 2 columns across. |
| I am a single cell. |
I am a single cell. |
Posted by
James Date:
Monday, December 7, 2009
Categories:
Programming, Web
Tags:
howto, html, tutorial
This entry is part of a series, html» Div Tags
A div tag is very similar to a paragraph tag. The difference from a rendering perspective is that paragraphs have a padding at the top and bottom by default. You can use div tags just like p tags.
Float Style
A div, and other tags, can have a float style. This can float the element on the left or the right. Here’s an example:
<div style="float: right">This floats on the right</div>
<div style="float: left">This floats on the left</div>
<div style="clear: both">This displays under the floats</div>
This floats on the right
This floats on the left
This displays under the floats
Yes, “clear: both” will clear all the floats above it. You can do “clear:left” to place is below the lowest left floating element. Float styles can be used with images as well.
CSS Classes
Styles can be declared once and referred using the class attribute. These styles can be declared using a stylesheet file or a style element. A stylesheet is better because it can be used by multiple pages by adding one line inside the html header:
<link rel="stylesheet" type="text/css" href="http://example.com/main.css" />
If you want to just play a little bit, you can put a style section in the html header:
<style type="text/css">
/* This is a style comment. */
/*
Put your stylesheet here in the html header!
*/
</style>
You can take this:
<div style="float: left; color: red;">Red Left</div>
<div style="float: left; color: red;">Red Left</div>
<div style="float: left; color: red;">Red Left</div>
<div style="float: left; color: red;">Red Left</div>
And turn it into this:
<style type="text/css">
.left-red { float: left; color: red; }
</style>
...
<div class="left-red">Red Left</div>
<div class="left-red">Red Left</div>
<div class="left-red">Red Left</div>
<div class="left-red">Red Left</div>
Note that the class in the style starts with a period and in the div doesn’t. This is because you are telling the browser that left-red is a class. If it started with a letter, the browser would think it was an element, like a “div” tag. Also, curly braces surround what would be in the style attribute.
Now, go play around for 30 minutes with some html. If you have a question, feel free to ask.
Posted by
James Date:
Tuesday, November 24, 2009
Categories:
Programming, Web
Tags:
howto, html, tutorial
This entry is part of a series, html» Image Tag
<img src="http://example.com/image.jpg" alt="Example Image" />
That will give you just an image, plain and simple. The alt tag is important for people who have images disabled and for search engines. Here’s how to center or left align an image:
<img src="http://example.com/image.jpg" alt="Centered Image" align="center" />
<img src="http://example.com/image.jpg" alt="Left Aligned Image" align="left" />
When using an image inside a link, there will be an automatic blue broder. To remove this:
<a href="http://example.com/">
<img src="http://example.com/images.jpg" alt="Link Image" border="0" />
</a>
Background Images
We’ve all seen images used as backgrounds. It’s fairly simple. To put a background image for the whole page, change the opening body tag to this:
<body style="background: url('image.jpg');">
You can change the repeat by adding the repeat-y keyword like this:
<body style="background: url('image.jpg') repeat-y;">
The image will fill the page top to bottom, but not left to right. There are plenty of options for you background image. Here are the repeats:
- repeat — tiled to fill completely (default)
- repeat-y — repeats top to bottom
- repeat-x — repeats left to right
- no-repeat — does not repeat
You can also make it scroll with the page or fixed to the screen and does not scroll. Scroll is the default.
You can also set the background of a p, or paragraph, tag the same way.
<p style="background: url('image2.jpg');">I've got a background image!</p>
The full image will not show if there is not enough text.
Colors
You can set the background color, similarly to using an image:
<p style="background-color: red;">I've got a background color!</p>
<p style="background-color: red; color: yellow;">I've got a foreground color!</p>
In the second example, the text will be yellow on red, while the first is black on red.
Posted by
James Date:
Friday, November 20, 2009
Categories:
Programming, Web
Tags:
howto, html, tutorial
This entry is part of a series, html» Lists
There are two basic types of lists in HTML: ordered and unordered. Unordered lists are bullet lists. Ordered lists are numbered. Each item in the list is housed in between opening and closing “li” tags.
Ordered Lists
A simple numbered list is surrounded by opening and closing “ol” tags. Here is a quick example:
<ol>
<li>Step 1.</li>
<li>Step 2.</li>
</ol>
This looks like:
- Step 1.
- Step 2.
You can use a different marker, just as lowercase letters, uppercase letters, and roman numerals. This is done by styling the list. Here’s how to do roman numerals:
<ol style="list-style-type: upper-roman">
<li>Step I.</li>
<li>Step II.</li>
</ol>
- Step I.
- Step II.
Here are the different ordered list style types:
| upper-letter |
Uppercase Letters |
| lower-letter |
Lowercase Letters |
| upper-roman |
Uppercase Roman Numerals |
| lower-roman |
Lowercase Roman Numerals |
| upper-greek |
Uppercase Greek Letters |
| lower-greek |
Lowercase Greek Letters |
| decimal |
Regular Numbers |
| decimal-leading-zero |
Leading Zero |
Unordered Lists
These are almost identical to ordered lists. Instead of “ol”, you use “ul”. The default list style type is a bullet. Here are the unordered types:
Here’s that unordered list in HTML:
<ul>
<li>none</li>
<li>circle</li>
<li>disc</li>
<li>square</li>
</ul>
Links
A link is super easy to do. It’s an “a” tag. The tag has an “href” attribute that contains the url, just like the “style” attribute contained the styling information. Here’s a quick example:
<a href="http://example.com/">Example.com</a>
Which would like like:
Example.com
You can also tell the browser to open the link in a new window/tab by using the “target” attribute:
<a href="http://example.com/" target="_blank">Example.com in a new window/tab</a>
Example.com in a new window/tab
You can even style the “a” tag to set the color and remove the underline:
<a href="http://example.com/some_web_page.html" style="color: black; text-decoration: none">Example.com</a>
Example.com
Yes, you can set the color of any text with that style attribute. Also note that multiple styles are separated by a semicolon, and it does not matter the order of the styling when put in the “style” attribute, so long as there’s nothing conflicting.
Well, that’s pretty much it for lists & links. The next post is all about images, so check back!
Posted by
James Date:
Tuesday, November 17, 2009
Categories:
Programming, Web
Tags:
howto, html, tutorial
This entry is part of a series, html» More and more people are starting their own websites. Whether it be a blog, an e-commerce site, or a tribute to their pet, learning HTML will help tremendously. Sure, there are those nice little editors, but they cannot do everything. Plus, sometimes you’ll want to tweak that HTML so everything displays properly. In this series, I’ll cover the basics of a webpage, images, tables, lists, styles, and some other topics.
Base Document
I have setup a base HTML document to show the basics that will be covered in this series. You can find it here. It contains a lot of comments which are ignored by the web browser. An HTML comment starts with “<!–” and ends with “–>”, quotes for clarity.
HTML Tags
Tags are special markers that tell the web browser how to display the page. Tags always start with a less than symbol “<” and end with a greater than symbol “>”. There are three types of tags: opening, closing, and self-closing. Closing tags start with “</”. Self-closing tags end with “/>”. Every opening tag should have a closing tag. An HTML document will display everything between the “<body>” opening tag and “</body>” closing tag.
DOCTYPE
All HTML documents should start with a DOCTYPE tag. This tag tells the browser which version of HTML you are using and determines how it will render the page. There are serveral different doctypes, but for this series, we’ll be using XHTML Strict.
Basic Tags
The basic tags are:
- html
This should open immediately after the doctype and close at the very end of the file.
- head
This follows the opening html tag. It contains the title, meta data, and links to stylesheet and javascript files.
- body
This follows the closing head tag. Its contents will display as the webpage. Update: Javascript should be placed as close to the end of the bottom as possible.
- title
This contains the title of the page, it shows in the tab and/or the titlebar of the browser.
- p
This is a paragraph. Each paragraph will have a bit of whitespace before and after them.
- b
This bolds the text between the opening and closing b tag.
Sample
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>This is just a sample</title>
</head>
<body>
<p>This is a paragraph.</p>
<p><b>This is a bold paragraph.</b></p>
<p>There is only <b>one</b> word bold in this paragraph.</p>
<p>It is <b>important</b> to close tags in <b>reverse</b> order they were <b>opened.</b></p>
</body>
</html>
Posted by
James Date:
Thursday, November 12, 2009
Categories:
Programming, Web
Tags:
howto, html, tutorial
We have reached a plateau when it comes to speed limits for CPUs. We may not see anything higher than 4 GHz in the near future. This doesn’t mean that the computer can’t be better or faster. Multicore processors are fairly common today, allowing more than one section of code to run simultaneously. Computers are also dropping their power requirements, and let’s face it, we all want to be green, especially if it means a small electricity bill and keeping some green in our pocket.
Chip manufacturers are now touting about their CPU’s power consumption. Laptops are where this is the major selling point. Less electricity used means a longer battery life. Also, if it can do the same amount of data processing, you can have the same level of productivity for a longer amount of time. Wouldn’t we all want a laptop that can play 4 flash movies and not stutter a single one?
The desktop market hasn’t seen anything to the point of GHz/Watt. That’s because the folks in marketing think no one really cares how much electricity that computer’s going to use, unless you’re a computer dork like me running around the house with your brand new kill-a-watt. I found an article on Wikipedia, they’ve listed pretty much every known CPU, their power requirements, speed and MHz/Watt or GHz/Watt.
Sure, there’s more to that computer than a CPU. There’s RAM, a hard drive, monitor, keyboard, mouse, USB ports and devices, network connections, fans, and other chips to support everything from video to audio to that fancy SATA II interface blu-ray burner you just had installed. Where are the power requirements, in Watts, for all these devices? Can it be found? Is it even available?
If the data can be found, could a normal high school graduate understand it? Would they even care? I’m betting most people won’t.
Posted by
James Date:
Tuesday, November 3, 2009
Categories:
Tips
Tags:
ghz, green, watt