My contemplations and diurnal novelties are publicized here

Archive for November, 2011

Zend Dispatch Process


Here is a nice description of things happening behind the scene of the whole dispatch process in zend framework.

http://www.filejungle.com/f/PxFgr5/zenddispatch_en.pdf

 

Advertisements

Some important dlls


Important Note:- All file extension need to be changed to dll

  1. Recatcha.dll (Version:- 1.0.0.0) Recaptcha

(Note:- If not not found, make sure to post you required DLL in the comments below so i can find and upload)

Wahab Quotes


  1. زندگی مسکلات سے لڑنےکا نام ہے،زندہ رہتےہوےآسانیوںکوتلاش کرنا بیوکوفی  نہی تو اورکیا ہے ؟
  2. Commitment is another name to sacrifices; You can’t be committed to a cause without willing to sacrifice for it.
  3. Success comes, when you refuse to fail.
  4. Commit with care; Commitments need to be fulfilled as well.
  5. Value of a thing is measured by it’s need not its price.

How to start web development as a career OR how to become a web developer


It’s really insane; once you dive into the world of web development. You are amazed with the number of technologies available. The real problem occurs once you have to decide what to do. Web development is not just learning a single technology its a mixture/blend of several technologies. Not only you have to learn those technologies you have to decide this as well; which to learn first and which to learn later.

Creating of a web application span over several steps:-

  1. Inception of Idea/thoughts
  2. Creating a mockup(design/wire-frame) , in which it is sketched what the web application will contain.
  3. Once the design is finalized it is HTMLized (Html is created out of that design)
  4. Once you create the HTML, it is ready to be used within you web forms.
  5. Web forms do utilize client side and server side technologies.
  6. Several other steps do include but these are the main steps

Now we come to the point where to start:-

Different people when starting a thing have different level of experience so you can adapt it as per you need and adaptibility.

  1. I would prefer you should first of all start learning HTML. You should know all the basic elements of HTML and how to use them.
  2. Once you are apt in HTML i would prefer learning Javascript and try to explore it as much you can because it the core client side language for html manipulation. Jquery, AJAX all are based on Javascript, so make it the second weapon of your choice.
  3. Once you are done with Javascript now let play with CSS, it is like beautifying your html. BEWARE NOT TO USE ANY SERVER SIDE LANGUAGE UNTIL YOU MASTER ALL THESE THREE.
  4. Once you are good at these 3 now you can use any server side language Asp.net, PHP or JSP. I would prefer using PHP as it will allow you to manipulate your HTML directly.

Consuming dotnet based web service ( returing dataset ) in PHP (Zend).


Consuming a dotnet web service that return dataset can be a nightmare to consume. I tried to consume it and Google several time to find a solution due to inappropriate/incomplete  solution i am writing one.

Here is a subset list of my useful search which you can use as a per-requisite:-

  1. http://stackoverflow.com/questions/279220/how-to-invoke-a-c-sharp-web-service-through-php
  2. http://php.net/manual/en/soapclient.soapcall.php
  3. http://superdotnet.codeplex.com/
  4. http://stackoverflow.com/questions/2749954/asmx-web-service-returning-xml-instead-of-json-in-net-4-0
  5. http://metrix.fcny.org/wiki/display/tips/How+to+Create+a+PHP+Client+for+a+.NET+and+SOAP-based+Web+Service+API
  6. http://stackoverflow.com/questions/5282930/consuming-net-web-services-with-complex-types-in-php

And here comes my solution:-

require_once(‘Zend/Soap/Client.php’);

$url = ‘http://mywebservice/Service.asmx?wsdl’;
$options = array
(    “soap_version” => SOAP_1_1,
“encoding” => “UTF-8”,
);
$client = new Zend_Soap_Client($url,$options);

$response = $client->GetBalanceSummary(
array(
“AccessKey”=>”13264”,
“AccountNo”=>”4546”,
“CustomerId”=>”4654”,
“Channel”=>”acb”,
“FundCode”=>”aadd”,
)
)->GetBalanceSummaryResult;

$xml = simplexml_load_string($response->any);
$testArray = $xml->xpath(“NewDataSet”);

$testArray2 = $testArray[0];
var_dump($testArray2[0]->Table1);

How to create a cursor in MySql


I have had trouble creating in Mysql cursor so i decide to post this.

Don’t use same name for cursor variable similar to Column name of the fetched recordset.

-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `INVESTOR2PROFILE`(
)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE a CHAR(16);
DECLARE _PID INT;
DECLARE _AID INT;
DECLARE _CIC ,_IN ,_rn ,_ct,_AN ,_AT,_OI ,_AOD, _ATI ,_E ,_ISP varchar(45);
DECLARE cur1 CURSOR FOR SELECT CNIC,InvestorName,registrationNo,categoryType,AccountNumber,AccountTitle,OperatingInstruction,AccountOpeningDate,
ATT.AccountTypeID, Email, 'y' IsPrimary from temptableforbulkimport temp left join AccountTypes ATT 
on temp.AccountType = ATT.AccountType;

DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

  OPEN cur1;
  
  read_loop: LOOP
    FETCH cur1 INTO _CIC ,_IN  ,_rn ,_ct,_AN ,_AT,_OI ,_AOD, _ATI ,_E ,_ISP;
    IF done THEN
      LEAVE read_loop;
    END IF;
    Select _CIC ;
    Select _IN  ;
    Select _rn; 
    Select _ct;
    Select _AN ;
    Select _AT;
    Select _OI ;
    Select _AOD;
    Select _ATI ;
    Select _E ;
    Select _ISP;
    /**********************Create Profile**********************/
    INSERT INTO profiles(CNIC,ProfileName) VALUES (_CIC,_IN);    
        Set _PID = LAST_INSERT_ID();
    /**********************Create Account**********************/
        INSERT INTO accounts(AccountNumber ,AccountTitle ,OperatingInstructions ,AccountOpeningDate , AccountTypeID) values (_AN ,_AT,_OI ,_AOD, _ATI);
        Set _AID = LAST_INSERT_ID();
    /**********************Create ProfileAccount**********************/
    select _PID;
    select _AID;
    INSERT INTO profileaccount(AccountID ,ProfileID,IsPrimary, Email) values (_AID ,_PID,_IsPrimary, _E);
    /**********************Create ProfileInvestor**********************/
    INSERT INTO ProfileInvestor(ReferenceID ,InvestorCategory,ProfileID) values (_rn ,_categoryType,_PID);    
  END LOOP;

  CLOSE cur1;  
END
%d bloggers like this: