Thursday 29 January 2009
Facebook StumbleUpon Twitter Google+ Pin It

Post-Commit Web Hooks for Google Code Project Hosting



Wednesday 28 January 2009
Facebook StumbleUpon Twitter Google+ Pin It

Merging Arrays Preserving the Numeric Keys

Merging arrays like this:
<?php
    $array1 = array();
    $array2 = array(1 => "data");
    $result = array_merge($array1, $array2);
?>
will result to:
Array
(
    [0] => data
)
Don't forget that numeric keys will be renumbered!

If you want to completely preserve the arrays and just want to append them to each other (not overwriting the previous keys), use the + operator:

<?php
    $array1 = array();
    $array2 = array(1 => "data");
    $result = $array1 + $array2;
?>
The numeric key will be preserved and thus the association remains.

Array
(
   [1] => data
)
Parthiv Patel
Bhaishri Info Solution
Sr. PHP Developer
Limdi Chowk, AT PO. Nar, Di. Anand
Nar, Gujarat
388150
India
pparthiv2412@gmail.com
7383343029
DOB: 12/24/1986

Tuesday 27 January 2009
Facebook StumbleUpon Twitter Google+ Pin It

Google I/O 2009, Developer Conference



I'm excited to announce Google I/O 2009, our two-day developer event that will take place May 27-28, at the Moscone Center in San Francisco. Last year, over 3,000 developers participated in I/O and they attended 90+ sessions across all of our developer products. This year, much of our content will feature Android, App Engine, Chrome, GWT, AJAX APIs and more. To give you an idea, here are a few of the sessions:

  • App Engine, Offline processing on App Engine: a look ahead
  • Android, Supporting multiple devices with one binary
  • Chrome, Developing extensions for Google Chrome
  • GWT, The Story of your Compile: reading the tea leaves of the GWT compiler for an optimized future
  • AJAX APIs, Using AJAX/RESTful APIs on Mobile Native Apps
  • OpenSocial, Building a Business with Social Apps
  • Geo APIs, Building scalable Geo applications

We've published a selection of the session abstracts but check back as we'll be adding more sessions over the next couple months.

At I/O, you'll have a chance to interact directly with the engineering teams who work on our APIs and developer products. There will be dozens of in-depth technical sessions that focus on how to write better applications using Google and open technologies. For developers who are working on business applications, we've expanded our sessions and demos on those topics as well. And we'll have plenty of opportunities for the developer community to demo apps that use the latest web and mobile technologies.

We're working hard to make this event insightful, useful, and fun! Visit the Google I/O website to learn more and register. Space is limited so make sure you reserve your spot early. As a bonus, you'll get a hard copy of the Google Chrome Comic book if you register by May 1.

Like last year, Google I/O will be followed by Developer Days that will take place in various countries around the world. Keep an eye out for an announcement with details on dates and locations.

Looking forward to seeing you at I/O!

Monday 26 January 2009
Facebook StumbleUpon Twitter Google+ Pin It

Empty Options for cakePHP 1.2

$options['empty'], if set to true, forces the input to remain empty.

When passed to a select list, this creates a blank option with an empty value in your drop down list. If you want to have a empty value with text displayed instead of just a blank option, pass in a string to empty.

<?php echo $form->input('field', array('options' => array(1,2,3,4,5), 'empty' => '(choose one)')); ?>


Parthiv Patel
Bhaishri Info Solution
Sr. PHP Developer
Limdi Chowk, AT PO. Nar, Di. Anand
Nar, Gujarat
388150
India
pparthiv2412@gmail.com
7383343029
DOB: 12/24/1986

How to Include Javascript File in Cake PHP

If you want to use a Javascript file, you usually reference it in the head section of your layout:

<head>
    <?php echo $javascript->link('script.js'); ?>
</head>

But sometimes you want to use a certain Javascript file only in one view. Then it doesn’t make sense to reference it in the layout. You could take the PHP statement from above and place it in your view, that will work. But it is not a clean solution as the Javascript reference is placed somewhere in the middle of the generated HTML code.

Fortunately, CakePHP 1.2 allows you to define a reference to a Javascript file which is then added to the head section of the generated HTML code. For this purpose the variable $scripts_for_layout has to be added to the layout:

<head>
    <?php echo $scripts_for_layout; ?>
</head>

In the view you can now link to the Javascript file with:

$javascript->link('script.js', false);

Notice the second parameter. Set it to false to tell cake to put the reference in $scripts_for_layout variable in the layout file.



Parthiv Patel
Bhaishri Info Solution
Sr. PHP Developer
Limdi Chowk, AT PO. Nar, Di. Anand
Nar, Gujarat
388150
India
pparthiv2412@gmail.com
7383343029
DOB: 12/24/1986

PHP Ternary Operator

Consider the following snippet of code:

if (condition){
 variable = value1;
}else{
 variable = value2;
}

Instead of doing that way, we can just simply do it like this:

variable = condition ? value1 : value2;

Another variation of using the ternary operator would be from:

if (condition){
 echo "something1";
}else{
 echo "something2";
}

And it can be expressed like:

echo condition ? "something1": "something2";

You can also nest the condition:

variable = cond0 ? (cond1 ? value1.1 : value1.2) : (cond2 ? value2.1 : value2.2);

Just use your imagination on how to use this form.



Parthiv Patel
Bhaishri Info Solution
Sr. PHP Developer
Limdi Chowk, AT PO. Nar, Di. Anand
Nar, Gujarat
388150
India
pparthiv2412@gmail.com
7383343029
DOB: 12/24/1986

Google Visualization API interactive samples in the AJAX APIs Playground



We all know that writing code based on existing code snippets is faster and quicker than starting from scratch. It's also a great way to ramp up on new tools or APIs you may be less familiar with.

That's way we decided to provide a whole bunch of interactive code samples for the Google Visualization API in Google's recently launched AJAX APIs Playground.

These code samples run the gamut from specific visualizations like for the Motion ChartAnnotated Time Line (used in Google Finance) or Geo Map to covering specific Visualization API topics like event handling and placing data source requests.

The Playground enables you to change the sample code, re-run it, and see the results in real time. You can export your code, save it, and also get a full HTML source. In fact, for most of your programming needs, this tool is all you'll ever need to write, debug and integrate visualizations from the Visualization API into your web pages.

We hope you enjoy the added productivity and wish you happy visualizing!

Wednesday 21 January 2009
Facebook StumbleUpon Twitter Google+ Pin It

Playing around with Google's AJAX APIs



For me, documentation isn't always enough to learn about APIs; I need examples that I can play with. That's why I started a fun project recently--a tool for teaching developers how to use Google's JavaScript APIs: the AJAX API Playground. I have been working on this in my 20% time and today I am proud to announce that we are launching the AJAX API Playground as the official way that Google will show JavaScript samples!
The AJAX API Playground is currently loaded with over 170 samples for 8 Google JavaScript APIs (Maps, Search, Feeds, Calendar, Visualization, Language, Blogger, Libraries and Earth) that you can edit and run to help you explore what Google's APIs have to offer. There are also save and export features. The save feature allows you to hold onto an edited sample so you can continue working on it later, while export lets you modify a sample and publish the code to a permanent url.

As the AJAX API Playground is built on App Engine, you can create your own App Engine instance to show off your code samples. The code is open sourced under an Apache 2.0 license and uses several open source libraries and tools, including jQueryjQuery UIYUI Compressor, and CodeMirror. You can find the code on Google Project Hosting and learn about adding samples on the project wiki.

Stay tuned for more samples for more APIs. Enjoy!

Wednesday 14 January 2009
Facebook StumbleUpon Twitter Google+ Pin It

Changes for Jaiku and Farewell to Dodgeball and Mashup Editor



Google has long believed that thoughtful iteration is the best way to build useful products for our users. As part of that process, we are always looking for ways to better focus our teams on the products that can have the most impact.

As we mentioned last April, we are in the process of porting Jaiku over to Google App Engine. After the migration is complete, we will release the new open source Jaiku Engine project on Google Code under the Apache License. While Google will no longer actively develop the Jaiku codebase, the service itself will live on thanks to a dedicated and passionate volunteer team of Googlers.

With the open source Jaiku Engine project, organizations, groups and individuals will be able to roll-their-own microblogging services and deploy them on Google App Engine. The new Jaiku Engine will include support for OAuth, and we're excited about developers using this proven code as a starting point in creating a freely available and federated, open source microblogging platform.

Some of you may also be familiar with Dodgeball.com, a mobile social networking service that lets you share your location with friends via text message. We have decided to discontinue Dodgeball.com in the next couple of months, after which this service will no longer be available. We will communicate the exact time-frame shortly.

Finally, in the spirit of onward and upward, we have decided to shut down the Mashup Editor, currently in limited private beta, in favor of the more powerful App Engine infrastructure. Existing Mashup Editor applications will stop receiving traffic in six months, and we hope you will join our team in making the exciting transition to App Engine.