Monday, June 6, 2011

How Java Works

Have you ever wondered how computer programs work? Have you ever wanted to learn how to write your own computer programs? Whether you are 14 years old and hoping to learn how to write your first game, or you are 70 years old and have been curious about computer programming for 20 years, this article is for you. In this edition of HowStuffWorks, I'm going to teach you how computer programs work by teaching you how to program in the Java programming language.
In order to teach you about computer programming, I am going to make several assumptions from the start:
  • I am going to assume that you know nothing about computer programming now. If you already know something then the first part of this article will seem elementary to you. Please feel free to skip forward until you get to something you don't know.
  • I am going to assume you do know something about the computer you are using. That is, I am going to assume you already know how to edit a file, copy and delete files, rename files, find information on your system, etc.
  • For simplicity, I am going to assume that you are using a machine running Windows 95, 98, 2000, NT or XP. It should be relatively straightforward for people running other operating systems to map the concepts over to those.
  • I am going to assume that you have a desire to learn.
All of the tools you need to start programming in Java are widely available on the Web for free. There is also a huge amount of educational material for Java available on the Web, so once you finish this article you can easily go learn more to advance your skills. You can learn Java programming here without spending any money on compilers, development environments, reading materials, etc. Once you learn Java it is easy to learn other languages, so this is a good place to start.
Having said these things, we are ready to go. Let's get started!

Saturday, June 4, 2011

Top 5 Kinect Hacks

With the release of the Kinect for Xbox 360 (the first hands-free game controller) in November 2010, Microsoft was poised to completely transform the gaming industry. The Wii's motion-sensing controller had opened the door to the future of gaming when it was released; Kinect blew that door off its hinges. Gamers everywhere were thinking about the full-immersion possibilities of gaming's next step.

The Xbox Kinect has taken the world of gaming by storm -- but hackers love it, too. See more video game system pictures.
But the real revolution stirred by the Kinect had nothing to do with gaming. Hackers immediately saw potential in the device far beyond its intended use as a gaming accessory. On Kinect's release date, Adafruit Industries, an open-source hardware development group, posted a $3,000 bounty for the first successful, open-source driver to make use of Kinect's motion-sensing technology outside of its Xbox 360 application [source: Adafruit]. The bounty was claimed by a hacker who didn't even own an Xbox and managed to create a Linux-based camera driver for the Kinect in about three hours. The contest is over, but independent developers continue to find new uses for the Kinect every day, some of which are pretty darned cool. Join the fun as we scope out five Kinect hacks that transcend the device's gaming roots.
Evil Genius Simulator
What better motivator for a hack than bringing fun to your fellow brainiacs? At Maker Faire UK 2011, a pub-hatched hack came to life rather quickly when Tom Wyatt and friends conceived of the idea to hook a Kinect up to a pair of Tesla coils [source: Frank].

In simple terms, a Tesla coil (named for its inventor, Nikola Tesla) is a transformer that produces extremely high-voltage, high-frequency electrical currents. When the electricity is discharged, sparks are emitted. You've probably seen this effect employed in movies. By using the Kinect's motion-tracking technology to correlate user movement to the frequency of the Tesla coils' current, this hack created the illusion of lightning shooting from the user's hands. Suddenly, even the most mild-mannered gent is transformed into Lord Palpatine.

Don't let all that power go to your head! The next hack in the lineup has the potential to be a real life-saver. 
Robotic Surgery Assistant
Robotic surgery suites like this one may soon add a Kinect to their arsenal of tools.
Have you ever wondered what it would be like to perform surgery? How about performing surgery without your sense of touch? Doctors do it every day with the use of robotic surgical tools. This Kinect hack adds a new level of precision to the robotics-assisted operating room.

Graduate students at the University of Washington are developing a force-feedback device for surgeons performing procedures with robotic tools. While robotics-assisted surgeries are not a new concept, there has always been a problem: Doctors using the instruments don't receive tactile feedback from their equipment. During non-robotic surgeries, doctors employ their sense of touch to guide their movements; in the minimally invasive robotic procedures, they've always had to rely on cameras.

This ingenious hack uses the Kinect to map virtual force fields around the vital organs of patients, preventing accidental incisions, adding a new layer of safety and providing surgeons with improved, real-time feedback as they work. In addition to advancing the field of robotic surgery, this enhancement also saves thousands of dollars, as other options are estimated to run around $50,000 [source: Dunn].

Does the thought of surgery make you squeamish? Fear not! The next hack is nothing but fun.
As a PS3 Controller
Owners of Sony's PlayStation 3 game console have it rough. While all their Xbox 360-owning friends get to flap their arms around unencumbered to play games using their Kinect peripherals, PS3 owners are forced to use the PlayStation Move, which consists of remote controllers with Ping-Pong ball-esque orbs mounted on the ends. What's a player to do? Take matters into his own hands by getting the controllers out of them, that's what.

Before this hack, PS3 users had to use the PlayStation Move controller for motion-control gaming.
Shantanu Goel has converted the motion data collected by the Kinect into the format normally used by a PS3 controller. While his hack is still in its infancy in terms of development, Mr. Goel has posted footage online showing his handiwork in action as he works his way through the popular, first-person shooter game "Killzone 3." "Killzone 3" was the first action game to take advantage of the PlayStation Move controllers, and this hack shows players that, with a little ingenuity, they don't need handheld controllers at all.

Feel completely in the dark when it comes to action gaming? Perhaps the next hack will help you find your way.
Navigation Aid for the Visually Impaired
The white cane used by many visually-impaired people may soon be replaced with a Kinect-based alternative.
If this hack from University of Konstanz students Michael Zöllner and Stephan Huber reaches the open market, life could get a lot simpler for the visually impaired. As part of a graduate project, this dynamic duo has developed a helmet-mounted Kinect setup that acts as eyes for visually challenged users. The Kinect is combined with a prototype, vibrotactile waist belt to digitally analyze the wearer's indoor surroundings and give audio navigation commands to guide him or her through the area [source: Zöllner and Huber]. It's very similar to the way a GPS system in your car directs you to turn left or right at the appropriate point in your journey (hopefully).

At the moment, this system also requires a slightly clunky backpack, which carries a laptop to process all of the information from the belt and the Kinect. With just a little streamlining, though, this could easily be the replacement for the white cane normally used by visually impaired people to navigate their surroundings.

Now that you've got your bearings, click forward to the next page to learn about a hack that could aid disaster rescue efforts.
3-D Mapping Rescue Robot
The final hack to round out our top five has one goal in mind: saving lives in emergency situations. This application of Kinect's capabilities, like two others in our list, was born in a graduate university program. An engineering team at the University of Warwick has coupled the Kinect with a mobile base to create a robot capable of serving as remote eyes for rescue workers.

In high-danger situations like collapsed buildings, where conditions are simply too hazardous for human crews to enter, this mobile robot uses the mapping abilities of the Kinect to hunt for signs of life. While the rescue robot is not able to move survivors, it is capable of mapping the areas it scans in 3-D to enable rescue personnel to concentrate their efforts and minimize risk to all involved. Because this application of the Kinect's motion-detection system is less expensive and more sophisticated than the laser-based alternative, it may soon be tested in real-world situations [source: Lee].

As is immediately apparent, the Kinect's possible applications are as varied as the developers working on them. Hacks that turn the device into an artist's brush, a musical instrument, an autonomous mini helicopter, a sculpting tool and an e-mail command interface have popped up since the Kinect's release, with fresh hacks coming to light every day. It's entirely possible that at some point in the future, the Kinect's association with the Xbox 360 will be eclipsed by its contributions to the robotics and art worlds.

Friday, June 3, 2011

How Laptops Work

In a way, the skyrocketing popularity of laptop computers is ironic. They're completely portable, and they use less power and make less noise than desktop models. But, they're often a little slower and have less graphics and sound processing power, although these differences can be too small for most users to notice.

Laptops are also more expensive than desktops. The price gap is closing, though -- laptop prices are falling faster than desktop prices, and laptop PCs actually outsold desktop models for the first time in May of 2005 [Source: Windows IT Pro].

How can all the equipment found in a desktop tower fit into such a small package? And how can laptops be efficient enough to run on battery power alone? In this article, you'll discover the answers to these and other questions about laptops.
Overall, lap­top and desktop computers are very similar. They have the same basic hardware, software and operating systems. The primary difference is how their components fit together.­

A desktop computer includes a motherboard, video card, hard drive and other components in a large case. The monitor, keyboard, and other peripherals connect wirelessly or with cables. Whether the case sits vertically or horizontally, it has lots of space for add-in cards, cables and air circulation.

A laptop, however, is much smaller and lighter than even the most compact PC tower. Its screen is an integrated part of the unit, as is its keyboard. Instead of a spacious case with lots of room for air circulation, a laptop uses a small, flat design in which all the pieces fit together snugly.

­Because of this fundamental design difference and because of a laptop's inherent portability, components have to:

* Fit into a compact space
* Conserve power
* Produce less heat than desktop components

Often, these differences make the components more expensive, which can contribute to higher laptop prices. In the following sections, we'll examine how laptops handle these differences.

Tuesday, May 31, 2011

What is the working principle of a DC motor?

The working principle behind any DC motor is the attraction and repulsion of magnets. The simplest motors use electromagnets on a shaft, with permanent magnets in the case of the motor that attract and repel the electromagnets. The reason for using electromagnets is so that it is possible to flip their magnetic field (their north and south poles).

So the electromagnet is attracted to one of the permanent magnets. As soon as it reaches the permanent magnet, it’s north and south poles flip so that it is repelled from that magnet and attracted to the other permanent magnet. This video shows you the parts and how they fit together:

It is possible to get even simpler, although at that point the motor changes from being useful to merely instructive, as shown here:

The key to this demonstration motor is the fact that the insulation coating on the wire ends is only removed from one side of one of the wires

How does a mirage work?

This video does a nice job of showing what mirages look like. A mirage causes a road or a desert to shimmer like water, and to reflect objects in the distance:
The mirage effect is caused by a form of lensing created by hot air. The air right near a road’s surface can be very hot in the summer – much hotter than surrounding air. This hot air is much less dense than the surrounding air, and changes in density can affect how light travels. In the same way that light bends as it moves through water or glass, it can bend as it moves through different air densities. Because of the bending, light that would normally go toward the ground gets bent upward and into your eyes, creating what appears to be a reflection.