February 28, 2007
I am very excited today, I have finally my chat app ready and working. I have shown my application to all my collegues they throughly enjoyed it.
Soon I will be writing the article about the entire development of this chat application.
I have created three user for the test.
After logging inside you will find a list of User on the left panel, click on the user and start sending messages to them.
So lets have a real feel of the application. Click here to start
February 16, 2007
After trying for some half an hour I finally solved the problem of posting values from flash to PHP. I used LoadVars Object for this purpose. LoadVars object is used for transffering values between Flash and Server. It has various properties, methods and events which also helps in determining the successful data loading and communication between server.
In flash you can create LoadVars in following way
var loadVarObj = new LoadVars();
loadVarObj.firstName = “Vijay”;
loadVarObj.lastName = “Khambalkar”;
This is how your typical loadvars code will look like in case when you need to post values to server side. I found it interesting and thought to share.
One more thing I noticed about the loadVarObj documentation
public send(url:String, target:String, [method:String]) : Boolean
But this part didnt work, you need to event pass object itself as a second parameter. Only then your values is get posted. This is problem where I stuck initially.
Hope this much information will help you.
February 15, 2007
We are developing a Flex Application with PHP as a middleware. Flex Httpservice component we are using to communicate with the PHP. We have several developers who are doing separate modules. They doing both Flex as well as PHP code. I thought its not proper and need to have a solution where our code will reside on the single url.
How we achieve this?
I thought of developing a architecture which will take a className and methodName from URL and call methods and the supplied object dynamically.
This above url calls getUser method on MyClass Object. I used call_user_method function of PHP which allows me to achieve this.
One trick for this part is also instantiating the object dynamically. I coded like this
static $instance ;
$instance =& new $class;
getObject method accepts className and checks wheather that object exists or not. If object is not set then it creates a object and just return it.
It was a great experience while building something which allows my developers to simplify their code integration. Now every developers is working on their respective classes and using this method.
February 12, 2007
What is the solution to this common problem?
The day I realized that I can control this, I started using the concept. Thanks to my previous boss Kaushik Chatterjee who bring this forward for me. Concept is fairly very simple. Define a global level debug variable with default value 0. Following code will explain what I am trying to convince.
var debug = 0;
debugMessages(“I am in this function”);
Above code is pretty simple to understand the concept.
First line of code defines debug variable with value 0 i.e 0 disable/ 1 enable
function debugMessages is responsible for all debugging messages. All messages will route through this function. Inside this its checking whats the value of debug variable. If its true then show alert message or simply discard it. So you can kept the value of debug variable always true as and when working on the development version. At production level simply turn off this variable and there will be no extra debug alert/message in the application.
Applying smart use of this technique, we can achieve alot and stop client from complaining these silly points which we really dont mean too. Atleast it will remove one bug from your system as entered by client as a bug.
February 12, 2007
Months ago when I heard of the term framework which generate Add/Mod/Del functionality, I was quite surprise and realize that how helpful it could be. It will save a lot of hours I spend on the most part, increase efficiency and will be bug free :). After trying with some framework, I found it does the right job but not with style I write the code. Its interanal are too difficult to understand and modifying such code eats up more time than I ever expected. I thought Its better idea to go the way I/we code. Later after thinking for some time on the right concept, its clear many thing and I realizes building framework is not a tough job. In my earlier post I already talked about when I started with it. This time I develop more better version of code.
I used pear DB class for database and Smarty for templating as most of the PHP developers are using it.
What features my frameworks offer this time?
-Generate Class file based on the table Structure.
-Generate Templates for AddUpdate as well as for Listing the records.
-Sorting on the each column field.
-Server Validation for Unique values.
-Generate JS map which we can use for further validation.
-Debug options which allow development message enable disable.
-Generate Links based on the class available.
-Search on the table field
New Features I will be adding this month
-Basic Ajax Functionality
Framework is flexible enough to add new functinality in code. Even this framework has ability to generate Coldfusion, ASP as well as Java code.
I soon will be submitting it to sourceforge.net and host it for the developers to take a look about what I am talking.