Using Sajax and PHP

Tags

  • Server-side Ajax framework that lets you create the JavaScript needed in an Ajax application on the server.
  • Download Sajax: http://www.modernmethod.com/sajax/download.phtml
  • Create JavaScript functions in your Web pages.
  • Sajax can connect those JavaScript functions to the server-side programs that you had coded.
  • The JavaScript that Sajax creates for you takes the data entered in the Web page and sends it to your server-side code to be processed.
  • Creates that Web page on the server and creates all the JavaScript needed to connect your client-side code to code on the server.
  • Handles the connection between the Web page and the code on the server by itself, sending the data to the server-side code and reading the result that code passes back to the browser.

<?php
require("Sajax.php");
 function adder($operand1, $operand2)
 {
 return $operand1+$operand2;
 }
 sajax_init();
 sajax_export("adder");
 sajax_handle_client_request();
 ?>

<html>
 <head>
 <title>Example of Sajax</title>

 <script>
<?
sajax_show_javascript();
 ?>
 function show_results(result)
 {
 document.getElementById("result").value=result;
 }
function do_adder()
{
 var operand1, operand2;
 operand1=document.getElementById("operand1").value;
 operand2=document.getElementById("operand2").value;
 x_adder(operand1, operand2, show_results);
}
</script>

 </head>
 <body>
 <center>
 <h1>Using the Sajax server-side framework</h1>
 <input type="text" name="operand1" id="operand1" value="4" size="3">
 +
 <input type="text" name="operand2" id="operand2" value="5" size="3">
 =
 <input type="text" name="result" id="result" value="" size="3">

 <input type="button" name="check" value="Add" onclick="do_adder(); return false;">
 </center>
 </body>
</html>

Life of Pi – Yann Martel

Tags

This novel is about a zookeeper’s son called Pi Patel or to be exact, Piscine Molitor Patel, which shares a lifeboat with a hyena, a broken leg zebra, a female orang-utan called Orange Juice and a 450-pound Royal Bengal tiger called Richard Parker, after the sinking of a cargo ship. The story was started with how Pi got his name and his childhood life in zoo. Then, the story slowly carries on with the reason why he needs to leave India and that is how the main plot of the story started from there where the cargo ship sinks and how he shares his life with other animal survivors.

I read a book review about this book wrote by one of the readers and she told us that her favourite part will be the last few pages of the book. I think I’m quite agree with her. I like how the author relates another different version of story which involves of a Taiwanese sailor, a cook, Pi’s mother and himself with the original version of story which involves of him and a bunch of animal survivors. I just can’t control myself to laugh at it when every time I read this part:

“So the Taiwanese sailor is the zebra, his mother is the orang-utan, the cook is…the hyena – which means he’s the tiger!”

Well, I couldn’t give too many opinions whether this is a good book for recommendation because I never like to read books about stories happening on the sea. One of the famous sea stories which I read when I was a kid is ‘Moby Dick’ and I don’t like it or maybe I avoided reading that book without my knowledge too. So, I thought Life of Pi may probably change my mind about it. However, I like to read stories about how people try their own different ways to strive to survive in their life which we may probably can learn from it. So, I would say that I quite like this book although it might not be a book that I will put it into my recommendation list.

Ratings: 6.5/10

Life of Pi – Chapter 61 – 100

Tags

Chapter 61 – Chapter 80

Experience taught me that it was better to strike when I felt I had a good chance of success than to strike wildly, for a fish learns from experience too, and rarely falls for the same trap twice.

Only death consistently excites your emotions, whether contemplating it when life is safe and stale, or fleeing it when life is threatened and precious.

Life on lifeboat isn’t much of a life. It is like an end game in chess, a game with few pieces. The elements couldn’t be more simple, nor the stakes higher. Physically it is extraordinarily arduous, and morally it is killing. You must make adjustments if you want to survive. Much becomes expendable. You get your happiness where you can. You reach a point where you’re at the bottom of hell, yet you have your arms crossed and a smile on your face, and you feel you’re the luckiest person on earth. Why? Because at your feet you have a tiny dead fish.

You can get used to anything – haven’t I already said that? Isn’t that what all survivors say?


Chapter 81 – 100

I have read that there are two fears that cannot be trained out of us: the startle reaction upon hearing an unexpected noise, and vertigo. I would like to add a third, to wit, the rapid and direct approach of a known killer.

It’s important in life to conclude things properly. Only then can you let go. Otherwise you are left with words you should have said but never did, and your heart is heavy with remorse.

“Don’t you bully me with your politeness! Love is hard to believe, ask any lover. Life is hard to believe, ask any scientist. God is hard to believe, ask any believer. What is your problem with hard to believe?”

Follow

Get every new post delivered to your Inbox.