<br><br><div class="gmail_quote">On Tue, Jun 19, 2012 at 3:23 PM, Chanaka Dharmarathna <span dir="ltr"><<a href="mailto:pe.chanaka.ck@gmail.com" target="_blank">pe.chanaka.ck@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Tue, Jun 19, 2012 at 2:37 PM, Rouslan Placella <span dir="ltr"><<a href="mailto:rouslan@placella.com" target="_blank">rouslan@placella.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>On 19/06/12 09:35, Chanaka Dharmarathna wrote:<br>
> On Mon, Jun 18, 2012 at 6:36 PM, Chanaka Dharmarathna<<br>
> <a href="mailto:pe.chanaka.ck@gmail.com" target="_blank">pe.chanaka.ck@gmail.com</a>>  wrote:<br>
><br>
>><br>
>><br>
>> On Sun, Jun 17, 2012 at 4:39 PM, Marc Delisle<<a href="mailto:marc@infomarc.info" target="_blank">marc@infomarc.info</a>>  wrote:<br>
>><br>
>>> Le 2012-06-16 00:26, Chanaka Dharmarathna a écrit :<br>
>>><br>
>>>> Hi All,<br>
>>>><br>
>>>> I have already create a class for display_tbl.lib.php<br>
>>>> andPMA_getDataCellForBlobField() in master used the<br>
>>>> PMA_mimeDefaultFunction() function as a global function.<br>
>>>> EX :<br>
>>>> $str = 'PMA_mimeDefaultFunction';<br>
>>>> $str($parameters);<br>
>>>><br>
>>>> I have moved the PMA_mimeDefaultFunction() from display_tbl.lib.php (in<br>
>>>> master) to common.lib.php file due to the way it has used inside<br>
>>>> display_tbl.lib.php.<br>
>>>><br>
>>>> Now I'm implementing class behavior in common.lib.php file.<br>
>>>> So can anyone tell me a file, which contain global function, to where I<br>
>>>> should again move this PMA_mimeDefaultFunction().<br>
>>>><br>
>>>> Regards !<br>
>>><br>
>>> Chanaka,<br>
>>> I believe that this function should not be global, as it's only called<br>
>>> from other functions in libraries/DisplayResults.class.php, right?<br>
>>><br>
>>> --<br>
>>> Marc Delisle<br>
>>> <a href="http://infomarc.info" target="_blank">http://infomarc.info</a><br>
>>><br>
>>><br>
>>> ------------------------------------------------------------------------------<br>
>>> Live Security Virtual Conference<br>
>>> Exclusive live event will cover all the ways today's security and<br>
>>> threat landscape has changed and how IT managers can respond. Discussions<br>
>>> will include endpoint security, mobile security and the latest in malware<br>
>>> threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br>
>>> _______________________________________________<br>
>>> Phpmyadmin-devel mailing list<br>
>>> <a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a><br>
>>> <a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
>>><br>
>><br>
>> Hi Marc,<br>
>><br>
>> Sorry for little bit delay to respond.<br>
>> I first try to use this function while it is inside the PMA_DisplayResults<br>
>> class.<br>
>> But if there is any field with transformations, it does not work properly.<br>
>><br>
>> So that put it as a global function.<br>
>> But I can again consider on that after completing the implement class<br>
>> behavior of common.lib.php file<br>
>> For just now I move PMA_mimeDefaultFunction() function to core.lib.php<br>
>> file.<br>
>><br>
>><br>
>> Regards !<br>
>> --<br>
>> ____________________________________<br>
>><br>
>> Chanaka Indrajith<br>
>> Bsc.Computer Engineering Undergraduate<br>
>> Faculty of Engineering<br>
>> University of Peradeniya<br>
>> Sri Lanka<br>
>> ____________________________________<br>
>><br>
>><br>
> Hi Michal,<br>
><br>
> There are many places which are using functions in common.lib.php file.<br>
> After implement the class behavior for this file, all the other places need<br>
> to call those functions using an object of PMA_CommonFunctions class.<br>
> Even in the same file I may need to create several objects of the<br>
> PMA_CommonFunctions class. (files with global functions)<br>
><br>
> So I' thinking of using global variable (in $GLOBALS super global array) to<br>
> store an object of PMA_CommonFunctions class and introduce a global<br>
> function (may be under core.lib.php) to get that object by checking whether<br>
> the global variable is set or not.<br>
> So that even inside the procedural code segments, that function can be used.<br>
> Its highly appreciated if you can give me your feedback on this approach.<br>
><br>
> Regards !<br>
<br>
<br>
</div></div>What you seem to want is a singleton [0]. In a few words: the<br>
constructor is private, the instance is in a static variable and a<br>
public getInstance method allows access to the instance. You can also<br>
have a look at the PMA_Response class for a concrete example.<br>
<br>
Bye,<br>
Rouslan<br>
<br>
[0]: <a href="http://en.wikipedia.org/wiki/Singleton_pattern" target="_blank">http://en.wikipedia.org/wiki/Singleton_pattern</a><br>
<div><div><br>
------------------------------------------------------------------------------<br>
Live Security Virtual Conference<br>
Exclusive live event will cover all the ways today's security and<br>
threat landscape has changed and how IT managers can respond. Discussions<br>
will include endpoint security, mobile security and the latest in malware<br>
threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br>
_______________________________________________<br>
Phpmyadmin-devel mailing list<br>
<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
</div></div></blockquote></div><br></div></div>Hi Rouslan,<br><br>Thanks for your quick and valuable information.<br>Singleton pattern definitely use only one object and it save the memory.<br>I'll use that.<div class="HOEnZb">
<div class="h5"><br clear="all"><br>Regards !<br>
-- <br>____________________________________<br><br>Chanaka Indrajith<br>Bsc.Computer Engineering Undergraduate<br>Faculty of Engineering<br>University of Peradeniya<br>Sri Lanka<br>____________________________________<br>

<br>
</div></div></blockquote></div><br>Hi Michal,<br><br>I almost did the modifications related to introduce class behavior of common.lib.php file.<br>It is quite time consuming task since there are lot of files to do the minor modifications.<br>
<br>Now I'm facing to a problem.<br>Due to this changes code has not working properly. (I didn't commit the code yet since it is not working)<br>Is there any log file or something where we can see code is breaking?<br>
Since this is not just one file its very hard to find out the errors.<br>Looking for suggestions to debug this code.<br><br clear="all">Regards !<br>-- <br>____________________________________<br><br>Chanaka Indrajith<br>
Bsc.Computer Engineering Undergraduate<br>Faculty of Engineering<br>University of Peradeniya<br>Sri Lanka<br>____________________________________<br><br>