PHP for Microsoft AJAX Library

20. February 2010

Author: Aamir Hasan

PHP updated  support for Microsoft AJAX Library. It works with the RTM bits, and fixes several of the issues reported in my earlier samples. , so that you can join in and contribute to the project.The Microsoft AJAX Library is a standalone collection of the standards-based JavaScript classes included in Microsoft ASP.NET AJAX. it simply supports exposing PHP classes as AJAX-enabled web services, just as in ASP.NET applications. In fact, the generated proxies are identical to what you get from ASP.NET


Test  Example

<?php

require_once '../../dist/MSAjaxService.php';

class TestService extends MSAjaxService
{
function SayHello($name)
{
return 'Welcome, ' . $name . '!';
}
}

$h = new HelloService();
$h->ProcessRequest();

?>
 
 Index.html
<html>
<head>
<title>Hello, World!</title>
<script type="text/javascript" src="../../MicrosoftAjaxLibrary/MicrosoftAjax.js"></script>
<script type="text/javascript" src="HelloService.php/js"></script>
</head>
<body>
Name: <input id="name" type="text" /> <input type="button" value="Say Hello" onclick="button_click(); return false;" />
<br />
Response from server: <span id="response"></span>
</body>
<script type="text/javascript">
function button_click() {
TestService.SayHello($get('name').value, function (result) { $get('response').innerHTML = result; });
}
</script>
</html>
 


 
Oh, and if you are interest in PHP, you might want to check out the FastCGI  work on IIS to make PHP rock on IIS7. 

Author: Aamir Hasan     औथोर: आमिर हसन       أثر أمير حسن .

Ajax, Javascript, PHP , , ,

Fatal error: Allowed memory size of 8388608 bytes exhausted

12. February 2010

Your PHP configuration at the server has a memory limit of 8 Mb, which is rather low.
The 12M sets the limit to 12 megabytes (12582912 bytes)


goto php.ini and find

 

memory_limit = 8M

 

replace 8M to 12M


 

memory_limit = 12M

Fatal error: Allowed memory size of 8388608 bytes exhausted
(tried to allocate 81689 bytes)


 


Author: Aamir Hasan     औथोर: आमिर हसन       أثر أمير حسن .

ALL, PHP

PHP Linq

16. December 2009

class Contact
{
  public $name;
  public $address;
  public $city;
  public $state;
 
  public function __construct($name, $address, $city, $state)
  {
    $this->name = $name;
    $this->address = $address;
    $this->city = $city;
    $this->state = $state;
  }
}

set_include_path(get_include_path() . PATH_SEPARATOR . './PHPLinq/');

include_once('PHPLinq/LinqToObjects.php');
include_once('contact.php');

// Create data source


$contacts = array(
    new Contact("Aamir Hasan", "523 Fake Address", "Cincinnati", "OH"),
    new Contact("awais", "0991 Another St.", "L.A.", "CA"),
    new Contact("amir", "7912 Bs Blvd.", "L.A.", "CA"),
    new Contact("MVP", "1092 Dugg St.", "San Francisco", "CA"),
    new Contact("amazing", "821 Easy St.", "Indianapolis", "IN"),
    new Contact("hacker", "9012 Good St.", "Cincinnati", "OH"),
    new Contact("asp.net", "2459 Loser Dr.", "East Boofoo", "IN")
  );

$result =
  from('$contact')->in($contacts)
  ->where('$contact =>
           $contact->state == "' . $_REQUEST['state'] . '"')
  ->orderBy('$contact => $contact->name')
  ->select('$contact');

<div id="main">
  <table>
    <thead>
      <tr>
        <td>Name</td>
        <td>Address</td>
        <td>City</td>
        <td>State</td>
      </tr>
    </thead>
    <tbody>
      <? for($i = 0; $i < count($result); $i++): ?>
      <tr class="datarow<?= ($i & 1)?>">
        <td><?= $result[$i]->name ?></td>
        <td><?= $result[$i]->address ?></td>
        <td><?= $result[$i]->city ?></td>
        <td><?= $result[$i]->state ?></td>
      </tr>
      <? endfor; ?>
    </tbody>
  </table>
</div>


Author: Aamir Hasan     औथोर: आमिर हसन       أثر أمير حسن .

ALL, PHP

Voice Chat coming to Facebook and Twitter

1. December 2009

Vivox is the leading provider of voice chat services for online games and virtual worlds, is now providing a new technology to Facebook and Twitter members to have voice conversations with their friends or followers on their friends list. Vivox is planning to offer free dial-in numbers which will allow to call non-members into an existing conversation.

 

http://www.facebook.com

posted by aamir Hasan


Author: Aamir Hasan     औथोर: आमिर हसन       أثر أمير حسن .

ALL, asp.net, PHP

Using Google.com Closure Compiler with PHP 5

16. November 2008

$script = file_get_contents('http://www.studentacad.com/scripts/script.js');
$ch = curl_init('http://closure-compiler.appspot.com/compile');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($script));
$output = curl_exec($ch);
curl_close($ch);


Author: Aamir Hasan     औथोर: आमिर हसन       أثر أمير حسن .

ALL, PHP



User Name: Guest

Your Ip: 38.107.191.91
Time: