Ini adalah script php untuk menghitung biaya kos, dengan berbagai fasilitas kos yang ada. Ketik script php di bawah ini, simpan di xampp\htdocs, lalu jalankan di browser.
<HTML>
<HEAD>
<TITLE>Form Input Data</TITLE>
</HEAD>
<BODY>
<form method="post" action="" target="_self">
<table border="1">
<tr>
<td colspan="2" align="center"><b>PERHITUNGAN HARGA KOST</b></td>
</tr>
<td width="116">Tipe Kamar</td>
<td width="174"><select name="tipe">
<option value="A">A. [2x3 m]</option>
<option value="B">B. [3x3 m]</option>
<option value="C">C. [4x3 m]</option>
</select>
</td>
<tr>
<td>Air</td>
<td><input name="rb_air" type="radio" value="PDAM">Air PDAM<br>
<input name="rb_air" type="radio" value="Tanah">Air Tanah</td>
</tr>
<tr>
<td>Fasilitas</td>
<td><input name="cb_telepon" type="checkbox" value="Y">Telepon<br>
<input name="cb_televisi" type="checkbox" value="Y">Televisi<br>
<input name="cb_komputer" type="checkbox" value="Y">Komputer<br>
<input name="cb_rice" type="checkbox" value="Y">Rice Cooker</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="Hitung">
<input type="reset" name="submit2" value="Reset"></td>
</tr>
</table>
</form>
<?php
$tipe=$_POST['tipe'];
$rb_air=$_POST['rb_air'];
$cb_televisi=$_POST['cb_televisi'];
$cb_komputer=$_POST['cb_komputer'];
$cb_telepon=$_POST['cb_telepon'];
$cb_rice=$_POST['cb_rice'];
$submit=$_POST['submit'];
?>
<?
if($submit)//Jika tombol submit di klik
{
?>
<hr>
<table border="1">
<tr><td colspan="2"align="center">HASIL PERHITUNGAN</td></tr>
<tr bgcolor="silver"><td colspan="2" align="center">Kamar</td></tr>
<tr><td>
<?
if($tipe=="A")
{
$luas="2 x 3 m";
$harga=200000;
}
else
if($tipe=="B")
{
$luas="3 x 3 m";
$harga=250000;
}
else
if($tipe=="C")
{
$luas="4 x 3 m";
$harga=300000;
}
echo $luas;//menuliskan luas
?></td><td align=right>Rp.
<? echo number_format($harga,0,",",".");?></td></tr>
<tr bgcolor="silver"><td align="center" colspan="2">Jenis Air</td></tr>
<tr><td>Air <? echo $rb_air;?></td><td align="right">Rp.
<?
if($rb_air=="PDAM")
$air=20000;
else
if($rb_air=="Tanah")
$air=15000;
echo number_format($air,0,",",".");//menuliskan air
?></td></tr>
<?
if(($cb_telepon=="Y")or($cb_televisi=="Y")or($cb_komputer=="Y")or($cb_rice=="Y"))
echo "<tr bgcolor=silver>
<td align=center colspan=2>Fasilitas-Fasilitas</td></tr>";
if($cb_telepon=="Y")
{
$telepon=20000;
echo "<tr><td>Telepon</td><td align=right>Rp. ".
number_format($telepon,0,",",".")."</td></tr>";
}
if($cb_televisi=="Y")
{
$televisi=30000;
echo "<tr><td>Televisi</td><td align=right>Rp. ".
number_format($televisi,0,",",".")."</td></tr>";
}
if($cb_komputer=="Y")
{
$komputer=60000;
echo "<tr><td>Komputer</td><td align=right>Rp. ".
number_format($komputer,0,",",".")."</td></tr>";
}
if($cb_rice=="Y")
{
$rice=5000;
echo "<tr><td>Rice Cooker</td><td align=right>Rp. ".
number_format($rice,0,",",".")."</td></tr>";
}
$total=$harga+$air+$telepon+$televisi+$komputer+$rice;
echo "<tr bgcolor=silver><td>TOTAL</td><td align=right><b>Rp. ".
number_format($total,0,",",".")."</b></td></tr>";
?>
</table>
<?
}
?>
</BODY>
</HTML>
Tampilkan postingan dengan label Ilmu Komputer. Tampilkan semua postingan
Tampilkan postingan dengan label Ilmu Komputer. Tampilkan semua postingan
Minggu, 27 November 2011
Rabu, 16 November 2011
By John D. Sutter, CNN
When Microsoft Kinect - the Xbox gaming camera that reads your body
motions - came onto the scene about a year ago, there were plenty of
signs that body gestures were going to start controlling
technological gizmos of all sorts.After all, the Wii, which debuted in 2006, popularized the idea that technology should be able to sense what your body is doing - without pushing a button. And, if nothing else, the movie "Minority Report" (and the real-world researcher, John Underkoffler, who made that possible) showed us that we'd soon be able to control computers and TVs with the wave of a hand.
In the year since Kinect, sci-fi versions of this no-remote reality have started to become real. Technologists are attaching motion-sensing cameras to all kinds of things - using them to control consumer electronics and contribute to scientific research. And they're tapping into old-school cameras, too, turning simple gadgets like smartphones into body reading machines.
More on this trend from ReadWriteWeb's Marshall Kirkpatrick:
Multitouch, voice search, gestures. Those are now some of the most potent points of intersection between human will and computational power. Could this new stage of interface change the world as much as the transition from the Command Line to the GUI did? It may very well.MIT Technology Review says gesture interfaces, in the wake of Wii and Kinect, are going mainstream:
The first demonstrations of what gestural interfaces could offer beyond gaming came from enterprising hackers who did things like using a Wii controller to steer a Roomba robotic vacuum, and academic researchers like those those in Microsoft's labs who adapted the Kinect to do things such as creating a 3-D model of a user's whole body. Analyst firm Markets & Markets estimates that the market for the hardware and software components needed to enable gesture recognition in products such as the Kinect was worth $200 million in 2010 and will be worth $625 million by 2015.Take a look at this promo video from Microsoft, which shows all kinds of potential uses for the technology - from playing a virtual violin to teaching a class about DNA. It's promotional, obviously, but still pretty fascinating:
Plenty of stuff kind of like that is already happening in the real world. Take this example of music mixing - enhanced by a motion-sensor:
Games are being rebuilt around this idea, too. Here's a Kinect hack of Tetris, where a gentleman controls the pieces by waving his hands and moving his head. Maybe this isn't the most elegant way to play the classic Nintendo game, but it's one of many examples of how hackers are taking Kinect's motion-capture tech and doing whatever they like with it:
Another Kinect hack uses Microsoft's motion-sensing camera to help a Roomba robotic vacuum cleaner "see" the space it's cleaning:
Finally, plenty of spin-off companies are capitalizing on the idea of gesture-controlled technology.
Here's a company that is trying to make this idea work on tablets and phones:
And, from LG, one that's taking the idea of a gesture-commanded home entertainment center to a slightly different place - with a remote control you can use to wave your way from one screen to the next:
Post by: John
D. Sutter -- CNN Filed under: Innovation • Tech |
MIT project tries to turn trash into a game
By John D. Sutter, CNN
Here's the problem with recycling: It's boring.But maybe it doesn't have to be. A Boston company called Greenbean Recycle is trying to make the act of keeping bottles and cans out of the landfill into a fun, competitive and engaging game for students at MIT.
The new company, which won an innovation prize this week from Worcester Polytechnic Institute, has converted a beefy recycling machine on MIT's campus into a point tabulator of sorts. When students approach the high-tech trash can to dump in their recyclables, they punch their phone number on a touch screen. A bar-code reader in the machine counts the number of cans, bottles and the like that the person has dropped off - and then uploads that data to Greenbean's website.
Recyclers can track their progress online, and even engage in competitions with fellow students.
"We want to be like the Zynga of recycling," said CEO Shanker Sahai, 38, referring the maker of such social games as "FarmVille."
Competitions between fraternities at MIT have been particularly fruitful, he said, with the houses trying to compete against each other to get the top spot on an online recycling leaderboard.
There are some real-world rewards, too.
Greenbean has offered free gift cards for people who recycle more cans and bottles than anyone else on campus during a given time period. He envisions giving away Red Sox tickets and other goodies, provided by sponsors, to entice people to recycle more.
He's not the only one trying to turn trash and recycling into a game.
Volkswagen in 2009 created a Bottle Bank Arcade that made cool, game-ified noises when people dropped bottles into recycling containers. Check out this brilliant little video about the project, which was part of the company's Fun Theory promotion:
watch me |
There's also a network called the Recycle Bank that gives people points and rewards for doing eco-things.
Greenbean's "reverse vending machine," which is manufactured by a company called Tomra, gives recyclers rewards for cans and bottles that offer return discounts - usually about 5 cents in Massachusetts. Those rewards are automatically deposited in a recycler's PayPal account, on his or her MIT spending card or donated to a charity the person has selected online, Sahai said.
The project started this summer and, as of Wednesday afternoon, had recycled nearly 14,000 containers, saving an estimated 2,500 kilowatt hours of electricity, according to the website. The company plans to expand to Tufts and other Boston-area universities later this year and in the spring. Eventually, Sahai wants to take the idea of game-recycling to condos.
Giving people instant data about the positive impact their recycling makes is key, he said.
"We live in this era of instant gratification - and no one has done that for recycling," he said. "But Greenbean will."
|
Post by: John
D. Sutter -- CNN Filed under: Innovation • Tech • Thinkers |
The Next List: Marco Tempest, the 'cyber-illusionist'
Each week “The Next List,” with host Dr. Sanjay
Gupta, profiles innovators from all walks of life and all fields of
endeavor. This new CNN TV series will explore what makes each of these
individuals a non-conformist agent of change.
Our goal is to explore why these innovators are successful - and to
take a fun peek into their creative worlds.These subjects are driving change that will impact our lives - in technology, education, entertainment, the arts and natural sciences. We will explore how their passion, personal history and unique thinking enabled their successes today.
Our first Next Lister is Marco Tempest, a magician who's so unique he wouldn't even use that word to describe himself. Instead, he refers to himself as a "cyber-illusionist." Tempest combines videos, computer graphics and other modern technologies with the ideas of old-world magic.
Tempest began performing at a very young age. By the time he was 22, he had captured the prestigious New York World Cup of Magic, launching him into international prominence. Always working to stay just a bit ahead of the curve, he has a particularly winning way of taking his audiences with him on his magical excursions into the land of tomorrow.
Take a look at our first show, which aired on Sunday. To watch the full program, start with the video at the top of this post and then continue with the videos below. Thanks – and let us know what you think in the comments section! http://whatsnext.blogs.cnn.com/2011/11/15/the-next-list-marco-tempest-part-1/
DEBATE PREP: America the cyber sucker?
Editor’s note: This analysis
is part of Security Clearance blog’s “Debate
Preps” series. On November 22, CNN, along with AEI and The Heritage Foundation,
will host a Republican candidate debate focused on national security
topics. In the run-up to the debate, Security Clearance asked both the
sponsoring conservative think tanks to look at the key foreign policy
issues and tell us what they want to hear candidates address.
By The Heritage Foundation's James Jay Carafano, Special to CNNThe scene from "Casablanca" says it all.
"I'm shocked-shocked to find that gambling is going on in here," Police Inspector Renault declares. Immediately, the croupier hands the chief inspector his roulette table winnings.
Renault's disingenuousness disclaimer could be the tag line for U.S. cyber security policy. Just last month, the Director of National Intelligence delivered a report to Congress – "Foreign Spies Stealing U.S. Economic Secrets in Cyberspace." Its "shocking" conclusion: China and Russia are stealing us blind.
Quelle surprise! Chinese beachheads in U.S. cyberspace have turned up time and again for years. Not long ago Chinese hackers so thoroughly penetrated the computer network at the U.S. National Defense University in Washington, D.C., the entire system had to be shut down and cleaned out.
As for the Russians, they've long been recognized as a real "bear" online. The infamous Russian Business Network (RBN) brazenly ran all manner of illicit online operations- and there was never much doubt that they were working in collusion with Kremlin officials.
It was a mutually beneficial partnership. RBN maintained a public homepage that accepted complaints about malicious activities. The grievances were referred to the RBN "abuse team" for "investigation." The team would then dutifully request a Russian judicial indictment against the offender. Conveniently, however, it proved almost impossible to obtain the indictment.
The Russian government is widely believed to be the prime mover behind the massive 2007 denial-of-service attack against Estonia. But Moscow left no fingerprints. The Kremlin is thought to have outsourced that particular piece of cyber dirty work to a derivative of RBN.
It is hard to believe the U.S. government wasn't aware of this. Shortly after FBI Director Mueller visited to his counterparts in Moscow-RBN "disappeared." Coincidence? Or did Mueller read the Russians the riot act. Regardless, as this latest report from the U.S. intelligence community shows, both Russia's criminal networks and its intelligence service are up to no good online.
Nor is there much surprise that online evildoers are homing in on "economic" targets. It is estimated that half of the world's intellectual property is in the United States.
Another Inspector Renault moment came right after the report was released. Issuing an unbelievable, bold-faced response, China's foreign policy spokesperson dismissed the U.S. allegations as "unprofessional and irresponsible." This is rich.
In fact, the U.S. intelligence community report pulled its punches, acknowledging it could not pin all of this activity directly on the government. That is because Beijing is not stupid. It has created-and mastered-the art of "patriotic hacking," enlisting citizens to steal secrets for them and then rewarding them for their "patriotism."
Cybersecurity is a weighty issue, one that should be addressed in the upcoming GOP presidential candidates debate dedicated to foreign policy and national security.
Certainly it's a security challenge that requires presidential leadership. Currently, at least 18 major cyber bills are pending in Congress. Lawmakers are less of one mind on cyber than they are on how to balance the budget. America needs savvy cyber-strategic leaders. And there's no better place for it to start than at the top.http://security.blogs.cnn.com/2011/11/16/debate-prep-america-the-cyber-sucker/
Selasa, 08 November 2011
Web Server dengan modul PHP
Langsung aja nih, nggak usah Muter-muter, semoga bermanfaat bagi teman-teman pemula untuk membuat server web dengan modul php berkelas, ini pengalaman saya waktu nginstall di Linux Redhat9 dan Fedora, semua source di asumsikan ada di /usr/local/src, tapi kalo kita gak punya source nya, nggak usah kuwatir deh kerenakita bisa dapetin source di alamat website dibawah ini :
*http://www.apache.org/dist/httpd/httpd-2.0.49.tar.gz
*http://www.php.net/get/php-4.3.5.tar.gz/from/a/mirror
*http://www.gnu.org/software/libiconv/
Setelah semuanya didapet ikuti langkah praktis berikut
Langkah Ke 1 : compile httpd
cd /usr/local/src
tar -zxvf httpd-2.0.49.tar.gz
cd httpd-2.0.49
./configure
–prefix=/usr/local/apache2
–enable-so
–enable-auth-digest
make
make install
Langkah Ke 2 : iconv
tar -zxvf libiconv-1.9.1.tar.gz
cd ../libiconv-1.9.1
./configure –prefix=/usr/local
make
make install
Langkah Ke 3 : PHP 4 (as Apache 2 server module!)
tar -zxvf php-4.3.5.tar.gz
cd ../php-4.3.5
./configure
–with-apxs2=/usr/local/apache2/bin/apxs
–with-mysql
–with-iconv=/usr/local
–enable-track-vars
–with-gettext
–with-config-file-path=/usr/local/apache2/conf
–enable-trans-id
make
make install
cp php.ini-dist /usr/local/apache2/conf/php.ini
setelah langkah-langkah diatas di jalankan sekarang saatnya kita konfigurasi /usr/local/apache2/conf/httpd.conf, agar PHP kita dapat jalan maka kita tambahkan script di file httpd.conf seperti dibawah ini :
LoadModule php4_module modules/libphp4.so
DirectoryIndex index.html index.htm index.php
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
Sekarang udah selesai install apache2 dengan dukungan PHP, Bagaimana…? kagak sulit kan install apache2 dengan dukungan PHP di linux. Untuk mengetes apakah PHP kita udah jalan apa belum kita dapat membuat file dengan nama index.php yang kemudian diletakkan di Document.root
Contoh file index.php
<html>
<head><title>PHP Test</title></head>
<body>
<? phpinfo(); ?>
</body>
</html>
Selamat mencoba..
Oleh: http://taufikmjc.wordpress.com
*http://www.apache.org/dist/httpd/httpd-2.0.49.tar.gz
*http://www.php.net/get/php-4.3.5.tar.gz/from/a/mirror
*http://www.gnu.org/software/libiconv/
Setelah semuanya didapet ikuti langkah praktis berikut
Langkah Ke 1 : compile httpd
cd /usr/local/src
tar -zxvf httpd-2.0.49.tar.gz
cd httpd-2.0.49
./configure
–prefix=/usr/local/apache2
–enable-so
–enable-auth-digest
make
make install
Langkah Ke 2 : iconv
tar -zxvf libiconv-1.9.1.tar.gz
cd ../libiconv-1.9.1
./configure –prefix=/usr/local
make
make install
Langkah Ke 3 : PHP 4 (as Apache 2 server module!)
tar -zxvf php-4.3.5.tar.gz
cd ../php-4.3.5
./configure
–with-apxs2=/usr/local/apache2/bin/apxs
–with-mysql
–with-iconv=/usr/local
–enable-track-vars
–with-gettext
–with-config-file-path=/usr/local/apache2/conf
–enable-trans-id
make
make install
cp php.ini-dist /usr/local/apache2/conf/php.ini
setelah langkah-langkah diatas di jalankan sekarang saatnya kita konfigurasi /usr/local/apache2/conf/httpd.conf, agar PHP kita dapat jalan maka kita tambahkan script di file httpd.conf seperti dibawah ini :
LoadModule php4_module modules/libphp4.so
DirectoryIndex index.html index.htm index.php
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
Sekarang udah selesai install apache2 dengan dukungan PHP, Bagaimana…? kagak sulit kan install apache2 dengan dukungan PHP di linux. Untuk mengetes apakah PHP kita udah jalan apa belum kita dapat membuat file dengan nama index.php yang kemudian diletakkan di Document.root
Contoh file index.php
<html>
<head><title>PHP Test</title></head>
<body>
<? phpinfo(); ?>
</body>
</html>
Selamat mencoba..
Oleh: http://taufikmjc.wordpress.com
Langganan:
Postingan (Atom)