Sunday, 28 August 2011

Flex - Could not resolve mx Script to a component implementation.

When you find this problem with latest flex builder. Don't panic. Just this error indicates you to change the latest  MXML script.


Lets go practical.
                 
                    Change <mx:Script> to  <fx:Script> will do the fix.

 The below example will give the clear picture.This works well in Adobe Flex builder 4.x versions with Windows 7.

<s:application minheight="600" minwidth="955" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"> 
<fx:declarations>
<mx:httpservice id="photoService" result="photoHandler(event)"   url="http://api.flickr.com/services/feeds/photos_public.gne">
</mx:httpservice>
<fx:script>


</fx:script><br />     <s:hgroup height="219" textalign="left" width="529" x="174" y="37">
<s:label height="23" text="Flickr tags or Search" verticalalign="middle"   width="188">
<s:textinput id="searchTerms">
<s:button click="requestPhotos()" label="Search">
</s:button>
</s:textinput>
</s:label>
</s:hgroup>
</fx:declarations>
</s:application>

Monday, 22 August 2011

How to start Apache and MySQL service at startup in Windows

In Windows OS, Goto Start -> Run -> services.msc <press enter>,

change the settings for "wampapache" and "wampmysqld" to start: "Automatic".

This will start the service for running the server and the websites running on the web server and not wamp manager.

Running the WAMP Manager is different thing.

You can do that by placing the "start WampServer" shortcut in the Startup submenu in

Start-> All Programs-> Startup.

Note: In windows 7 and Vista, user input is needed to start wamp manager (not service) due to UAC(User Account Control).

Saturday, 20 August 2011

How to fix "Cannot load mysqli extension. Please check your PHP configuration" phpMyAdmin Error.


- Solution -
step 1:
open php.ini and search for 'extension_dir' and check whether the files and folders exist in the given path and the right version number folder.
  
extension_dir = "c:/wamp/bin/php/php<version number>/ext/"

if you have made any changes, then restart all services and check phpmyadmin, if it doesn't work try...

step 2:
open php.ini and uncomment the following lines in php.ini if any by removing the '#' at the beginning of the line.
 
extension=php_mysql.dll
extension=php_mysqli.dll

extension=php_mbstring.dll

Check phpmyadmin, it should be working now :).

Ajax Session Time Out Handling in PHP

Recently I stuck up with ajax time out issue .Yup, my webpage went weird once the session get expired, as a result i can see my login page appeared inside the result div tag.

But i want to identify the session status and it should redirect to login page.Now the following steps shed some light to tackle this ajax session timeout issue.


During Ajax request , using the browser like Firefox, the requested url can be visible through console which further can be run from the browser address bar. This can be prevent by PHP’s $_SERVER['HTTP_X_REQUESTED_WITH'] variable.

If your are using simple javascript no jQuery, Mootools or any other JavaScript API, set the ajax request header to

xmlHttp.open(“GET”,url,true); // After this set header as
xmlHttp.setRequestHeader(“X-Requested-With”, “XMLHttpRequest”);

With jQurey,Mootools no need to set this header.

With PHP set this code

define(‘IS_AJAX’, isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == ‘xmlhttprequest’);

Now in ajax call page set the code as

if(!IS_AJAX){
echo ‘ Direct Access Is not Allowed’;
exit;

}