Thursday, April 26, 2007

RSS FAQs - Atom Feed File Structure and Elements

A collection of 15 FAQs on Atom feed file structure and elements. Clear answers are provided with tutorial samples on Atom feed documents and Atom entry documents; sub-elements of the feed and entry elements; generating contents for id, updated, and link sub-elements.
Topics included in this collection are:


  1. Are Atom Feed Files XML Documents?
  2. How Many Document Types Are Defined for Atom Feed Files?
  3. What Is the Structure of Atom Feed Documents?
  4. What Are Sub-elements of the feed Element?
  5. How To Generate a Feed title Element?
  6. How To Generate a Feed subtitle Element?
  7. How To Generate a Feed link Element?
  8. How To Generate a Feed id Element?
  9. How To Generate a Feed updated Element?
  10. How To Generate a Feed author Element?
  11. What Are Sub-elements of the entry Element?
  12. How To Generate a Feed Entry link Element?
  13. How To Generate a Feed title Element?
  14. How To Generate a Feed summary Element?
  15. Can One Atom Feed Document Have Multiple Entries?


Are Atom Feed Files XML Documents?



Yes. Atom feed files are XML (eXtensible Markup Language) documents. Atom feed files
must be well-formed XML documents, respecting the following XML rules.



  • The first line must be the "xml" processing instruction with "version" and "encoding" attributes.

  • There must be only one root element in a single XML document.

  • All elements must be closed with the closing tags.

  • One element can be nested inside another element.

  • One element can not be partially nested inside another element.

  • Element attribute values must be quoted with double quotes.

  • Special characters in element attribute values or element contents must be protected using
    entities, like < and >.




How Many Document Types Are Defined for Atom Feed Files?



There are 2 document types defined for Atom feed files:



  • Atom Feed Document - Representing an Atom feed, including
    metadata about the feed, and some or all of the entries associated
    with it. Its root element is the <feed> element.

  • Atom Entry Document - Representing only one Atom entry.
    Its root element is the <entry> element.




What Is the Structure of Atom Feed Documents?



An Atom feed document must have a root element called "feed".
Within in the "feed" element, one or more "entry" elements are enclosed.
The high level structure of an Atom feed document looks like:



<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
(other feed sub-elements)
<entry>
...
</entry>
<entry>
...
</entry>
(more entry elements)
</feed>



What Are Sub-elements of the feed Element?



The "feed" element has the following sub-elements defined:



  • <author> - Specifying the personal information about an author of the contents provided in this feed.
    A feed element may have zero, one or more author sub-elements.


  • <category> - Specifying the category information of the contents provided in this feed.
    A feed element may have zero, one or more category sub-elements.


  • <contributor> - Specifying the personal information about a contributor of the contents provided in this feed.
    A feed element may have zero, one or more contributor sub-elements.


  • <generator> - Specifying the information about the software used to generate this feed.
    A feed element may have zero or one generator sub-element.


  • <icon> - Specifying the URL location of an icon image that identifies this feed.
    A feed element may have zero or one icon sub-element.


  • <logo> - Specifying the URL location of an logo image that identifies this feed.
    A feed element may have zero or one logo sub-element.


  • <id> - Specifying a URI that universally and uniquely identifies this feed.
    A feed element must exactly one id sub-element.


  • <link> - Specifying a URL location of a Web page as a reference to this feed.
    A feed element may have zero, one or more link sub-elements.
    However, at least one link sub-element with rel="self" is recommended.




  • <rights> - Specifying the information about the copyrights for this feed.
    A feed element may have zero or one rights sub-element.


  • <subtitle> - Specifying a description or a subtitle for this feed.
    A feed element may have zero or one subtitle sub-element.


  • <title> - Specifying a title for this feed.
    A feed element must have exactly one title sub-element.


  • <updated> - Specifying a time stamp of when this feed was updated.
    A feed element must have exactly one updated sub-element.


  • <entry> - Specifying an entry of a feed.
    A feed element must have one or more entry sub-elements.




How To Generate a Feed title Element?



The <title> element is a required sub-element of the <feed> element.
The title element should contain a short but human readable title of the feed document.
You should follow the same rules on Web page title elements to generate your Atom feed title elements.



One strategy is to use the same title as the Web page that your Atom feed is based on.
For example, if your Web site provides a Web page for the most popular FAQ entries for Webmasters.
That Web page has a title called: "The Most Popular FAQ Entries for Webmasters".
Now you want to generate an Atom feed for that Web page. Obviously, you should the same title as
that page:



<title>The Most Popular FAQ Entries for Webmasters</title>



How To Generate a Feed subtitle Element?



The <subtitle> element is not a required sub-element of the <feed> element.
But it is strongly recommended that you provide a subtitle element for each of your
feed documents. You should follow the same rules on Web page description meta elements
to generate your Atom feed subtitle elements.



One strategy is to use the same value of the description meta element
as the Web page that your Atom feed is based on.
For example, if your Web site provides a Web page for the most popular FAQ entries for Webmasters.
That Web page has the following description meta element:


<meta name="description" content="The top 10 popular
entries of this week on our comprehensive collection
of Webmaster FAQs."/>


Now you want to generate an Atom feed for that Web page. Obviously, you should borrow
value from the description meta element of that page:



<title>The Most Popular FAQ Entries for Webmasters</title>
<subtitle>The top 10 popular
entries of this week on our comprehensive collection
of Webmaster FAQs."</subtitle>



How To Generate a Feed link Element?



The <link> element is not a required sub-element of the <feed> element.
But it is strongly recommended that you provide a link element with rel="self" for each of your
feed documents.



The rule for feed link element is simple. It needs two attributes:



  • rel="self" - Indicating that this link is providing the URL of this feed document itself.

  • href="urlOfThisFeed" - Specifying the URL of this feed document.



For example, if you have a feed document located at http://dev.fyicenter.com/atom.xml,
you should generate a feed link element like this:



<link rel="self" href="http://dev.fyicenter.com/atom.xml"/>


The <id> element is a required sub-element of the <feed> element.
The Atom specification requires that you provide a universally unique identifier
for each of your feeds. So how to make this identifier universally unique?



One strategy is to use the URL where the feed document is located. For example,
if your Atom feed document is located at: http://dev.fyicenter.com/atom.xml,
you use the following id element in this feed document:



<id>http://dev.fyicenter.com/atom.xml</id>



How To Generate a Feed updated Element?



The <update> element is a required sub-element of the <feed> element.
The Atom specification requires that you provide a data and a time of when this feed was updated.
There is no problem to know the data and time for this element. But you need to pay attention
to the format of how the date and time should be specified.



Atom specification requires you to use the format defined in
RFC 3393 for the update element.
So you should one of the following two formats defined in RFC 3339:



  • yyyy-mm-ddThh:mm:ss.ccZ, where T is a delimiter, and Z indicates this is a UTC time value.
    For example: 2006-08-12T23:20:50.52Z.

  • yyyy-mm-ddThh:mm:ss.cczzzzz, where T is a delimiter, and zzzzz is a time zone modifier like
    -08:00, which is 8 hours behind UTC. For example: 2006-08-12T15:20:50.52-08:00.




How To Generate a Feed author Element?



The <author> element is not a required sub-element of the <feed> element.
However, it is required to have a feed author element, if one of the feed entries does not
have an author element. This requirement is to make sure that every feed entry has an author
information.



The <author> element is actually a container element, with 3 sub-elements defined as:



  • <name> - Specifying the author's name. For example: Karl King. name is a required sub-element.

  • <email> - Specifying the author's email address. For example: karl_king@fyicenter.com.
    email is not a required sub-element.

  • <uri> - Specifying the author's Web page, if exists. For example: http://www.fyicenter.com/karl_king.
    url is not a required sub-element.




What Are Sub-elements of the entry Element?



The "entry" element has the following sub-elements defined:



  • <author> - Specifying the personal information about an author of the contents provided in this feed entry.
    A feed element may have zero, one or more author sub-elements.


  • <category> - Specifying the category information of the contents provided in this feed entry.
    A feed element may have zero, one or more category sub-elements.


  • <content> - Specifying the content of this feed entry.
    A feed element may have zero, or one content sub-element.


  • <contributor> - Specifying the personal information about a contributor of the contents provided in this feed entry.
    A feed element may have zero, one or more contributor sub-elements.


  • <id> - Specifying a URI that universally and uniquely identifies this feed entry.
    A feed element must exactly one id sub-element.


  • <link> - Specifying a URL location of a Web page as a reference to this feed.
    A feed element may have zero, one or more link sub-elements.
    But if there is no content sub-element in a feed entry, at least one link sub-element with rel="alternate"
    is required.


  • <published> - Specifying a time stamp of when this feed entry was originally published
    A feed element may have zero or one published sub-element.


  • <rights> - Specifying the information about the copyrights for this feed.
    A feed element may have zero or one rights sub-element.


  • <source> - Specifying a feed entry in another feed document if this entry is a copy of that entry.
    A feed element may have zero or one source sub-element.


  • <summary> - Specifying a summary for this feed entry.
    A feed element may have zero or one summary sub-element. However it is recommended that each
    feed entry to have one summary sub-element.


  • <title> - Specifying a title for this feed.
    A feed element must have exactly one title sub-element.


  • <updated> - Specifying a time stamp of when this feed was updated.
    A feed element must have exactly one updated sub-element.



How To Generate a Feed Entry link Element?



The <link> element is not a required sub-element of the <entry> element.
But it is strongly recommended that you provide a link element with rel="alternate" for each of your
feed entries.



The rule for feed entry link element is simple. It needs two attributes:



  • rel="alternate" - Indicating that this link is providing the URL of an alternate version of
    the content of this feed entry.

  • href="urlOfTheContent" - Specifying the URL of the content of this feed entry.



For example, if you have a feed document that contains a feed entry
to represent the most popular FAQ entry of the week. Of course, that most popular
entry is a Web page with a URL like http://dev.fyicenter.com/faq/rss.
you should generate the link element for this feed entry like this:



<link rel="alternate" href="http://dev.fyicenter.com/faq/rss"/>



How To Generate a Feed title Element?



The <title> element is a required sub-element of the <entry> element.
The title element should contain a short but human readable title of the feed entry.
You should follow the same rules on Web page title elements to generate your Atom feed entry title elements.



One strategy is to use the same title as the Web page that your Atom feed entry is based on.
For example, if one of your page is included as an entry in your Atom feed document,
and that page has a title called: "Atom Feed Introduction and File Generation".
Now you want to generate an Atom feed for that Web page. Obviously, you should the same title as
that page:



<title>Atom Feed Introduction and File Generation</title>



How To Generate a Feed summary Element?



The <summary> element is not a required sub-element of the <feed> element.
But it is strongly recommended that you provide a summary element for each of your
feed entries. You should follow the same rules on Web page description meta elements
to generate your Atom feed entry summary elements.



One strategy is to use the same value of the description meta element
as the Web page that your Atom feed entry is based on.
For example, if one your FAQ page is selected as a feed entry in Atom feed document,
That Web page has the following description meta element:


<meta name="description" content="A collection of
16 FAQs on Atom feed file standard. Clear answers are
provided with tutorial samples on introduction to Atom
feed file standard; various ways to generate Atom feeds;
linking Atom feeds to Web pages."/>


You should simply borrow value from the description meta element of that page
to generate feed entry summary element:



<summary>A collection of
16 FAQs on Atom feed file standard. Clear answers are
provided with tutorial samples on introduction to Atom
feed file standard; various ways to generate Atom feeds;
linking Atom feeds to Web pages.</summary>



Can One Atom Feed Document Have Multiple Entries?



Yes. One Atom feed document can have multiple entries. Here is a good example:



<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>The Most Popular FAQ Entries for Webmasters</title>
<subtitle>The top 3 popular
entries of this week on our comprehensive collection
of Webmaster FAQs.</subtitle>
<link rel="self"
href="http://dev.fyicenter.com/faq/top_3_atom.xml"/>
<id>http://dev.fyicenter.com/faq/top_3_atom.xml</id>
<updated>2005-07-13T18:30:02Z</updated>
<author>
<name>FYIcenter.com</name>
<email>noreply@fyicenter.com</email>
</author>



<entry>
<title>Atom Feed Introduction and File Generation</title>
<link rel="alternate"
href="http://dev.fyicenter.com/faq/rss/index.html"/>
<id>href="http://dev.fyicenter.com/faq/rss/index.html</id>
<updated>2005-07-13T18:30:02Z</updated>
<summary>A collection of
16 FAQs on Atom feed file standard. Clear answers are
provided with tutorial samples on introduction to Atom
feed file standard; various ways to generate Atom feeds;
linking Atom feeds to Web pages.</summary>
</entry>
<entry>
<title>Understanding and Using Sessions in PHP Scripts
</title>
<link rel="alternate"
href="http://dev.fyicenter.com/faq/php/index.html"/>
<id>href="http://dev.fyicenter.com/faq/php/index.html</id>
<updated>2005-07-13T18:30:02Z</updated>
<summary>A collection of 19 tips on understanding and
using sessions in PHP. Clear explanations and tutorial
exercises are provided on starting and closing sessions,
saving and retrieving values in sessions, deciding how
session IDs to be transferred, deciding where to store
session files, deciding when to expire session values,
etc.</summary>
</entry>
<entry>
<title>Page Layout and Background Image Design with CSS
</title>
<link rel="alternate"
href="http://dev.fyicenter.com/faq/css/index.html"/>
<id>href="http://dev.fyicenter.com/faq/css/index.html</id>
<updated>2005-07-13T18:30:02Z</updated>
<summary>A collection of 18 FAQs/tutorials tips on
designing Web page layouts and background images.
Clear answers are provided with tutorial exercises
on screen and browser resolutions, setting Web page
width in absolute and relative length units, setting
images and font sizes in relative length units, adding
multiple background images.</summary>
</entry>
</feed>

Monday, April 23, 2007

This is Hardware: Do Not Enter

The rise of truly mobile computing is a good thing, most would agree. Instead of lugging around heavy racks of gear and a bundle of cables, we might be able to do everything we need to with a laptop and wireless networking. But when you're dependent on a single piece of kit, there's a downside.


I've just been trying to get a friend's PowerBook working again, after it failed to power up and the battery had gone flat. It's fault is a typical one for any electronic gear - the PCB-mounting DC socket on the back panel had worked loose with repeated plugging and unplugging of the lead from the power supply. With traditional electronic equipment this would be a trivial matter of maintenance; you'd unplug from the mains, unscrew the cover, identify the loose component on the underside of the PCB and re-solder. You'd be back up and running in five minutes.


Laptops are a different story. I've had to fix them before, and it's not a job I look forward to. Firstly, all the screws have non-standard heads. This might be regarded as a sensible precaution, because - let's face it - some computer users have to be protected from themselves. But I am the kind of person who keeps the special Torx screwdriver required to remove them, so within a minute or two I've located and unscrewed all of them on this particular PowerBook.


However, the cover won't come away from the underside of the laptop to allow access to the power input module with the faulty socket. So I carefully prise the corners of the case to see what's holding it together. Is it a further hidden screw, or does the case clip together in a way that was only ever designed for assembly, not disassembly? It turns out to be both - once I've removed the keyboard, I find the hidden screw which runs in the opposite direction to all the others. I then carefully pop open the case, trying to avoid breaking the paper-thin strips that form the electrical contacts between screen and motherboard, keyboard and motherboard, and in several other places besides.


I finally get the case open enough to see the power module, a small PCB on its own, easily identified at the rear. There's the loose socket that caused the power problem - the solder connections are completely broken, but at least it's the kind of repair job that can be achieved by a steady hand. Then I see that the power board is riveted in place. There's no way it's going to come out without breaking the case. At this stage I give up, having spent about two hours in the repair attempt.


I hate to think what would happen if the fault had become apparent on the way to a conference or a critical meeting. I've had other kinds of electronic equipment fail on me before, but it wouldn't have taken more than a few minutes to plug in a spare. Even assuming you could get hold of a spare laptop in time, it could take quite a while to get it set up to the point where you were ready to get going. Of course, we all back up our laptops every day, and never ever lose any data.


The problem is that consumer electronics devices - which is what nearly all laptops are - are a fundamentally disposable, non-maintainable technology. It is possible to buy a 'ruggedized' laptop with a tough metal case, but the inside is still full of tiny, fragile parts, with boards designed under a microscope and soldered by robots with a precision that humans can't achieve. For all their utility on the road, one careless drop on the floor is enough to finish the average laptop - they are not meant to be repaired or tinkered with, let alone improved.


Contrast this to free software, where maintenance and improvement are positively encouraged. Having got used to source code access as a matter of course, merging patches and infinitely tweakable configuration files, could we ever go back to software that behaved as a sealed black box, with a sticker saying 'Do not enter'? On the hardware front, the signs are not good, as machines get ever smaller and proprietary chipsets continue to dominate fields including 3D graphics and wireless networking.


Next to the broken Apple laptop sits a Leak valve amplifier, a TL/12 Plus. This example dates from roughly 1958; similar amps were used in both BBC studio monitor systems and early hi-fi's (at least, by those that could afford them in austere post-war Britain). The Leak needs a new capacitor or two, but still sounds great. It's infinitely repairable, to the point that many Leak valve amps in use today have few original components. It's a stark contrast to the laptop which was made over forty years later.

Thursday, April 5, 2007

The Newbies Guide to Compiling Your First Kernel

So you've been using Linux for a while now and have decided to take the next step. Whether you are looking for a performance increase, added hardware support or even just to enhance your geek cred, compiling your own kernel need not be a horrifying experience. Compiling a kernel has historically been a very involved and, at times, frustratingly hair pulling experience for new Linux users. All that has changed however with new tools making it easier than ever before to roll your own. In this article I will take you through the whole process, step by step, from downloading to booting your new kernel.

Obtaining your new Kernel

Many distributions either install the source for the current kernel or make it available via the package manager, some distributions even make it possible to install a new kernel via the package manager. The downside to this is that it isn't going to be the latest kernel and that you aren't going to get the same level of customization as you do when compiling your own. Therefore we need to go straight to the source (excuse the pun) and download our kernel from www.kernel.org. I would recommend downloading the 'Latest Stable Version' by clicking on the 'F' link beside the release date. This will take some time to download on slower connections, feel free to continue on to the 'Preparing Your System' section while you wait for your new kernel to download.

Preparing Your System

The main prerequisite to compiling your own kernel is (not surprisingly) a compiler, if a compiler is not installed on your system then use your distributions package management tools (Apt, Yum, Synaptic, Emerge, etc...) to install the most recent version of gcc (the GNU compiler). You will also need to install the bzip2 package using your package manager. Debian users can install the build-essential package to ensure that they have all the tools required to build things. NCurses is also required for those using menuconfig, however we will be using xconfig in this article which is a bit friendlier and for that NCurses isn't needed. You will also need to use mkinitramfs, which will be available with most package managers in the form of mkinitramfs-tools, or similar and is used to create a temporary file-system in Ram to boot the kernel from. If your package manager doesn't provide these tools they can be downloaded from the following locations:

gcc - http://gcc.gnu.org/

bzip2 - http://www.bzip.org/

mkinitramfs - http://sourceforge.net/projects/mkinitramfs/

Unpacking Your Kernel

Once your kernel is downloaded you need to move it to your /usr/src/ directory and unpack it. You then need to create a link from your actual kernel source directory to the default kernel source location /usr/src/linux/. Follow the commands below, replacing linux-2.6.20-1 with the version you have downloaded and /home/fred/ with the location that you have downloaded the kernel to.

mv /home/fred/linux-2.6.20-1.tar.bz2 /usr/src/

tar -jxvf linux-2.6.20-1.tar.bz2

ln -s /usr/src/linux-2.6.20-1/ /usr/src/linux

Configuring Your Kernel

The configuration file for your kernel has over 2000 options, most of which mean absolutely nothing to most people, therefore we don't want to have to set each one individually. The easy way around this is to copy the configuration file for your current kernel and modify that. The config file for your current kernel is in the /boot/ directory, If you were using a 2.6.17 kernel your config file would be /boot/config-2.6.17. When you are configuring a new kernel it creates a .config file in the /usr/src/linux/ directory, if one already exists it loads the settings from that and saves changes back to it. Therefore, you need to copy the config file from your /boot/ directory to /usr/src/linux/.config. To do so run the command below, replacing 2.6.17 with your current kernel version.

cp /boot/config-2.6.17 /usr/src/linux/.config

Now change to the /usr/src/linux/ directory and run the command make xconfig.

cd /usr/src/linux/

make xconfig

This will bring up the configuration menu with all the defaults from your current kernel already set. A tick in a box indicates that the driver will be compiled in to the kernel and loaded at every boot (each tick slows down your kernel a fraction), a dot in a box indicates that the driver will be compiled as a module which will only be loaded when you request it to and a blank box indicates that the driver will not be available at all. If you are compiling solely to enable a piece of hardware then skip to the 'Device Drivers' section, locate the appropriate sub-directory and enable the option for your device, then skip to the next section. If however you are here to trim excess fat and gain precious speed then read on. The list below contains a list of options, with short descriptions, which can commonly be removed without harming your system. If you have a piece of hardware which isn't supported under your current kernel, it may be supported under the new kernel, just find the corresponding menu and enable it. I make no guarantees that removing one of these devices won't render your new kernel unusable on your system, but if this does happen then you can always re-enable the option and recompile.

Processor Type

In the Processor Type and Features section under 'Processor Family' select the option that matches your CPU.

Bus Options

Disable ISA and MCA unless you have a very old PC (more than six years old) that you know has ISA or MCA slots.

Disable PCCard(PCMCIA/Cardbus) support unless you are using a laptop.

Disable PCI Hotplug Support as it is not available on common hardware.

Device Drivers

Disable all SCSI low-level drivers unless you have special SCSI hardware (mostly used for servers and Mac hardware.

Disable all Fusion MPT device support unless you know you have this SCSI card.

Disable ISDN support unless you are in a part of the world that still uses ISDN for Internet.

Disable Linux telephony support unless you have a special card to connect a regular phone to your PC for VOIP applications.

Enable Advanced Linux Sound Architecture if it is not already enabled. If you know what kind of Sound-card you have you can also disable any other drivers under the 'Generic Devices', 'PCI Devices' and 'USB Devices' sub-menus.

Disable Open Sound System

Disable Infiniband Support unless you know you have special infiniband hardware.

File Systems

Under 'Miscellaneous Filesystems', enable Compressed Rom File Support(cramfs) and disable all others unless you have a specific need to access a special file-system type.

Under 'Partition Types' disable all except PC BIOS (enable all sub-menus) and Windows Logical Disk Manager Support

Now that you have finished selecting your options click on the 'Save' icon (the floppy disk) and exit the utility.

Compiling Your Kernel and Modules

Once the configuration is saved, the next step is to compile the kernel. To compile the kernel itself run 'make' from within the /usr/src/linux/ directory. This will take a long time, on old systems it will take a very long time and your system will be unusable for other tasks while it compiles.

cd /usr/src/linux/

make

Next we build and install the modules.

make modules_install

Installing Your Kernel

Now that we have a fully customized and compiled kernel, we need to tell the system where it is and what to do with it. First we will install it in the appropriate place and create the necessary links to it. Then we will generate a ramdisk which the system will use at boot time to load the kernel. Then we will update your boot-loader to recognize the new kernel. If all goes according to plan we will then be able to boot the new kernel. As usual replace 2.6.20-1 with the actual version of your new kernel.

Install the kernel in /boot/ and create links.

cd /usr/src/linux/

make install

Generate a Ramdisk

cd /boot/

mkinitramfs -o initrd.img-2.6.20-1 2.6.20-1

Update Grub or Lilo (depending on which you have, usually Grub).

Grub:

update-grub

Lilo:

lilo

Conclusion

Hopefully you still have all your hair and you now have a brand spanking shiny new racey kernel. Reboot your PC and select your new kernel from the boot menu. If for some reason it doesn't boot, your old kernel will still be available and you can try again. For those of you with an adventurous streak, now is the time to go back in to xconfig and try and refine your selections even further.



Saved From http://www.linuxforums.org/desktop/the_newbies_guide_to_compiling_your_first_kernel.html

Bill Gates sees Nintendo as toughest competion

In a recent interview with TV Tokyo, Bill Gates said that, in the video game industry, Microsoft’s biggest competition is not Sony but Nintendo.

"The strength of Nintendo on the portable space has been very impressive and surprised a lot of people; and the strength of the Wii; and we see Nintendo as the toughest competition," said Gates. Gates’ statements are not a surprise considering the tremendous sales both the Nintendo DS and Nintendo Wii have enjoyed since they went on sale.

Straight from the man at the top of the highest techno-tower in the world. Anyone who says Bill Gates is not "far-seeing" is kidding themselves. Looks like Microsoft has an idea of how this "Console War" will play out.

Can Sony make a showing?
Stay Tuned for more details.

Bill Gates sees Nintendo as toughest competion - Post From wiipals.net

Saturday, March 24, 2007

PS3 or beer? Microsoft poses the ultimate question





While we might've put down a few of Microsoft's last night Europe exploits as a tad immature, we aren't going to deny the genius here: Microsoft's message to gamers is that the PS3 = the Xbox 360 + £146 in beer money. Of course, such a mental exercise is nothing without a bit of illustration, so Microsoft carted in just that much beer to the offices of the UK's CVG magazine (above) and Auckland, NZ's GamePlanet store (pictured after the break). Naturally, Sony will have the last laugh when its utterly sober fanboys use keen rhetoric to destroy their tipsy MS fanboy opponents in the comments section following this post.

[Via Joystiq]

Thursday, March 22, 2007

Configuring Dynamic DNS & DHCP on Debian Stable

For the average home computer user there is no need to install a complex package such as the Internet Software Consortium's BIND DNS or DHCP server, since there are far simpler lower resource tools to use, for example dnsmasq. For those who you wish to learn how to use ISC's BIND and DHCP, for example as a learning exercise, this is how I got it all to work in Debian Sarge, the current stable version of Debian GNU/Linux.

This short article was prompted by my question on the Debian-Administration forum site, where I was able to get some answers to the issues I faced and I did promise to post a solution if I got one.

Installation of Packages

The version of ISC BIND DNS and DHCP servers installed by default in Debian stable are the older versions, which will not actually work together. If you have either server installed you need to remove it and upgrade to the newer version of each package. The newer versions are available in the Debian stable archive so you do not need a back-port from testing.

[user@box ~]$ sudo aptitude remove bind dhcp [user@box ~]$ sudo aptitude install bind9 dhcp3-server 

Let aptitude or apt-get figure out and resolve any dependencies. You will get a set of basic configuration files and start scripts all created for you in the usual Debian way.

To set-up DNS you need to set your domain rules as per normal BIND9 format. BIND9 does have a reputation for being complex but you can find help in the man pages which are complete, if very long, and there are good books to help you get through (see below). Setting up the DHCP server is by comparison much simpler; set that up as you need.

The hard bit is getting the two to talk to each other, as this is less well documented and the documentation that does exist does contradict itself. It was my difficulties with getting the DHCP server to automatically update the DNS server that lead me ask a question on the D-A.org web site. Though I got no perfect answer, I was able to piece together enough to generate this working solution.

Configuring BIND9

/etc/bind/named.conf

You need to tell BIND that it is okay to allow other applications to update it. I added the following to my BIND9 configuration, everything else was left as stock Debian. My DHCP server and DNS server are on the box, so here I am only allowing localhost to perform the update. The file rndc-key is a file containing a shared secret, so that BIND9 knows that it is an approved application sending instructions.

controls { inet 127.0.0.1 allow {localhost; } keys { "rndc-key"; }; }; 

/etc/bind/named.conf.local

Here is my local zone details, suitably modified. Here I let BIND know which domains it can update; in my case I only have one domain to deal with. I am also loading in the shared secret key in at this stage. You can see I am using a private IP address range.

// Add local zone definitions here. zone "network.athome" { type master; file "/etc/bind/db.network"; allow-update { key "rndc-key"; }; notify yes; };  zone "0.168.192.in-addr.arpa" { type master; file "/etc/bind/db.192.168.0"; allow-update { key "rndc-key"; }; notify yes; };  include "/etc/bind/rndc.key"; 

/etc/bind/rndc.key

The secret key is created with a tool. If your DHCP and DNS servers are on separate machines you need to copy the file between them or arrange for one machine to remotely access the file system of the other.

key "rndc-key" { algorithm       hmac-md5; secret          "lgkbhjhtthgtlghtl6567=="; }; 

db files

Set up your zone databases as normal. You do not need to do anything fancy.

Configuring DHCP3 Server

By default the ISC DHCP3 server shipped in Debian Sarge does not do dynamic DNS update. You simply need to enable it. Below are the options I selected for my system.

/etc/dhcp3/dhcpd.conf

You have to turn on the updating with the ddns-update-style interim command. I have client-updates ignore as Windows machines try to set their FQDN, not just their hostname, which causes problems. I have included the key so the two server daemons can trust each other.

# Basic stuff to name the server and switch on updating server-identifier           server; ddns-updates                on; ddns-update-style           interim; ddns-domainname             "network.athome."; ddns-rev-domainname         "in-addr.arpa."; ignore                      client-updates;  # This is the key so that DHCP can authenticate it's self to BIND9 include                     "/etc/bind/rndc.key";  # This is the communication zone zone network.athome. { primary 127.0.0.1; key rndc-key; }  # Normal DHCP stuff option domain-name              "network.athome."; option domain-name-servers      192.168.0.60, 192.168.0.1; option ntp-servers              192.168.0.60; option ip-forwarding            off;  default-lease-time              600; max-lease-time                  7200; authoritative;  log-facility local7;  subnet 192.168.0.0 netmask 255.255.255.0 { range                       192.168.0.100 192.168.0.200; option broadcast-address    192.168.0.255; option routers              192.168.0.1; allow                       unknown-clients;  zone    0.168.192.in-addr.arpa. { primary 192.168.0.60; key             "rndc-key"; }  zone    localdomain. { primary 192.168.0.60; key             "rndc-key"; } } 



Original Post: http://www.debian-administration.org/articles/343

Thursday, March 15, 2007

Overrolling effect with the help of CSS

Overrolling effect with the help of styles

Vlad Merzhevich

Overrolling effect means change of one image to another while the mouse cursor is aimed at it. So, as soon as a cursor appears on image, it changes to another one, and when a mouse is led away aside, an image becomes former. Usually JavaScript is used for creation of an overrolling effect, but in many cases CSS is enough.

Pseudo-class hover

First lets come to understanding of how this effect is actually done. For this purpose the pseudo-class hover is used, it’s added through a colon to the desired selector. This pseudo-class determines the style of element, when mouse cursor is over it, that is exactly what we aquire. Alas, but browser of Internet Explorer versions 6 and below in this case are able to work only with references, while other browsers (in particular, Firefox and Opera) understand hover also for other elements. So for universality of the code it will be necessary to place an image into a container <A>. An image is added and changed by the stylish parameter background. The algorithm of actions is the following.

  1. Two images of identical size are prepared, one for an initial kind, and the other — for his replacement at the overrolling effect.
  2. An initial image is added as a background image to the selector of A through the stylish attribute of background with the value of url('URI'), where URI is a way to the graphic file.
  3. We attach a pseudo-class to the selector of A (a:hover) and once again include the parameter of background, but as a value specify a substitutional image.
  4. In order to make the link sizeable to image, it is necessary to convert it into a sectional element by the attribute display with the value of block, and also to set a height and width of the link.

On the img. 1 two images are shown: initial (img, 1a) and substitutional (img. 1b).

Image 1a Image 2b

Img. 1. Pictures for creation of the overrolling effect

It remains to collect the whole code together, as shown in an example 1. In order not to allow the link to lead to some certain file, which is needless in this case, we’ll add a «stub» as character of grate (#) to the parameter of href tag <A> .

Example 1. Use of pseudo-class of hover

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1251">
<title>Overrolling effect</title>
<style type="text/css">
A.rollover {
 background: url('1.gif'); /* Way to the file with an initial image */
 display: block; /* Image as sectional element */
 width: 196px; /* Image width */
 height: 183px; /* Image height */
 border: 1px solid #000; /* Image border */
}

A.rollover:hover {
 background: url('2.gif'); /* Way to the file with a commutable image */
}
</style>
</head>
<body>
<a href="#" class="rollover"> </a>
</body>
</html>

The result of the example is shown below.

The resulted method though is simple to implement, but has the certain failing. As the second image is loaded only at aiming of cursor on the link, reflection of an image takes place with some pause. For the removal of this delay we may use not two images, but only one.

Overrolling effect with one image

It seems controvercy takes place, in fact the overrolling effect is concluded in replacement of one image by another, then how can we use one image? Actually there will be two images (img. 2) kept in one graphic file.

Image 2

Img.2. Picture with two images

Changing one image to another is carried out by the shift of image on a vertical line due to the use of universal attribute of background or properties of background-position, as shown in an example 2.

Example 2. Change of the image position.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1251">
<title>Overrolling effect</title>
<style type="text/css">
A.rollover {
 background: url('3.jpg'); /* Way to the file with an initial image */
 display: block; /* Image as sectional element */
 width: 151px; /* Image width in pixels */
 height: 40px; /* Image height */
}

A.rollover:hover {
 background-position:
  0px /* Horisontal shift */
  -40px; /* Vertical line shift */
}
</style>
</head>
<body>
<a href="link.html" class="rollover"></a>
</body>
</html>

The result of the example is shown below.

For the selector A background image is set through the parameter of background, width coincides with an image, and a height (attribute of height) is equal to the half of height of image. Originally a green inset must be viewed at large.

At aiming on the link background is displaced upwards on 40 pixels with the help of background-position property and an orange inset becomes visible.

Summary

Overrolling effect is rarely used independently, from the viewpoint that users actually do not need an image which simply changes on the other one. Therefore this effect is used for accenting of attention on the links, menu creations, underlining of insets, etc. Operating area is limited only by our fantasy and its practicability.

Rasmus Lerdorf, the inventor of PHP, recently headlined the PHPCon East 2003 show at the Park Central Hotel in New York City. Along with a keynote address, Lerdorf ran a session called “tips & tricks.” The following tip is taken from that session. To get additional tips from that session, please visit http://lerdorf.com/nytips.pdf.

5 tips for optimizing PHP

1) Don't use a regex if you don't have to, instead, use PHP’s string manipulation functions. For example:

BAD:
GOOD:
BAD:
GOOD:

2) No references. Usually it is not faster to use references because of PHP's copy-on-write nature.

3) Use Persistent Database connections. Some databases are slower than others at establishing new connections, and the slower the database, the more of an impact using persistent connections will have. Keep in mind, however, that persistent connections will use resources even when not in use.

4) Take a look at MySQL unbuffered query. If you’re using MySQL, check out mysql_unbuffered_query(). You use it exactly like you would mysql_query(), the difference is that instead of waiting for the entire query to finish and storing the result in the client API, an unbuffered query makes results available as soon as possible and they are not allocated in the client API. You get access to your data quicker and use a lot less memory. But you can't use mysql_num_rows() on the result resource and it is likely to be slightly slower for small selects.

5) Keep it simple. Don't over-architect things. If your solution seems complex to you, there is probably a simpler and more obvious approach.

Copyright © 2005 Ziff Davis Media Inc. All Rights Reserved. Originally appearing in Publish.