Tuesday

JS in Drupal, Perl Conditionals, RubyGame

About


From Scott Orgera, your About Programming Editor
This week's newsletter shows you how to center just about anything through the magic of CSS, explains why your PHP calculations may seem a bit off the mark, welcomes you to the world of game development using Ruby, compares shallow copy and deep copy in Visual Basic, explores Perl conditionals, and much more...

How to Center Images, Text and Blocks Using CSS

Cascading Style Sheets (CSS) is a great way to center images, blocks of text, and even your entire layout. Most of these properties have been in CSS since version 1, and they work great with CSS3. Centering is an alignment that can be very useful for web designers. And CSS is the best way to center everything.

Centering with CSS is a challenge for many beginning web designers. That is because there are so many different ways to center things and not all techniques work on every element. But it’s a good idea to learn how to center things with CSS because using the HTML CENTER element is deprecated and may not be supported in the future.

Search Related Topics:   Parent Element  Div Class  CSS Images

PHP: Why Are My Calculations Off?

This is a common issue that many developers have experienced at one time or another. You are performing some simple math with a program that you wrote. Suddenly the answer, that you know should be 4, is coming back as 3.999999999999. What gives?  This is a computer, right, so shouldn't it be better at math than you are in your head?  So you go back and you check your code. Nope, it’s right, you know it's right. So why are you getting such a strange response?  It’s really close, but not quite right.

Here is the root of the problem. In your head and in your everyday life, you work in a base 10 system. Your computer, on the other hand, works in a base 2 system. Sometimes there is difficulty going back and forth between the two different systems. The difference in this conversion can lead to some wonky results.

Search Related Topics:   binary  decimal  base conversion

Game Programming in Ruby

Games are simulations of real or fictional events, the sole aim of which is for the user to have fun. Being simulations, they're excellent programming exercises that allow you to create complex software systems without having any real world task to solve. Games also provide (almost) instant gratification. You can see, interact with, play and share your results. And finally, games appeal to our creative sides, something often lacking in programming tasks.

One of the more fun projects a programmer can take on is game programming. Whether you do it for work or you do it for your own amusement, game programming is an exciting and rewarding activity, especially when using Rubygame.

Search Related Topics:   Game programming  Example code 

Third-Party JavaScript in Drupal? Check for a Module First!
The art of Drupal site building requires many new mental habits. One such habit is: Never paste in third-party JavaScript without checking for a Drupal module first. Yes, checking for a Drupal module is an extra step. It might seem a lot simpler to just paste in the script. But using a module instead of pasting in a code snippet can pay you back handsomely for your trouble.
Search Related Topics:   drupal modules  building drupal 


Related Searches
Featured Articles
Replacing Special Characters in PHP
Create a Secret Decoder Ring Using PHP
JavaScript Calendar Generator
VB: Shallow Copy versus Deep Copy
How to Make Decisions in Perl
Perl: Simple Matching With Regular Expressions

 

More from About.com

Sign up for Shareables!
An every-morning rundown of the day in history, with headlines and trends produced by your pals at About.com. Click here to sign up! It's free (of course) and we think you'll like it!



Want More From About.com?
Check out our social channels tailored to every interest!
Sign up for more free newsletters on your favorite topics
You are receiving this newsletter because you subscribed to the About.com Healthy Eating newsletter. If you wish to unsubscribe, please click here.

If you would like to unsubscribe from all newsletters sent from About.com, please send an email to optout@about.com with "Unsubscribe" as the subject line.

Contact Information:
1500 Broadway, 6th Floor
New York, NY, 10036

© 2014 About.com