Wednesday, 2 February 2011

Simple layout #15

Here is another layout which uses jquery corners.

See demo.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Layout 15</title>
<!--[if IE]>
 <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="http://meyerweb.com/eric/tools/css/reset/reset.css" />
<script src="http://www.google.com/jsapi"></script>
<style type="text/css">
*
{
 margin:0;
 padding:0;
}
body
{
 margin:0 auto;
 width:800px;
 margin-top:100px;
}
header
{
 float:left;
 color:#FF9200;
}
h1, h2, p
{
 font-weight:normal;
}
h1, h2
{
    font-family:Georgia, Times New Roman, Times, serif;  
    text-transform:uppercase;
color:#000000;
}
h1
{
    font-size:5em;
}
h2
{
    font-size:4em;
}
p
{
    font-family: Arial, Helvetica, sans-serif;
    font-style: normal;
    font-variant: normal;
    letter-spacing:0.1em;
    text-align:justify;
}
p
{
    font-size: 1.25em;
    margin-top: 1.25em;
    margin-bottom: 1.25em;
}
header p
{
 width:360px;
}
#tl
{
 float:right;
 width:400px;
 height:400px;
 background:#FF9200;
 color:#FFFFFF;
}
#tl p
{
 float:right;
 width:280px;
 padding-top:160px;
 padding-right:20px;
}
</style>
<script src="http://www.google.com/jsapi"></script>
<script>
 google.load("jquery", "1");
 google.load("jqueryui", "1");
</script>
<script type="text/javascript" src="http://github.com/malsup/corner/raw/master/jquery.corner.js"></script>
<script>
$(document).ready(function()
{
 $('#tl').corner('tl 400px');
});
</script>
</head>
<body>
 <header>
  <h1>header 1</h1>
  <h2>header 2</h2>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper.</p>
 </header>
 <div id="tl" class="">
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante.</p>
 </div>

</body>
</html>

A beginners guide to get your website working with Facebook

Below are 3 steps to :

  1. Get Facebook functionality into your website.
  2. Have a Facebook application presence for your website.

Step 1 :
Register your website to get an AppID here http://developers.facebook.com/setup/
Receieve your AppID and App secret.
You also get an example page with a login and like plugin, which you can extract and embed into your site.

Step 2 :
Seeing this in action gives you the confidence to move to the next stage. You can go to http://developers.facebook.com/docs/plugins. Here you will see other plugins which can be easily embeded into your site. Some of these plugins are designed to work in co-ordination with the Facebook Page you get with your application ID. This is available through http://www.facebook.com/apps/application.php?id=yourAppID

Step 3 :
You may also access the Social Graph API. Documentation of which resides here http://developers.facebook.com/docs/api. An example being that using https://graph.facebook.com/yourAppID will return JSON data about your application.
If for example, your website uses PHP, you may process this JSON data and represent it on your website.

Monday, 31 January 2011

Smooth fonts. No really! Just use Cufón.

There is a little pain in this exercise, but it genuinely works. It's worth it.

You see, when I'm at my day job, I have to use Windows. It's rubbish. And particularly rubbish is the way it handles fonts through a web browser. Even IE! Knowing that lots of other poor people have to use Windows, it's important to me to try and make the fonts of my site nice and smooth. I've done quite a bit of surfing on this, but I believe I've currently got the answer. Use Cufón. Available from http://cufon.shoqolate.com.

Step 1:
Find a TTF or OTF copy if the font you would like in your page. Yes, the file.
Step 2:
Go to http://cufon.shoqolate.com and get the latest version of the JavaScript file.
Step 3:
After the style references in your web page, add a reference to the newly downloaded JavaScript file thus:
<script type="text/javascript" src="cufon-yui.js"></script>
Step 4:
Convert your font by posting it up to http://cufon.shoqolate.com, remembering to check the boxes saying "The EULAs of these fonts allow Web Embedding" and "I acknowledge and accept these terms". Completing this process gives you a .js file for your font.
Step 5:
Add a reference to the .js file you got from http://cufon.shoqolate.com thus:
<script type="text/javascript" src="my-new-font.font.js"></script>
Step 6:
Add the necessary conversions to your page thus:
<script type="text/javascript">
Cufon.replace('h1', { fontFamily: 'myNewFont' });
</script>
Step 7:
Below the body tag of your page, add the line:
<script type="text/javascript">Cufon.now();</script>
This is for IE. I know!

Behold! Smooth fonts for your website. Even in Windows!


Tuesday, 25 January 2011

ccrypt to encrypt files

If you need to encrypt a file which contains personal data, you can use ccrypt. It's not installed by default on ubuntu so you'll have to do a:

sudo apt-get install ccrypt
but once done you can encrypt your file using

ccrypt -e filename
and decrypt using

ccrypt -d filename

How much RAM do I have on my GNU/Linux machine?

free -m
For a result like this
total used free shared buffers cached
Mem: 1899 1273 626 0 17 858
-/+ buffers/cache: 397 1502
Swap: 5561 23 5538

From gtk-recordmydesktop to youtube in one line

It's good to be back to being a GNU/Linux and in particular Ubuntu, home user.

When you record your screencast using gtk-recordmydesktop the ouput is an ogg file. Your file still needs to meet the needs of youtube if you are to vodcast. For this you will need a line like this....

mencoder oo1.ogg -oac mp3lame -ovc lavc -ofps 30 -vf scale=320:240 -o oo1.mpg

If you don't have mencoder, then you can install it using:
sudo apt-get install mencoder

Monday, 24 January 2011

Four cornered web page

How do you add four different backgrounds as corners to your web page?
The answer is below. It even work in IE. You will have to create your own corner images.

See demo.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>4 corners</title>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="http://meyerweb.com/eric/tools/css/reset/reset.css" />
<style>
#topLeft, #topRight, #bottomLeft, #bottomRight
{
position:absolute;
width:100%;
height:100%;
}
#topLeft
{
background:url(topLeftCorner.png) no-repeat left top;
z-index:-10;
}
#topRight
{
background:url(topRightCorner.png) no-repeat right top;
z-index:-9;
}
#bottomLeft
{
background:url(bottomLeftCorner.png) no-repeat left bottom;
z-index:-8;
}
#bottomRight
{
background:url(bottomRightCorner.png) no-repeat right bottom;
z-index:-7;
}
#mainContent, h1
{
padding:2em;
}
</style>
</head>
<body>
<section id="topLeft"></section>
<section id="topRight"></section>
<section id="bottomLeft"></section>
<section id="bottomRight"></section>
<section id="mainContent">
<h1>Hello World!</h1>
</section>
</body>
</html>