May 14, 2012

Thilina Buddika Abeyrathna

Second week of GSOC

This is my second week status of the phpMyAdmin GSOC project. Last week I’ve started the refactoring tbl_change.php script and it was a very large script. As I mentioned last post it contains lots of  HTML and PHP mix tags.

I’ve created a new PHP script insert_edit.lib.php  in libraries directory to implement the functions for insert and edit sections in phpmyadmin. I’ve moved all the functions which I’ve already implemented in tbl_change.php file.

In this script there is a huge for loop as I mentioned in previous post. End of this week I’ve implemented lot of functions to refactor this for loop. And also insert form was not readable because of the mix tags. I’ve implemented several functions to render HTML  for several columns in the form table. As an example this contain

  • Function column – PMA_getFunctionColumn()
  • Null column – PMA_getNullColumn()
  • Value column – PMA_getValueColumn()

Value column is depends on the type. So I’ve implemented set of functions to render HTML for all the types.

e.g. PMA_getPmaTypeEnum(), PMA_getPmaTypeSet(), PMA_getBinaryAndBlobColumn(), etc.

There was a bug which happened after my some code refactoring . But it not fixed yet.

Next week I’ll fix the remaining bugs related to tbl_change.php file. And I’ll complete the refactoring for tbl_change. php script and start refactoring tbl_replace.php script. It is not a huge script like tbl_change.php. This file does not have HTML tags. But there are lot of if conditions and loops without any functions. In next week I’ll implement  set of functions to do the refactoring for this script and move all the functions to libraries/insert_edit.lib.php file.


by Thilina at May 14, 2012 02:33 PM

Chanaka Indrajith

GSoC 2012 - 1st Week Progress

                            This is my first week of Google Summer of Code project which is Refactoring: Displaying query results under phpMyAdmin organization. Since I have my final examination, I started my work before the official day for start coding(21st May). It was a great experience that working with world wide open source community. That experience will be very helpful for me to manage my work in the upcoming weeks.

       According to my project schedule, I was dealing with, refactoring the file "display_tbl.lib.php" in this week. That is a file with 22 global functions. Some of them are really huge functions. As well, though library files are suppose to provide functions which having logics(calculations, concatenation, manipulation etc), while being in a separate layer (data/model layer), this file have some HTML renderings inside themselves. And the naming convention of some methods were different from the phpMyAdmin (PMA) standards.

           In this week, I modified the all the needed functions in "display_tbl.lib.php" file, to remove the HTML renderings inside themselves. Instead of that, that functions are now returning a string which having relevant HTML content for each function. Since inside some of functions are using the functions in "common.lib.php" file and some of them also had the same issue, I modified them as well. The unit tests for each also modified according to the changes I did in corresponding functions.

            The names of most of the functions were changed due to changing of the behavior of some functions. Those names were changed with adding "get" phrase. I was also looked in to modify the code to keep necessary indentation, since it improve the readability of the code.

         At next week, I'll more look into improve the readability of the code with adding the suggested conventions in my proposal. As well the huge functions will be braked in to several functions. The unit tests also will introduced as possible for those function.


by Chanaka Dharmarathna (noreply@blogger.com) at May 14, 2012 01:16 PM

May 13, 2012

Dieter Adriaenssens

Working towards a first bèta release

A few years ago, I created a small framework to help me develop web applications more easily, without having to reinvent the wheel every time, or even worse, duplicating already written code. At some point I decided to Open Source it, and created a project page on SourceForge, with the idea of creating a bèta release some day.
Many years have passed since, with changing activity on the framework, but recently I picked up the idea again to release it. The last few weeks I've been cleaning up the code and implementing some things I've learned and picked up over the years, like OOP design patterns.

There is still some work before it's ready to release, but I'm getting there, continuously improving it, step by step : Formaid : preparing for a first release

by Dieter Adriaenssens (noreply@blogger.com) at May 13, 2012 07:02 PM

May 10, 2012

Michal Čihař

Weblate 1.0

After few weeks of heavy testing, Weblate 1.0 has been released today.

Compared to 0.9 there are just minor changes and bug fixes. The most important thing is that Weblate should be now really ready to use :-).

Full list of changes for 1.0:

  • Improved validation while adding/saving subproject.
  • Experimental support for Android resource files (needs patched ttkit).
  • Updates from hooks are run in background.
  • Improved installation instructions.
  • Improved navigation in dictionary.

You can find more information about Weblate on it's website, the code is hosted on Github. If you are curious how it looks, you can try it out on demo server. You can login there with demo account using demo password or register your own user. Ready to run appliances can be found in SUSE Studio Gallery.

Weblate is also being used https://l10n.cihar.com/ as official translating service for phpMyAdmin, Gammu, Weblate itself and others.

If you are free software project which would like to use Weblate, I'm happy to help you with set up or even host Weblate for you (this will be decided case by case as my hosting space is limited).

Filed under: English Phpmyadmin Suse Weblate | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at May 10, 2012 10:00 AM

May 09, 2012

Chanaka Indrajith

symfony ගැන බිදක්... (symfony Framework)

                   සරලවම කිව්වොත් symfony කියන්නේ web applications  නිර්මාණය කිරීම සදහා වන, PHP වලින් ලියන ලද framework එකක්. Pure PHP පාවිච්චි කරනවට වඩා symfony පාවිච්චි කරන එකෙන් අපිට ගොඩක් පහසුකම් සැලසෙනවා. අපේ application එක එක හොද පාලනයක් ඇතිව හසුරුවන්න, පැහැදිලි code එකක් ලියන්න, ඒ වගේම MVC (Model-View-Controller) architecture එකට අනුකූලව application ලියන්න symfony අපට උදව් වෙනවා. අපිට application එක භාගයක් develop කරල තියෙද්දී වුනත් DBMS එක වෙනස් කරගන්න අවශ්‍යය වුනොත් (උදා :- MySQL වල ඉදන් Oracle වලට) ඒකට පවා symfony අපිට පහසුකම් සලසනවා. ඒ තරම් ලොකු configurability එකක් symfony පාවිච්චි කරල තියෙන application එකකට තියෙනවා.

                             symfony application එකක් configure කිරීම සදහා පාවිච්චි කරල තියෙන්නේ  YML (YAML) කියන file format එක. YML කියන්නේ භාවිතයට සහ තේරුම්ගැනීමට ඉතමත් පහසු, XML වලටත් වඩා සරලව data දක්වන්න පුලුවන් markup language එකක්. අපේ application එකේ database එක නිර්මාණය කරන එකත් මේවගේ සරල YML file එකකින් කරගන්න පුලුවන්.

         symfony වල විශේෂත්වයක් තමයි internationalization වලට support කරන එක. ඒ කිව්වේ අපිට පහසුවෙන් application එකේ language එක change කරගන්න පුලුවන්. ඒ සදහා අපි වෙනම XML file එකක් පාවිච්චි කරනවා අදාල වචන ටික store කරගන්න.

                   ඒ වගේම  තවත් දෙයක් තමයි symfony පාවිච්චි කරලා හ
න form එකක තියෙන widgets (HTML form elements) වලට වෙන වෙනම server side validation rules add කරන්න පුලුවන් වීම. මේ නිසා අපිට client side validation නැති වුනත් data  validate කරන්න additional codes ලියන්න අවශ්‍යය වෙන්නේ නැහැ. ඒ වගේම application එකට එවන unauthorised data ලිනුත් application එක ආරක්ෂාකරගන්න පුලුවන් මේ validators තියෙන නිසා.

                symfony වල MVC architecture එක ගෑන පොඩ්ඩක් සදහන් කලොත්, DBMS සමග data transaction  කිරීමත්, application එකේ business logic එක ක්‍රියාත්මකවීමත් Model Layer එකෙනුත්, ඒ  data පාවිච්චි කරල Graphical User Interface එකේ ඒවා පෙන්වන එක View Layer එකෙනුත්, application එකට එන request handle කිරීම සහ ඒ අනුව response එකක් දීම Control Layer එකෙනුත් සිදු වෙනවා.

                   symfony framework එක ඈතුලේ, databse transactions පහසුවෙන් කරගන්න Doctrine කියන ORM (Object Relational Mapper) එක පාවිච්චි කරල තියෙනවා. හරියට java වල ORM එකක් විදියට  hibernate පාවිච්චි කරනව වගේ. Doctrine ගැන තවත් ලිපියකින් කතාකරන්න බලාපොරොත්තු වෙනවා.

                             ලිපියේ මුලින් සදහන් කරල තියෙන විදියට DBMS එක මාරු කරන විදිය ගැන පොඩ්ඩක් කතාකලොත්, ඒ විදියට database එක මාරුකරගන්න හැකිවෙන්නේ අපේ database එක සහ Doctrine භාවිතා කරලා තියෙන Model Layer එකත් අතර PDO(PHP Data Object) Layer එකක් තියෙන නිසා. මේ PDO Layer එක නිසා අපි පාවිච්චි කරන DBMS එක ගැන තැකීමකින් තොරව එහි තියෙන data වලට access කරන්න පුලුවන්. මේ හැකියාව symfony වලට ලෑබිලා තියෙන්නේ data transactions වලට ORM එකක් පාවිච්චි කරලා තියෙන නිසායි.

                     symfony ගැන මා දන්න දේවලින් ටිකක් ඔබ එක්ක බෙදාගන්න එක තමයි මේ ලිපියේ අරමුණ. ඔබ මේ ලිපිය කියවීමෙන් ඒ මගේ අරමුණ සාර්තක වුනානම් ලිපිය පිලිබද ඔබේ අදහස දැනගැනීමට කැමැත්තෙමි.


by Chanaka Dharmarathna (noreply@blogger.com) at May 09, 2012 04:23 AM

Doctrine ගැන දැනගනිමු. (Doctrine Object Relational Mapper)

                  Doctrine කියන්නේ ORM (Object Relational Mapper) එකක්. Doctrine ගැන වැඩි විස්තර කතාකරන්න කලින් ORM කියන්නේ මොකක්ද කියලා බලමු. Database එකක තියෙන data වල යම් පොදු සම්බන්ධතවක් තියෙනවා(relational databases). නමුත් PHP language එක ඒ වගේම symfony framework එක සැකසිලා තියෙන්නේ Object Oriented concept එක පාවිච්චි කරන්න පුලුවන් විදියට. ඉතින් මේ database එකට Object Oriented විදියට access කරන්න නම් මේ object logic එක relational logic එකකට හරවන්න පුලුවන් interface එකක් ඌනේ වෙනවා. මේ interface එක අපිට ORM එකක් කියලා හදුන්වන්න පුලුවන්.
                                           මම symfony ගැන ලියපු ලිපියේ සදහන් කරලා තියෙනව වගේ Doctrine කියන ORM එක පාවිච්චි කරල අපිට පහසුවෙන්ම database transactions කරගන්න පුලුවන්. මේ කියන Doctrine, database එක එක්ක කරන ගනුදෙනුව සරලව අපිට මේ විදියට හිතන්න පුලුවනි. Database එකේ table එකක් හරියට PHP class එකකට අනුරෑපී වෙනවා. ඒ table එකේ තියෙන attributes හරියට PHP class එකේ properties වලට අනුරෑපී වෙනවා. මේ කිව PHP class එකේ object එකක් කියන්නේ මේ table එකේ තියෙන record එකකට map කරන්න පුලුවනි.

අපි දැන් උදාහරණ කීපයක් අරගෙන බලමු කොහොමද මේ database transactions පහසුවෙන් කරගන්නේ කියලා.

1). employee කියන table එකට අලුත් record එකක් add කරන ආකාරය,

               $employee = new Employee();                          ------- a
               $employee->setFirstName('David');                   ------- b
               $employee->setLastName('Wintson');
               $employee->setEmail('david@hotmail.com');
               $employee->save();                                           ------- c    

a) employee කියන table එක map වුන Employee class එකේ object එකක් හදාගන්න.
b) class එකේ තියෙන properties වලට වෙන වෙනම getter, setter methods තියෙනවා. මේ behaviors පාවිච්චි  කරලා අපිට properties වලට values set කරන්න පුලුවන්.
c) දැන් අපි හදාගත්ත object එක database table එකේ record එකක් විදියට save කරන්න පුලුවන්.


2). employee table එකේ id එක 5 වෙන record එක Employee object එකක් විදියට ගන්න ආකාරය,

               $employee = Doctrine :: getTable('Employee')->find(5);

දැන් මේ object එකෙන් එකේ තියෙන properties පාවිච්චි කරන්න පුලුවන්
               $firstName = $employee->getFirstName();
               $lastName  = $employee->getLastName();


3). 'Sells' Department එකට අයත් hometown එක 'Kandy' වන Employee list එක ලබාගන්න Query එකක් ලියන ආකාරය, (department table එකෙන්  employee table එකට foreign key එකක් තියෙනවා)

             $employeeList = Doctrine_Query :: create()
                                          ->from('Employee e')
                                          ->leftJoin('e.Department ed')
                                          ->where('ed.name = ?', 'Sells')
                                          ->andWhere('ed.hometown = ?', 'Kandy')
                                          ->execute();

    $employeeList කියන්නේ Doctrine collection එකක්. ඒ කිව්වේ elements විදියට objects තියෙන array එකක්. foreach loop එකක් පාවිච්චි කරලා මේ array එකේ තියෙන object ව්ලින් අපිට ඌන දේ කරගන්න පුලුවන්.

මේ උදාහරණ කිහිපයෙන් පැහැදිලි වෙනවා ඇති SQL query ලියනවට වඩා Doctrine query ලියන එක කොච්චර ලේසිද කියලා.

              මේ කියන Doctrine interface එක database transactions කරන්නේ PDO (PHP Data Object) කියන තව interface එකක් හරහා. මේ PDO interface එක නිසා අපේ application එක පාවිච්චි කරලා තියෙන DBMS එක මත depend වෙන්නේ නැතිව එකේ තියෙන data වලට access කිරීමේ හැකියාව Doctrine වලට ලැබිල තියෙනවා. ඒක Doctrine වල තියෙන විශේ ලක්නයක්. අපිට කෙලින්ම PDO වලින් වුනත් මේ DBMS independent data accessing කරගන්න පුලුවන්. ඒ වුනත් ඒකට වඩා DQL (Doctrine Query Language) එක high level.

                               ඉතින් Doctrine ගැන මම දැනගත්ත දේවල් ටිකක් තම මේ ලිපියේ සදහන් කරලා තියෙන්නේ. මේ ලිපිය හරහා ඔබට ORM කියන concept එක ගැනත් යම් දැනුමක් ලැබෙන්න ඇති. මෙය ඔබේ දැනුමට වැදගත් වේවි කියලා හිතනවා.

by Chanaka Dharmarathna (noreply@blogger.com) at May 09, 2012 04:23 AM

Version Control Systems (Source/Revision Control Systems)

                                Version Control Systems are playing an important role in software source controlling. Most of the software industry used Version Control Systems to keep their source code in a central space so that any authorized person can access to it and do the changes in source files concurrently. The main purpose of a Version Control System is to enable collaborative editing and sharing of data, and keep the older states of the software code base (keep revisions).


                    In a project with large number of remote developers, there is a big probability to accidentally overwrite each other's changes in a regular file system (Figure 1). That's how the Version Control Systems come in to the picture in order to solve this problem.

Figure 1
                          So, to avoid above problem Version Control Systems used a strategy called Lock-Modify-Unlock model (Figure 2). This repository allows only one person to change specific file at a time. To do this it is using a lock system. The user who is going to change a file must lock the file so that any other user cannot lock the file again (it means file can be read but cannot change). After he made the change and commit the file to the repository he must unlock the particular file.

Figure 2
                                   But in this model, the developing process will be unnecessarily serialized, and by mistakes some users may not unlock a file, though others are waiting for unlocking that files. As well concurrent developing of two files by different users cannot have idea of each other file which have some dependencies between them.


                  Therefore another method called Copy-Modify-Merge model (Figure 3) is used as alternative to this problem. In here, users can concurrently develop the same file and commit it by after merging the new changes in repository to the working copy (locally changed copy).

Figure 3                                                                    
                            Version Control Systems such as SVN and CVS are using the above method to file managing.Using this method user have the full control of managing codes in conflicts (overwrite some code).

                  It's possible to classify the Version Control Systems as Centralized and Distributed. Centralized Version Control Systems means there is only one repository which developers are directly deals with. But in Distributed Version Control Systems are some kind of modification of the concept of Centralized Version Control Systems. The concept is to having two levels of Source Control Systems rather than one. So that, without all ways connecting with the main  Source Control System(main repository in server), using an own Source Control System(local host) until completing any specific work (can be a story of project). So that the main repository contains only working copies of the software. As well the operations (commit, revert) are faster due to using the own Source Control System more than Centralized Control System.


Some examples for Version Control Systems are as follows.

1). CVS (Concurrent Versioning Systems)
          Older technology. Simple system for make sure files and revisions kept up to date.

2). SVN (Subversion)
          Popular Version Control System. Most of the open-source projects use SVN.

3). git
          A fast populating, open-source Distributed Version Control System.

4). Mercurial
          Open-source Distributed Version Control System. Very faster and much simpler system than 'git'.

5). Bazaar
          Distributed Version Control System with different types of workflow than other Distributed Version Control Systems.

6). LibreSource
          Web portal, with a built-in subversion repositories. Useful for manage collaborative projects.

7). Monotone
          Fairly easy to learn. Places higher value on integrity than performance.


                               I think you may have some idea on Version Control Systems. And I'm willing to have another article soon on use of Subversion client.


by Chanaka Dharmarathna (noreply@blogger.com) at May 09, 2012 04:22 AM

Use of Subversion client with sourceforge

             Subversion (SVN) is Centralized, open-source Version Control System. SVN  manages files and directories and changes made to them over a period of time, while supporting to shared development with features like rollback code conflict resolve. As well this allows to recover older versions of the software (data) or examine the history of how the code-base changed. SVN is developed in order to overcome the bugs and misfeatures of CVS.

                 In SVN there are two ends to deal with. One is the Subversion Repository which contains all the managed files and directories, and the other one is commandline or GUI client application to manage files from the client's end. It is important to know the concept of SVN repository before starting work with SVN.

           Repository is a file server which is not behave like an usual one. It has it's own revisioning system. After any authorized person change a file in repository, the state of the code-base will change and it is given a index to identify that state which is new code-base. This index is called revision number. At the initial state of the repository revision number is '0'. For any change in repository the revision number will increase by one (Figure 1). So that people can refer the older versions of the code-base.

Figure 1

Usually repository contain three main directories containing the code-base.
  • trunk   - code-base of main development process
  • branch - copy of specific revision, to implement new features(which takes some time to finish) concurrently and independently on top of that (Figure 2)
  • tag      - some snapshots of the trunk. Can store stable versions of the code-base

Figure 2

Even in branching process, the revision numbers are depend on changes of the branches (Figure 3). How ever at the end of the branching process of a particular branch, containing code should be merge with the main code-base (in trunk).

Figure 3

     Now I think you have an idea on how the repository behave. To access SVN repository there are several methods. Following table shows the URL schemes map to each access method.


SchemeAccess Method
file:///Direct repository access (on local disk)
http://Access via WebDAV protocol to Subversionaware Apache server
https://Same as http://, but with SSL encryption
svn://Access via custom protocol to an svnserve server
svn+ssh://Same as svn://, but through an SSH tunnel

              As I mentioned earlier, the second end of SVN is the application, in client's end. I'll explain how we can generally use SVN client applications with Linux & windows environment.


Setup a repository

                  We can get use of sourceforge in order to setup a repository. sourceforge is free repository provider for open-source projects. What you have to do is register for the sourceforge and create a project. Make sure to select the version control system as SVN (default is git) while you are creating the project. sourceforge itself can add folders and files. But since we are in another track forget it for a moment. Under the code tab of your project home page, you can see the command you should use to get a checkout for linux based system. (make sure you have login)


With UBUNTU-10.04 OS

         SVN commandline client can be used with Linux based systems. After installing the SVN commandline client, files can managed via executing the commands in command prompt.

install SVNcommandline client on your machine
$ sudo apt-get install subversion libapache2-svn
first go inside that directory and add source files to the repository.
$ cd /home/source_folder
$ svn import --username=your_username -m "Meaningfull_message_about_the_source_changes_for_users" url_of_repository
note : the repository url you can obtain from the sourceforge (sourceforge -> your project -> code tab)

In sourceforge project your initial file upload will appear as revision number 2. This is due to sourceforge itself create the general folder structure of repository and it will appear as revision number 1.


To start developing with SVN, first create a new folder and then get a checkout from the repository (copy of the latest code-base in repository)
$ sudo mkdir /var/www/myproject
$ cd /var/www
$ svn co --username your_username url_of_repository myproject
Now you can start further implementation on that checkout. If you modify an existing file it will already prepared to commit (upload) to the repository. But if you add a new file or a directory first you have to make prepare it to commit.
$ svn add new_file_1 new_file_2
$ svn ci -m "Meaningful_Message" new_file_1 existing_file_1 existing_file_2
If you want to commit all the files you changed, you use above code without the file paths. A summery of some useful SVN commands are shown below.

information on usage of SVN
$ svn --help
initial commit
$ svn import --username=your_username -m "Message" URL
get a checkout
$ svn co --username your_username URL project_folder
make prepare to commit the newly added files (unversioned files)
$ svn add file_path
see the states of the files (whether versioned or unversioned)
$ svn st
note: The meaning of the symbols shown for statuses,
? - unversioned file
M - locally modified file
A - schedule to add the file
D - schedule to delete the file
G - merged file
C - conflicted file while updating (file is waiting for user resolve the conflict)
! - file is missing or incomplete (removed by non-svn command)
~ - versioned file obstructed by some file of a different kind
I - file ignored

get latest code to working copy without changing local modifications
$ svn up
note: If any file is about to conflict (overwrite) commandline client itself give some options to user to agree,
p - mark the conflict to be resolved later (postpone)
df - show all changes made to merged file (diff-full)
e - change merged file in an editor (edit)
r - accept merged version of file (resolved)
mf - accept my version of entire file and ignore their changes (mine-full)
tf - accept their version of entire file and lose my changes (theirs-full)
l - launch external tool to resolve conflict (launch)

h - show this list (help)

resolve conflicted file before commit (after postpone conflict we can manually resolve it)
$ svn resolved conflicted_file_path
commit all local changes
$ svn ci -m "Message"
note: to commit specific files, add file paths at the end of the above command separating each by a space

remove all the local changes of a working copy (become to base revision)
$ svn revert -R .
note: to revert specific file replace '-R .' with file path

information on base revision (revision of working copy on top)
$ svn info
modifications between working copy and base revision
$ svn diff
get file differences to a file
$ svn diff > ~/Desktop/path/filename.diff
apply patch (diff file) to working copy
$ svn patch -p0 ~/Desktop/path/filename.diff

With Widows 7 OS

             SVN GUI client can be used for windows based systems. TortoiseSVN is the GUI client of SVN. After Installing Tortoise SVN on a machine, files can be managed in UI level. To start the development, go to any directory, under which this project should be created, then right click and select 'SVN checkout' option. Then you can give the repository URL and the local project directory name. If you have already created a project in sourceforge, from the SVN command appeared under 'code' tab, you can fetch out the repository URL.


After any improvement in the code, the corresponding file and all it's parent directories are shown as modified by a red mark on the file or directory. Using the right click options, the modified code can be committed (SVN commit) even while neglecting some of the modified files by selecting them. As well you can see lot of SVN operations can be done from this interface (Figure 4).

Figure 4
 So if you are new to SVN, hope this will helpful to you.
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"/> <link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"/> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js" type="text/javascript"></script> <script language="javascript"> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf'; SyntaxHighlighter.all(); </script>

by Chanaka Dharmarathna (noreply@blogger.com) at May 09, 2012 04:22 AM

Test Driven Development with PHPUnit

       TDD (Test Driven Development) concept is common practice of most of the companies which involve with the long time projects. It helps to keep the static behavior of functions over the development period. The functions are implemented after implementing test methods (unit tests) for that function. After implementing the function, run the tests and if any test is failing, again modify the function. This process repeats until the all tests are passing.

                       Test method is a function which check whether the specific behavior of a function is correct. Any function can have at least two test methods. one positive test and one negative test. Most probably a function may have many test methods. The class in which all the test methods are placed is called Test Case. By setting up a test suite for this class, the all tests methods can be run at once.

         In long time projects like open source projects, the functions are frequently modified by the developers during a long time. If the modified function is not given the previous behavior of that function, the output for other places will be going wrong. It can be cause to failures. By writing tests this problem can be reduced. Before and after modifying the test cases, by running the tests, developer can be verify the function behave correctly. As well by going through the test cases helps even understand what actually function does.

      To follow this TDD concept with Java, JUnit framework can be used. As well with PHP, PHPUnit framework can be used. Let's do some experiments with PHPUnit with Ubuntu OS.

Install PHPUnit framework
$sudo apt-get install phpunit

Now create your test case as a sub class of 'PHPUnit_Framework_TestCase' having just one dummy method to verify we can forward without issue.

<?php

require_once 'PHPUnit/Framework.php'; // installed file with phpunit framework which is located at : /usr/share/php/PHPUnit/

class MyClassTest extends PHPUnit_Framework_TestCase {

// This function just return true
function testCheckAllWorksFine() {
$this->assertTrue(true);
}

}

?>

Run this MyClassTest.php file as :
$phpunit MyClassTest.php

If the result is as following (Fig. 1), you can proceed the work with phpunit.
Fig. 1


Characters it returns :

.     : pass
F    : fail
E    : error


The functions starting from 'assert' is implemented in the framework. As well there are more useful functions we can use with this framework. You can find more assert functions by visiting http://www.phpunit.de/manual/3.6/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.assertions.

I have used following useful assert functions for this article :
assertTrue() : Check whether the parameter is True
assertFalse() : Check whether the parameter is False
assertEqual() : Match two results



Start work

1. Requirement : need a function which accept two strings and return the length of the most lengthy string, if both arguments are not strings return false

* First just declare your function properly with arguments
<?php
class MyClass {

function getMaxLength ($str1, $str2) {

}

}
?>

* Now start to write test methods,
a). Check the arguments
<?php

require_once 'MyClass.php';
require_once 'PHPUnit/Framework.php';

class MyClassTest extends PHPUnit_Framework_TestCase {

var $obj;

// This function calls before any test merhod run
function setUp() {
$this->obj = new MyClass();
}

// Positive : Test getMaxLength for correct arguments
function testGetMaxLengthForAtLeastOneIsString() {
$paramArray = array("str1", 2);
$result = $this->obj->getMaxLength($paramArray[0], $paramArray[1]);
$this->assertEquals(4, $result);
}

// Negative : Test getMaxLength for non of arguments are string
function testGetMaxLengthForNoStrings() {
$paramArray = array(array(1,2), 12.3);
$result = $this->obj->getMaxLength($paramArray[0], $paramArray[1]);
$this->assertFalse($result);
}

}

?>


The setUp() will call automatically before running any test method. It can be used for create a fresh objects, load data for databases if using etc. All test methods must be start with 'test'. Using the function name which is going to use by specific test method regardless of the length of the test method name, will be increase the readability and understandability while reviewing later.


b). Check whether the function returns an integer
// Test getMaxLength for output integer for correct arguments
function testGetMaxLengthForCorrectReturnType() {
$paramArray = array("str1", 2);
$result = $this->obj->getMaxLength($paramArray[0], $paramArray[1]);
$this->assertTrue(is_int($result));
}



c). Check whether is returns the length of the most lengthy string
// Test getMaxLength for Length of the lengthy string
function testGetMaxLengthForCorrectLength() {
$paramArray = array("short_string", "lenghty_string");
$result = $this->obj->getMaxLength($paramArray[0], $paramArray[1]);
$this->assertEquals(14, $result);
}


Now the most needed test cases are implemented. From the above test methods, some scenarios like check the function return length of the string for arguments having only one string, is already covered. Now just run the test and see most of them are failing. Its time to start implement the actual function in a way that all te test cases are passing.


Function can be written as :
function getMaxLength($str1, $str2) {   

if(is_string($str1) || is_string($str2)) {
if(is_string($str1) && is_string($str2)) {
$max = (strlen($str1) >= strlen($str2)) ? strlen($str1) : strlen($str2);
} elseif (is_string($str1)) {
$max = strlen($str1);
} else {
$max = strlen($str2);
}
return $max;
}
return false;

}


Now again run the test. See whether all the test are passing or not. If not your function may have some issues. Improve the function and again run the test. Do this process until all the test are passing.

The example we discussed was very easy one. But in real applications we have use more complex algorithms and tactics dealing with databases. To check the functionality of the data transaction functions, we can use a test database with some preloaded data. Inside the setUp() function we can create tables and load the data to the test database. As well using the function tearDown() which automatically call after execution of any test method, we can clean the data from the database.

Sometimes applications with MVC architecture have two or more separate layers in Data Layer. In such kind of situation, functions need to test independent from their layers. Lets assume in our application there are two layers in Data Layer. One is data transaction layer which directly deal with the database and other one is data processing layer which process data before or after deal with database through data transaction layer. So, while writing test for a function in data process layer which get some data by calling a function in data transaction layer, we should verify that the correct data set is returned from the function in data transaction layer. To do this we can use Moc Objects.

Lets go through one example.
* getStrings() method in DataTransaction class return an array with two strings (No need of even declare this class)

* getProcessedResult() method in DataProcess class, get the array of two strings by calling the above mentioned function (getStrings()), and return the length of the most lengthy string out of them. This class contain getter and setter methods for use DataTransaction class.
(Declare the getProcessedResult() function and implement getter and setter methods)

<?php

class DataProcess {

private $dataTransaction;

function getDataTransaction() {
if(is_null($this->dataTransaction)) {
return new DataTransaction();
}
return $this->dataTransaction;
}

function setDataTransaction($dataTransaction) {
$this->dataTransaction = $dataTransaction;
}

function getProcessedResult() {

}

}

?>

* Now write the test class using the Moc Object of DataTransaction class

<?php

require_once 'DataProcess.php';
require_once 'PHPUnit/Framework.php';

class TestMoc extends PHPUnit_Framework_TestCase {

var $dataProcess;

// This function calls before any test merhod run
function setUp() {
$this->dataProcess = new DataProcess();
}

public function testGetProcessedResult() {

// Create a Mock Object for the DataTransaction class
// mocking only the getStrings() method.
$dataTransaction = $this->getMock('DataTransaction', array('getStrings'));

// Set up the expectation for the getStrings() method
// to be called only once and with no arguments
// and return value is array("abc", "abcde")
$dataTransaction->expects($this->once())
->method('getStrings')
->with()
->will($this->returnValue(array("abc", "abcde")));

// Set the mocked DataTransaction object to
// DataProcess object using setter
$this->dataProcess->setDataTransaction($dataTransaction);

// Call the getProcessedResult() method on the $dataProcess object
// which we expect to call the mocked DataTransaction object's
// getStrings() method with no arguments.
$this->assertEquals(5, $this->dataProcess->getProcessedResult());

}

}

?>

Here, even we didn't implement (even declare) the DataTransaction class, we could run the test using Moc Object. So that we can test functions independent from the layer it contains and other needed functions.


Setting up test suite

Test suit can be used to mange which test cases should run. We can run even all the test methods in several test cases at once. Test suite can be create as following example code snippet.

<?php

require_once 'PHPUnit/Framework.php';

class AllTests {

public static function suite() {

$suite = new PHPUnit_Framework_TestSuite("PHPUnit");
// Add needed test cases
$suite->addTestFile("MyTestClass1.php");
$suite->addTestFile("MyTestClass2.php");

return $suite;

}

}

?>


With PHPUnit framework the percentage of the functions which covers from the unit tests can be obtained as a coverage report. Following command can be used to obtain a coverage report. (probably you need to install xDebug : http://xdebug.org/docs/install)

$phpunit --coverage-html ./report AllTests.php

From this report we can find out the uncovered code segments. Some of code segments in MyClass.php has not covered from the unit tests. To cover them again test can be implemented.

So, this is a basic idea of how to follow test driven development with PHPUnit framework. Hope this helpful to you.

<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"/> <link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"/> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js" type="text/javascript"></script> <script language="javascript"> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf'; SyntaxHighlighter.all(); </script>

by Chanaka Dharmarathna (noreply@blogger.com) at May 09, 2012 04:21 AM

Ready to walk with GSoC 2012

           I am very happy to say that I have been selected for a project in Google Summer of Code 2012. The project idea is "Refactoring: Display query results" which is under phpMyAdmin organization. In this project I'm going to refactor the code which is related to displaying query results and implement some feature requests.


Short description of my project: 
In current code base of phpMyAdmin, the code for displaying query results is not much reusable. To improve the ability of re usability of the code, I have suggestions to refactor the code with better approaches. The code is going to be improved by applying Object Oriented Programming concepts. Along with that, new features like support for displaying results for multiple queries at once, introducing some more built-in transformations where it is applicable will be considered.

Now I'm ready to walk with GSoC 2012 and hope to do a great job with phpMyAdmin developers and other GSoCERS. :)


My git repository can be found at : https://github.com/Chanaka/<wbr></wbr>phpmyadmin

by Chanaka Dharmarathna (noreply@blogger.com) at May 09, 2012 04:10 AM

May 08, 2012

Yasitha Pandithawatta

Unit Testing with PHPUnit

Hi All. Here I am going to discuss how to write unit tests using PHPUnit. In this post I am listing down the necessary steps  to configure your testing environment. PHPUnit is unit testing software frame work for php programming language developed by Sebastian Bergmann. It is one of the xUnit family of framework.

Set up the environment

PHPUnit should be installed using the PEAR Installer.

Upgrading PEAR

$ pear version<o:p></o:p>
PEAR Version: 1.9.1<o:p></o:p>
PHP Version: 5.3.3-1ubuntu9.5<o:p></o:p>
Zend Engine Version: 2.3.0

If you have version less than 1.9 it is recommended to update the PEAR channel and upgrade the PEAR.

$ sudo pear channel-update pear.php.net<o:p></o:p>
$ sudo pear upgrade-all<o:p></o:p>

Installing PHP Extensions

PHPUnit depends on package pear/XML_RPC2 that requires curl.<o:p></o:p>

$ sudo apt-get install php5-curl<o:p></o:p>

Need to install Xdebug to run the tests and generate code coverage.

$ sudo apt-get install php5-xdebug<o:p></o:p>

Installing PHPUnit

Installing PHPUnit with all dependencies.

$ sudo pear install -a phpunit/PHPUnit<o:p></o:p>

Installing Selenium

Selenium RC integration for PHPUnit.
<o:p></o:p>

$ sudo pear install phpunit/PHPUnit_Selenium<o:p></o:p>

You need to download Selenium Server from the http://seleniumhq.org/download/
You can download the SeleniumIDE which is Firefox plugin that does record-and-playback of interactions with the browser.

In the next post we will discuss how to write your first test case using PHPUnit. Keep your testing environment configured. :)


by Yasitha (noreply@blogger.com) at May 08, 2012 05:27 AM

Write Your First Unit Test Using PHPUnit

Hi All. We will discuss how to write your first unit test case using PHPUnit. If you are not configured your testing environment yet, refer my first post

Unit testing is a method of testing that verifies the individual units of source code are working properly. Normally we are considering a function (method) as our unit of source code.

Assume we are writing a function to add two numbers in class operation.
<?php 
class operation {
public function add($x, $y){
    return $x+$y;
}
}
?>
Copy the above code into a empty text file and name it as operation.php. Now we need to write a test case for function add(); Function add() accepting two parameters and returning the addition of those. So what we have to test is passing two values to the add method and check whether we are getting the expected output.
<?php 
require 'operation.php';
class operationTest extends PHPUnit_Framework_TestCase {
private $operation;
public function setup(){
    $this->operation = new Operation();
}
public function testAdd(){
    $value = $this->operation->add(2,3);
    $this->assertEquals($value, 5);
}
}
?>
Create the operationTest.php file and copy the above code into it. The class should extend the PHPUnit_Framework_TestCase. In function testAdd(), it passes two values for the add method and getting the return value. As we passes 2 and 3 the return valued should be 5. We can verify it using assertions. We used assertEquals() to check the return value and the expected values are equals. If it equals the test will pass. 

Running the Unit Test

Place the above two file in a same folder and run the following command.
$ phpunit operationTest.php

You will get the following.

PHPUnit 3.6.10 by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 3.50Mb
OK (1 test, 1 assertion)

For each test run, the PHPUnit command-line tool prints one character to indicate progress.
.         Printed when the test succeeds.
F        Printed when an assertion fails while running the test method.
E        printed when an error occurs while running the test method.
S        Printed when the test has been skipped.
I         Printed when the test is marked as being incomplete or not yet implemented.
              
Change the expected value into some other value and run the test. You will have test failure. 

PHPUnit 3.6.10 by Sebastian Bergmann.
F
Time: 0 seconds, Memory: 3.50Mb
There was 1 failure:
1) operationTest::testAdd
Failed asserting that 2 matches expected 5.
/var/www/codemix/operationTest.php:15
FAILURES!
Change the method in to some other name and run the test. You will have fetal error.
PHPUnit 3.6.10 by Sebastian Bergmann.
PHP Fatal error:  Call to undefined method operation::sum() in
/var/www/codemix/operationTest.php on line 14.   .............

We can write multiple tests for one method. Add following test method to operationTest.php to test addition of decimals values. 
public function testAddDecimalValues(){
    $value = $this->operation->add(2.5,3.27);
    $this->assertEquals($value, 5.77);
}

Testing Negative Scenario

In good test cases there should be test cases for testing the success scenarios as well as negative scenarios. Add following test cases to operationTest.php. It checks the return value is not equal to a invalid output. 

public function testInvalidOutPut(){
    $value = $this->operation->add(5,6);
    $this->assertNotEquals($value, 10);
}

Keep writing test cases and get them passed. Try following assertion methods. 

assertTrue($x)Fail if $x is false
assertFalse($x)Fail if $x is true
assertNull($x)Fail if $x is set
assertNotNull($x)Fail if $x not set
assertIsA($x, $t)Fail if $x is not the class or type $t
assertNotA($x, $t)Fail if $x is of the class or type $t
assertEqual($x, $y)Fail if $x == $y is false
assertNotEqual($x, $y)Fail if $x == $y is true
assertWithinMargin($x, $y, $m)Fail if abs($x - $y) < $m is false
assertOutsideMargin($x, $y, $m)Fail if abs($x - $y) < $m is true
assertIdentical($x, $y)Fail if $x == $y is false or a type mismatch
assertNotIdentical($x, $y)Fail if $x == $y is true and types match
assertReference($x, $y)Fail unless $x and $y are the same variable
assertClone($x, $y)Fail unless $x and $y are identical copies
assertPattern($p, $x)Fail unless the regex $p matches $x
assertNoPattern($p, $x)Fail if the regex $p matches $x
expectError($x)Fail if matching error does not occur
expectException($x)Fail if matching exception is not thrown
ignoreException($x)Swallows any upcoming matching exception
assert($e)Fail on failed expectation object $e

We will look in to more advanced techniques of unit testing. Write a method, write a test case for that and enjoying by get passing it. :)

by Yasitha (noreply@blogger.com) at May 08, 2012 05:26 AM

May 07, 2012

Thilina Buddika Abeyrathna

First week of GSOC

Officially we have to start our coding 21st of May. Because of my final examination I’ve started my project earlier. This is my first weekly report about the GSOC project. My previous blog post [0] consider about my project in phpMyAdmin and short description about the project.

According to my time line my first week  of GSOC is reserved for complete the documentations and analyzing the phpMyAdmin code related to proposed sections. In my proposal I’ve consider about Insert/edit, Privileges, Operations and Structures sections. So I’ve look at the code base and prepare a some plan for the refactoring with informing Marc(My mentor), specially on Insert/edit section.  And also I’ve referred some document about the refactoring.

And I have spend more time to familiar with the git. My privious experience in git was not enough me to continue the work. So phpMyAdmin team helped me to accomplish this.

My plan for the Insert/Edit section is like this,

  • There is a html form called insertForm in tbl_change.php, in that form there are lot of php, html mix tags. I’m going to seperate this php and implement as several functions. in this form there is a huge for loop also. It should also refactor. other than that there are if statements, loops which are unreadable.
  • Before that form there is a if statement(line-162) which is want refactoring. this one also going to refactoring.

As a start of my coding I’v done some code refactoring for second point. So I’ve committed my changes and Marc has gave me some feedback. And I’ve improved those improvements and committed again [1].

According to the timeline next week I’ve to refactor the tbl_change.php script. So I’v already started that task and it’ll help me to do the refactoring before the allocated time. In next week I’m starting from proposed plan(first point of the above plan). And I’ll start refactoring related scripts to tbl_change.php.

[0] - http://thilinaa.wordpress.com/2012/04/25/gsoc-2012/

[1] - https://github.com/thilinaa/phpmyadmin/commit/6ecaf3e1429a4a0011ba3a913dd55795f00b3cc2

 


by Thilina at May 07, 2012 08:37 AM

April 29, 2012

Alex Marin

NetBeans in Precise Pangolin

Every 18 months, Ubuntu releases a stable version that people and businesses can rely on. Other releases, such as the Oneiric Ocelot I previously used were kind of buggy to the point that I was afraid to do updates anymore. Those updates usually screwed something up that prevented me from working: from the inability to disable the touch-pad, to unexpected log outs or even failure to log in at all after the splash screen. So after I fixed all of those and got it to a point where all I needed worked, I promised myself I won’t do one single update until the next LTS.

And here it is – a few days ago, on the 26th of April, the Precise Pangolin LTS was released and I immediately installed it. It was nice to see that some minor issues that bothered me were fixed, as well as some new improvements, but then again it would have been too much to expect no issues affecting my workflow.

The first problem that I ran into was that NetBeans did not load at all anymore. That really wasn’t cool, because I do all of my work in NetBeans and I didn’t want to start using some other IDE until that bug was fixed. So I looked into it and found that the problem was the failure to link a shared object library, due to the fact that I was using the 32-bit java development kit. So the solution was quite simple: install the 64-bit jdk and point NetBeans to use that one. You can find a bit more details on my post on launchpad.

Hope it saves someone`s trouble.


by Alex Marin at April 29, 2012 08:46 AM

April 26, 2012

Atul Pratap Singh

GSoC 2012.. :)

My project proposal to phpMyAdmin has been accepted for this year’s Google Summer of Code . Around 10 students got selected for GSoC from my college this year.  Marc Delisle, project administrator at phpMyAdmin would be mentoring me throughout the … Continue reading

by zixtor at April 26, 2012 01:50 AM

April 25, 2012

Atul Pratap Singh

My GSoC Project Proposal to phpMyAdmin

Refactoring: Table search, Db search, Multi-table query Atul Pratap Singh Email: atulpratapsingh05@gmail.com Location : Varanasi, India (GMT +5:30) Education : 4th year Undergraduate Student, Institute Of Technology, BHU, India IRC nick : zixtor Github fork : git://github.com/zixtor/phpmyadmin.git Blog :http://blog.atulsisodia.in Synopsis … Continue reading

by zixtor at April 25, 2012 06:57 AM

April 24, 2012

Thilina Buddika Abeyrathna

GSOC 2012

I have been selected for Google summer of code 2012.  And I will be coding for phpMydmin.  My project is a Refactoring project. In that project I’m going to refactor insert/edit, Privilege, Structures, operations sections in phpmyadmin.

Short description:

Refactoring is needed for code base of phpMyAdmin (PMA), because there are a lot of mix of HTML, and PHP tags and ugly code in the code base. In addition, the source code is not structured well. As an open source project, the source code must be highly maintainable because of the number of developers will be involved with this project as a contributors. The main purpose of this project is to improve code readability, maintainability and to reduce the complexity of the code. Further, the understandability of the code will also be improved. In this project mainly focusing on set of sections in phpMyAdmin. Insert/edit, Privileges, Operations and Structure sections will refactoring.

Proposal can be found here : http://www.google-melange.com/gsoc/proposal/review/google/gsoc2012/thilinaa/1

And my git repo can be found : https://github.com/thilinaa/phpmyadmin

Now I have to start working on pma. First I need to familiar with phpmyadmin Gsoc Student guide which can be found here : http://wiki.phpmyadmin.net/pma/GSoC_2012_Student_Guide


by Thilina at April 24, 2012 10:09 PM

Michal Čihař

phpMyAdmins projects in GSoC 2012

There already has been official announcement for this years GSoC at phpMyAdmin and it's time to share my bits. First of all more details about chosen projects are available on our wiki (missing bits will get updated soon).

This year I'll be mentoring again three students. As usual, it was quite tough job to choose students and I hope we've chosen really good ones. Anyway we'll see this later during there summer :-).

As we're currently on a (long) way to phpMyAdmin 4.0, basically all projects are somehow about cleanup and refactoring of quite historical code which lives in some dark places of phpMyAdmin. The only big difference is automated testing project, which is purely about writing new test cases and making tests cover more functionality.

Anyway I'm looking forward to see first improvements from my students - Alex Marin, Yasitha Pandithawatta and Chanaka Indrajith.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at April 24, 2012 02:00 PM

Rouslan Placella

GSoC 2012

This year I have once again been selected to take part in the Google Summer of Code and, again, I will be coding for phpMyAdmin. This year's project is quite ambitious and includes the removal of frames from phpMyAdmin's interface in favour of an AJAX-driven layout, as well as the integration of a new navigation system that I started writing last year.

The proposal that I wrote for this project can be found here: http://www.google-melange.com/gsoc/proposal/review/google/gsoc2012/roccivic/37002

And my git repo can be found on github: https://github.com/roccivic/phpmyadmin
I'll be mostly working in the frames-removal branch, which can be found here: https://github.com/roccivic/phpmyadmin/tree/frames-removal

That's all for now :)

by Rouslan Placella (noreply@blogger.com) at April 24, 2012 12:13 PM

Alex Marin

Status: Approved.

I’ve just found out that I was accepted for Google Summer of Code 2012! Woo-Hoo! :) Well, actually I found out last night, but I ended up celebrating with a few drinks, so I only got round writing about it today.

I’d like to thank the mentors from phpMyAdmin for selecting my application ( phew, it was the only one I wrote :) ), along with 5 other ideas. I’m really excited about starting to work on this project, as well as getting to know the other accepted students.

On a related note, yesterday I also received the Mastering phpMyAdmin 3.4 for Effective MySQL Management book as a prize for the phpMyAdmin contest I took part in last month. Although I do most of my reading at the computer, I prefer printed copies to pdf versions. I’m sure the book will be a good read, as well as a nice souvenir from one of my first contributions to open-source.

A few things I’ve noticed: apparently Google is not good at scaling things :) Really now, the 1-hour-that-seemed-like-1-month wait to get the results was a pretty nasty thing. Second, I’ve seen there were quite a few Romanian students accepted at this year’s edition. I’m really curious to find out how many of them are actually from “Politehnica” University of Bucharest. Anyway, GG guys ;)

To wrap it up,  good things come to those who work hard. If you weren’t selected this year, don’t give up, stick around and try again next year. I’ve recently come across this video which I find highly motivational. It shows a man who deserves nothing but respect: Oscar Pistorius.


by Alex Marin at April 24, 2012 09:42 AM

April 17, 2012

Thilina Buddika Abeyrathna

Create a clone node in HTML using javascript

This method is very important because of we cannot dynamically change the input type(using JavaScript) in HTML for Internet Explorer 8.


by Thilina at April 17, 2012 09:01 PM

April 12, 2012

Michal Čihař

phpMyAdmin needs you

phpMyAdmin is very popular tool, but for whatever reason number of contributors is not that high as you would expect in such famous project. We're not looking only for developers, basically anybody can help!

Working with phpMyAdmin will give you great opportunity to participate in one of most popular free software projects (we're constantly ranked in 20 most downloaded projects on SourceForge.net for many years). You can learn a lot and extend your knowledge by cooperating with other skilled people. And of course you can use this reference in your resume :-).

So how you can help? You can help with translating, writing documentation, creating video tutorials, bug screening or coding. You can see all possibilities in more details on our website.

Filed under: English Phpmyadmin | 2 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at April 12, 2012 10:00 AM

April 10, 2012

Michal Čihař

phpMyAdmin in GSoC 2012

As student application period of Google Summer of Code 2012 is over, it's time to look at proposals we got for phpMyAdmin.

First of all we got slightly less proposals than in past years (38 this year, 52 in 2011 and 68 in 2010). This is probably related to the fact that we heavily focus on code cleanup this year and this is definitely not that interesting topic as adding new features. I think quality has also slightly improved, but still there were few completely bogus applications for totally unrelated projects.

Also as usual, people tend to leave submission for very last date:

Number of applications over time

(and then complain, that they don't have enough time to submit patch as described in our applicant guide).

Quite unsurprisingly the most interesting topic seemed to be frames removal, where we got few really good proposals. You can see how other topics were frequent in following chart:

Number of applications for various types

Please note that the numbers are not 100% accurate as some proposals really did not fit into above categories.

Anyway we're just waiting for last people submitting patches today and evaluation will finalize in upcoming days. Of course you will know the results from Google on April 23rd.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at April 10, 2012 02:00 PM

April 02, 2012

Michal Čihař

phpMyAdmin translations status

phpMyAdmin 3.5 should be released this weekend, so let's look at translations status for last time before release. Here comes seventh round of translation status update.

Since last update we have one more translation and one less (due to some not translated strings in it) summing up to 11 translations at 100%:

  • Czech
  • Dutch
  • English (Great Britain)
  • French
  • Greek
  • Japanese
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Turkish

There are few which are really close to 100% and I hope they will get there till release:

  • Chinese
  • Danish
  • Estonian
  • German
  • Italian
  • Polish

As you can see, there is still lot of languages missing, this might be your opportunity to contribute to phpMyAdmin. Also you are welcome to translate phpMyAdmin 3.5 using translation server.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at April 02, 2012 01:06 PM

March 30, 2012

Alex Marin

Hello World!

This is my first blog, so bare with me :)

I wasn’t really into blogging, I never really had a good reason, but now, an opportunity has risen: posting my progress on the GSoC project I am applying to this year, and also using it after GSoC 2012 finishes, to track my open source contributions.

I am currently applying to phpMyAdmin and I hope they will find my OOP ideas appropriate. In the posts to come, I will write about my progress at that time, as well as other tech-related articles that I might find interesting to approach.

Meanwhile, have a TED :)


by Alex Marin at March 30, 2012 11:18 AM

Michal Čihař

phpMyAdmin in GSoC 2012

You have probably noticed that phpMyAdmin is again participating in Google Summer of Code 2012. This year we don't want to bring dozens of new features like we did in past year, but rather to improve quality and maintainability of existing code. This is all in sync with our plan for phpMyAdmin 4.0.

So if you are student interested in improving phpMyAdmin and have knowledge of PHP (especially with some refactoring experiences), you would be welcome to join us. More information is available in our applicant guide.

PS: Please note that for removal of frames we already have few applications right now, so you might want to focus some other parts to have higher chance to get accepted.

Filed under: English Phpmyadmin | 2 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at March 30, 2012 09:00 AM

March 29, 2012

Michal Čihař

Quality assurance of translations with Weblate

One of features I wanted to introduce with Weblate is ability to do some quality checks while translating. We want contributors to have easy access to translating, but still we need to ensure some quality of translations. That's why Weblate comes with set of quality checks which are performed on every translation unit. The current set of checks (see documentation) is pretty basic and more might be easily added in the future pretty easily.

There are two ways how checks are used in Weblate. During translating, if any of checks fires, translator stays on current translation with warning that something might be wrong. This is not a hard error as he still can be correct, but should at least prevent accidental mistakes like corrupted format strings or missing trailing colon.

The other way is to do review of a translation. Failing checks are shown on each translation page or you can browse them by project to give you overview what can be wrong.

For example with phpMyAdmin this helped me discover that there were few languages where almost half of translated strings are actually not translated but simply copied from English. There were also other problems like inconsistent translations across branches. All in all using these features helped me to improve quality of translations in phpMyAdmin quite a lot and I hope we will keep it for the future.

Filed under: English Phpmyadmin Weblate | 2 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at March 29, 2012 03:30 PM

March 28, 2012

Dieter Adriaenssens

git subtree module

Did you ever want to merge an external git tree with yours, while keeping the commit history? Or do you want to create a new git repository from a folder in your project, keeping the history?

Then the git subtree module is what you need. It let's you import a complete git repo (with commit history) into your project, and add the files to a folder you specify.

For example :

$git subtree add --prefix=other_project \
     git://github.com/your_tree/your_project.git master

imports the master branch of your git repository located in git://github.com/your_tree/your_project.git into the folder other_project.

If you make changes to this imported project and you want to push them back to the original project, you can use this :

$git subtree push --prefix=other_project \
     git://github.com/your_tree/your_project.git master

BTW: the subtree module is not part of the core git package. So if you want to use it, you will have to install the module first.

Download the git subtree module and extract it, or clone it :

$git clone https://github.com/apenwarr/git-subtree

In the git-subtree directory, run

$chmod u+x install.sh

and as root :

#./install.sh

This will copy the git subtree module to the git script folder. You can now use the git subtree module.

by Dieter Adriaenssens (noreply@blogger.com) at March 28, 2012 01:28 PM

March 26, 2012

Michal Čihař

phpMyAdmin translations status

phpMyAdmin 3.5 should be released on April 7, 2012, so let's again look at translations status. Here comes sixth round of translation status update.

Since last update we have two more translations summing up to 11 translations at 100%:

  • Czech
  • English (Great Britain)
  • Estonian
  • French
  • Greek
  • Japanese
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Turkish

There are few which are really close to 100% and I hope they will get there soon:

  • Chinese
  • Danish
  • Dutch
  • German
  • Italian
  • Polish

As you can see, there is still lot of languages missing, this might be your opportunity to contribute to phpMyAdmin. Also you are welcome to translate phpMyAdmin 3.5 using translation server.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at March 26, 2012 02:15 PM

March 23, 2012

March 20, 2012

Thilina Buddika Abeyrathna

ජීවිතෙට ලියපු චාටර්ම XAM එක…

අද මට MID Xam එකෙ subject දෙකක් තිබ්බා ලියන්න. දෙකම කියල වැඩක් නැ… ජිවිතෙ පළමු වතාවට කිසිම දෙයක් දන්නෙ නැතිව Xam එකක් ලියන්න ගියෙ, අඩුම තරමෙ subject code එකවත් හරියට මතක නැ :p
ඉතින් paper එක අතට ලැබුනා. පිටු දෙකම පිරෙන්න ප්‍රශ්න, :( බලුවා දන්න දෙයක් තියනවද කියලා, මොකද මම cal එකත් ගෙනිච්චනෙ ;) ම්හ්…. හරියන්නෙ නැ, මොකුත්ම දන්නෙ නැ, වට පිට බැලුවා, සිර් මම ගැන දැනගෙනද කොහෙදො, පැත්ත පලාතේ අවේ නැනේ,
ටිකක් විපරම් කරල බැලුව මම. මෙන්න බොලෙ මගෙ ලගම සර්පයෙක්, ANACONDA… ඉතිරි ටික මම කියන්න ඔනෙ නැනේ නේද?… :P


by Thilina at March 20, 2012 02:45 PM

March 13, 2012

Michal Čihař

phpMyAdmin translations status

We're heading towards final phpMyAdmin 3.5, so let's again look at translations status. Here comes fifth round of translation status update.

Since last update we one less translation (it was not really complete, the po file missed few strings) at 100%:

  • Czech
  • English (Great Britain)
  • French
  • Japanese
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Turkish

There are few which are really close to 100% and I hope they will get there soon:

  • Danish
  • Dutch
  • Estonian
  • Italian
  • Polish

As you can see, there is still lot of languages missing, this might be your opportunity to contribute to phpMyAdmin. Also you are welcome to translate phpMyAdmin 3.5 using new translation server.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at March 13, 2012 03:30 PM

March 12, 2012

March 11, 2012

Tyron Madlener

Anego CMS reaching stable

I am happy to announce that my CMS is turning into a quite stable piece of software, and I am considering of doing an actual release. So far, one was only able to download the most bleeding edge version from the Github page, which means you've been at the developers mercy whether it works or not ;-)

I've been quite fanatical about features, bug fixing and clean code base lately. In the whole development of Anego I probably spent 30-40% of the time just refactoring the code to be cleaner, faster and more extensible.

Also new are the Gallery and Contact-Form/Mailer module, which should turn out to be very useful for website owners.

Talking about code. Since I love statistics, I've summarized all the lines of code for Anego only, so excluding 3rd party libraries (Smarty, TinyMCE, jQuery, etc. - those probably would add another 30-40k LoC)


ModulePHP LoCJavaScript LoC 
Core System3.908 4.311
Blog501292
Gallery5471.094
Mailer32079
Richtext66135
PlainHTML2963
Separator345
Total5.4055.979
Grand Total
(+CSS/TPL LoC)
13.184


Hint of the day: Did you know, Anego CMS does not send your plain text password when you log in? Before it's sent to the server, a sha256-hash value is generated, which prevents a hacker to read your password, e.g. when your on a WLAN (though replay attacks are still possible).

by Tyron M (noreply@blogger.com) at March 11, 2012 01:01 AM

March 08, 2012

Michal Čihař

l10n.cihar.com switched to Weblate

I've just switched https://l10n.cihar.com/ to Weblate as I think it's stable enough to replace Pootle installation there. This change immediately affects translation of all projects which were done there - phpMyAdmin, Gammu, Wammu, GePeS or Ukolovnik. In addition Weblate itself is also being translated there.

Your old usernames and passwords should be valid (in case you've activated the account and used it in last year), but you might want to adjust your profile as the settings were intentionally not imported (many users had corrupted name in Pootle and hope this will let them fix it).

Let's see how many bugs will this switch reveal, but I expect it will work quite smoothly.

Filed under: English Gammu Phpmyadmin Weblate Website | 1 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at March 08, 2012 01:11 PM

March 07, 2012

Michal Čihař

Contest for phpMyAdmin books

Packt Publishing has offered phpMyAdmin to sponsor some coding contest with books. The contest is already running since Monday and we have first winner, but still, your chances are pretty high.

So in case you are interested in having Mastering phpMyAdmin 3.4 for Effective MySQL Management, go ahead and check out the contest rules.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at March 07, 2012 09:00 AM

March 03, 2012

Thilina Buddika Abeyrathna

Update facebook Fan pages Status From your own site..

Facebook platform enable you to make your web sites more social. Here I’ll explain how to update your Facebook fan page status from your own web sites without direct login to Facebook. 

First we have to create a Facebook application here. And store the App ID and App Secret. 

Sample app creation ..

 

 

Specifying additional App Domains for your app is useful for redirecting users to other servers for geographic distribution of load. And If you’ll create for localhost you can give a localhost site URL for “Site URL” field. No need to give App Domain.


Authentication


Facebook Platform uses OAuth 2.0 for authentication and authorization. While you can add login to your site using OAuth 2.0 directly, the open source JavaScript SDK is the simplest way to use Facebook for login. 

The JavaScript SDK requires that your App ID (or appId). The appId is a unique identifier for your site that ensures that facebook has the right level of security in place between the user and your website. The following example shows how to load the JavaScript SDK once you have your appId:



When the user loads the page in their browser, the JavaScript SDK renders the Login Button on your page.


When the user click login button, the JavaScript SDK will ensure that the user is signed into Facebook and that the request is coming from your website. We then present an authorization dialog in their browser that provides information about your site and the user data you are requesting. If the user clicks Allow, facebook will give your site access to the requested information.


If you need access to more information, such as the user’s email address, etc. you must request permissions for this information. If you can do this by adding the permissions you need to the perms attribute of the fb:login-button like above.


The JavaScript SDK saves the details for the logged in user in a cookie named fbs_YOUR_APP_ID. The following PHP example shows you how to use access this cookie.



Using above function you can get the access_token to enables you to access the user’s information and take actions on their behalf.


Now only you want to do is update the facebook fan pages. It’s simple.. following guidelines will help you


Now using access_token you can get the user’s fan page list(with page access_token)



$data is a jason array like following.



Using $pages array you can access the user’s fan pages using their fan page access_token.

You can use the access token returned for a given Page to perform administrative actions on behalf of the user on that Page


Download the Facebook/php-SDK from here to your source folder.

Following example will guide you to update facebook fan page using php. you need to pass the access_token that your store from above. 



 

If you need more details about facebook applications Go to official facebook developer site.


by Thilina at March 03, 2012 05:50 AM

February 28, 2012

Michal Čihař

Looking for Pootle alternative

For some time, we use Pootle as online translation tool for phpMyAdmin. It is indeed great tool, but somehow we seem to be hitting more and more issues with it and I feel it really won't fit nicely once we will want to support translations on two divergent branches. Also it's code base is not something easy to understand so that I would be able to fix bugs myself without major effort.

So this is when I started to look for alternatives. Unfortunately there is nothing I could find what would work in way I want. I've looked at Transifex, Translatewiki, Crowdin and others whose names I've forgotten and I still haven't found what I'm looking for.

The key feature I want from such system is full integration with git. This means that whatever is changed should be committed to local git branch and merging translations back should be as easy as merging remote branch. I've hacked such thing into Pootle (in quite dirty way), so this is basically workflow we have right now and I'm pretty much happy with that.

Another thing (which seems to be existing in some tools) is support for simultaneous translation of more branches - if same string exists in more branches, it should be translated in all of them. And last but not least, it should support import of po files allowing users offline translation.

Thinking about this I'm starting to thing that it should be pretty easy to implement something what I want using existing pieces of software without major effort. I'll probably start to play with Django, translate-tookit and GitPython to see if I can come up with something working reasonably well in few days...

PS: Anybody working on updated GitPython packages for Debian, looks like I will need them soon :-).

Filed under: English Phpmyadmin Weblate | 10 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 28, 2012 05:00 AM

February 27, 2012

Michal Čihař

phpMyAdmin translations status

With first RC for phpMyAdmin 3.5, we're really close to final release, so let's again look at translations status. Here comes fourth round of translation status update.

Since last update we have three new translations at 100%:

  • Czech
  • English (Great Britain)
  • Estonian
  • French
  • Japanese
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Turkish

There are few which are really close to 100% and I hope they will get there soon:

  • Danish
  • Dutch
  • Italian
  • Polish

As you can see, there is still lot of languages missing, this might be your opportunity to contribute to phpMyAdmin.

Filed under: English Phpmyadmin | 3 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 27, 2012 08:00 AM

February 26, 2012

Thilina Buddika Abeyrathna

That was an our DREAM…

Hanthana hill

@ CP 6

We climbed the Hanthana hill on 23 rd of  Feb. This was an our dream. It was a nice experience for both of us. This photograph took at a one of  highest peak in the Hanthana which is called CP6.


by Thilina at February 26, 2012 06:36 AM

February 22, 2012

Michal Čihař

Secure your phpMyAdmin

phpMyAdmin is quite popular software (to give some numbers let's mention 10000 downloads daily on SourceForge.net or 122685 reports in Debian's popcon) and as such is quite attractive target for various scripted attacks. If you run phpMyAdmin installation somewhere you should really make sure it is enough secured, so that these script kiddies don't get through.

In past month I've looked at what kind of attacks are these guys trying and in all cases these are pretty old vulnerabilities, some of them fixed years ago. So the first thing you should do is to update. It is always good to run latest stable version, but in case you can not for whatever reason, try at least taking the most important fixes and using them.

In ideal world your distribution would do this job for you, but in case it did not, you can for example take patches from Debian, which is pretty good at taking our patches (surprisingly it is not much related to my involvement there). To check which patches they have applied you can use excellent patch-tracker tool, which exposes patches from all released packages.

To give you overview of which issues are mostly being attempted to exploit by script kiddies right now, here is the list:

  • PMASA-2010-3 - yes, more than two years old, but still unpatched in some places
  • PMASA-2011-5 - "only" half year old
  • PMASA-2011-6 - only useful together with wrongly configured PHP

If you have fixed these, you should be pretty safe for now, but follow our security announcements for possible future issues (you can use RSS feed or subscribe to news mailing list, where all security issues are announced as well).

However there are more things you can do to keep you safer:

  • remove setup directory from phpMyAdmin, you will probably not use it after initial setup
  • prevent access to libraries directory from browser, as it is not needed, supplied .htaccess file does this
  • properly choose authentication method - cookie is probably the best choice for shared hosting
  • in case you don't want all MySQL users to be able to access phpMyAdmin, you can use AllowDeny rules to limit them
  • consider hiding phpMyAdmin behind authentication proxy, so that MySQL credenticals are not all users need to login

So these are the basic steps which will help you against possible compromise, I might return to some of these in more details in future posts.

Filed under: Debian English Phpmyadmin Suse | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 22, 2012 05:00 AM

February 13, 2012

Michal Čihař

phpMyAdmin translations status

As phpMyAdmin is approaching to 3.5 release, it has come time to share about translations status. Here comes third round of translation status update.

Since last update we have one new translation at 100%, but one has dropped from the list:

  • Czech
  • English (Great Britain)
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Turkish

There are few which are really close to 100% and I hope they will get there soon:

  • French
  • Danish
  • Japanese
  • Polish

As you can see, traveling around FOSDEM was really useful for Czech translation, which I've managed to complete during that weekend (+ Monday when I traveled to Nuremberg).

There was great amount of work done on Polish translation, so hopefully it will be on 100% in next report. Also Rouslan is progressing quite well on Italian, but there is still fair amount of work to be done.

Was your language not mentioned? It's now perfect time to contribute to it.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 13, 2012 11:00 AM

February 10, 2012

Michal Čihař

Book about phpMyAdmin 3.4

With quite usual delay after release, book Mastering phpMyAdmin 3.4 for Effective MySQL Management has been published.

Unlike the previous edition, I was not doing technical review here, but it is anyway special book for me - the cover photo is coming from me, what is actually for the very first time this has happened.

As usual with Packt opensource books, phpMyAdmin project receives some money for each sold copy of the book, so you're welcome to buy it :-).

Filed under: English Phpmyadmin | 2 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 10, 2012 11:00 AM

February 09, 2012

Dieter Adriaenssens

Fosdem 2012 impressions

Back from FOSDEM 2012 and it was great again. More than 400 talks, about 5000 people attending, spread over multiple devrooms on ULB campus Solbosch in Brussels.


Listing everything I've done and seen is almost impossible, so I'll mention some highlights:

  • Coreboot is now available for a limited set of laptops
  • CERN is using Open Source Hardware
  • Tips and tricks for caching in web development
  • History of Open Source licenses, and other license related stuff
  • Team meeting with phpMyAdmin, outlining the future of the project
  • The talk of Freedombox mentions dreamplug : looks like a nice toy :)
  • Meeting a lot of people, both from my own team, people I've met at GSoC mentor summit, people from UGent and people I haven't met before
  • Community building : what works
  • Why Open Source should get non-geeks involved in their projects
And much, much more.

Looking forward to the next edition already : about 360 days to go. :)

by Dieter Adriaenssens (noreply@blogger.com) at February 09, 2012 08:05 PM

February 08, 2012

Michal Čihař

Migrating code to github

As you might have noticed from my previous posts, we've moved phpMyAdmin code to github. Now I'm going to describe some things which might be useful for you if you are about do to similar switch.

While using git, moving to another hosting provider should be pretty straightforward. Just add another remote, push code there and it should be done. On the other side you probably have dozens of things in your infrastructure which you need to adjust. So the first thing to do is write down what all services are connected to your current git repositories. Let me name some which might be worth checking:

  • continuous integration server
  • snapshots generating
  • demo server (in case you're providing something like we do)
  • commit notifications
  • various statistics services such as cia.vc
  • website generating
  • references in wiki, website and documetation

Once you think you have remembered all important things (the less important will probably show up anyway, but majority of things should work), you're ready to make the move.

I've decided to make the move in few steps. First push all data to new location, what can take some time. I'll get in more details to that later. In the same time I asked all contributors to give me their login information, so that I can allow them access to new repositories. Once all recently active developers were migrated, it was time to push all remaining commits to new git repositories and make the switch for real.

Pushing git repo to another location, should be pretty easy. On the other side if you have many branches, it get's slightly more complex, I've ended up with following shell snippet (pushing all branches present in origin to github remote):

git branch -r | grep origin/ | grep -v HEAD | sed 's@.*/@@' | while read b ; do git checkout $b ; git push github $b:$b ; done

Please ensure that you check output of this, because you may hit network problems somewhere in the middle and you end up with few branches than you expect. As the code is pretty much idempotent, you can safely run it several times until there is nothing to push. You should also push all tags to new location:

git push --tags github

Okay, we've all data on right place, so let's switch all our users to new location:

git remote set-url origin git@github.com:phpmyadmin/phpmyadmin.git # read/write
git remote set-url origin git://github.com/phpmyadmin/phpmyadmin.git # read only

Of course everybody has to do this manually.

Next good thing is to let people know when they are using wrong repo (which will stay there for some time). Unfortunately there is AFAIK no way to warn them on pull, so let's warn at least on push:

$ cat > hooks/update
#!/bin/sh
echo "phpMyAdmin git repositories have moved to https://github.com/phpmyadmin"
exit 1

I think this is pretty much all. You can find some more bits in our Git migration wiki page.

PS: Thanks to github for offering us hosting and sorry for breaking their branch displaying page by too many divergent branches.

Filed under: Coding English Phpmyadmin | 4 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 08, 2012 11:00 AM

February 07, 2012

Michal Čihař

phpMyAdmin is now at github

I've just updated phpMyAdmin repos on github and enabled notifications hooks there, so the earlier announced switch to github is done.

All you need to do is point your repositories to pull/push to github, for main repository it can be done using:

git remote set-url origin git@github.com:phpmyadmin/phpmyadmin.git

If you are using just read only access then use following:

git remote set-url origin git://github.com/phpmyadmin/phpmyadmin.git

For other repositories just replace last part of the URL with repository name (they have not changed).

Everything should work as before, pushes should be now faster, because all notifications are done in background on github and they don't block pushing.

Filed under: English Phpmyadmin | 2 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 07, 2012 02:04 PM

February 06, 2012

Michal Čihař

Back from FOSDEM

Yet another FOSDEM is behind us and I'd like to thank all people organizing it. It was a great event as usual.

This year there were some changes - the conference grew and there was an extra building. This is great, but on the other side, there were more tracks to follow and occasionally I wanted to be in four places at once, what is of course not manageable.

Combined with quite freezing weather (well it was still much warmer than it is now in Prague), moving from one side of campus to another was not that comfortable as in last years, but there is not much man can do with that.

And the biggest change for me - I did not manage beer event this year. We enjoyed great team dinner on Friday evening and while it ended, I was too lazy to move to crowded beer event and rather enjoyed bed in my hotel.

Filed under: Debian English Phpmyadmin Suse | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 06, 2012 07:45 AM

February 05, 2012

Michal Čihař

phpMyAdmin goes github

Yesterday we did held phpMyAdmin team meeting and we discussed several things for project future. One of discussed things was to move our repositories to github for easier collaboration and management of private repositories.

After some discussions we've decided to go for it. As I write this blog, all repositories are being pushed there and once all developers will get their access rights there, we will move completely.

But even right now, you can fork us on github, the code is already there and will be updated obsessionally until we fully move there.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 05, 2012 09:28 AM

February 04, 2012

Michal Čihař

Enjoying FOSDEM

Again, as usual in last few years, I'm spending first weekend in February in Brussels, where FOSDEM is happening.

This year we've again decided to do make this team meeting for phpMyAdmin, so people from five countries and three continents came to one conference to discuss future development and other stuff.

But of course this is not only thing I'm going to do here. I came with openSUSE folks, where we've brought lot of beer, some DVDs and hardware to show. You're welcome to check it out.

And of course there is about 430 talks to visit during weekend :-).

Filed under: Debian English Phpmyadmin Suse | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 04, 2012 10:11 AM

February 03, 2012

Dieter Adriaenssens

Fosdem 2012

The yearly meeting of Free and Open Source Software Developers and enthousiasts is about to start. This weekend about 5000 people will come to Brussels for FOSDEM, to attend presentations, meet people and share knowledge.
I intend to go as well, if my health allows : I was hit by a virus in the beginning of this week and I am still recovering.
Anyway, apart from a lot of talks and presentations I want to go to, there is also a team meeting planned of my project, phpMyAdmin. And, at some point, I hope to run into some people I met at GSoC mentor summit last year.

by Dieter Adriaenssens (noreply@blogger.com) at February 03, 2012 04:44 PM

February 01, 2012

Tyron Madlener

Why the phpMyAdmin Status Monitor is awesome

So today I checked out my vServer performance using the phpMyAdmin Status Monitor that I have coded last summer, because a user notified me that a certain webpage doesn't load.
I couldn't figure out the problem as the site loaded normally for me and the server wasn't overloaded, however somehow I ended up hammering on the refresh button in the server tab to check what MySQL processes were running because it was fun and interesting.


So then one process did appear that was currently sorting the results of a query. It looked like a candidate for optimization. So I threw it into the query analyzer.



My assumption turned out to be correct. This query is used to determine when the visitor last visited the website, and it took 0.3 seconds to execute. It happens to be run on every page visit on of my websites.

So, being already in phpMyAdmin, I head over to the table in question and add an index for this field.

ALTER TABLE `cc_counter` ADD INDEX ( `ip` )

Now lets run this query again:


Well that sounds much better doesn't it! From 300ms to 0.8ms. Around 375 times faster now. While we're at it, we might as well write this query correctly.


As we only require the newest visit it is enough find MAX(time) of the visitor in question. Another 40% faster, which results in a speedup of around 525 times compared to the original.

So we not only saved ~0.3 seconds of loading time per visit but also reduced the required CPU time allowing greater workload on the server.

If you are running whatever self written code on your servers or webspace, get the new phpMyAdmin 3.5, check out your database load and optimize your queries. It's very gratifying work ;-)



P.S.: I'm aware that this might be an exceptional case, since a well designed database layout would have proper indexes from the very start. Nonetheless the Status Monitor is a great tool for surgical improvements on bad code like this one. Also in projects that slowly grow over time the chances are not too low to miss out on creating an index where it would be needed.

by Tyron M (noreply@blogger.com) at February 01, 2012 08:23 PM

Michal Čihař

How not to ask questions

First of all, take this blog post as a rant from developer. I don't expect that this will change anything in how people ask me questions.

Anyway before you write me email with some questions, please check following easy bits:

  1. Have you tried to write your question into Google?
  2. Most projects have documentation, have you looked at it?
  3. There are mailing lists or discussion forums, do you really need to write directly to me?
  4. Writing subject like "!important" or ALL IN CAPS will work other way than you probably expect.
  5. Yes I have more email addresses, that does not mean you should write to all of them.

If you do follow these basic rules, you might get more help than usual. If you are interested in knowing more, there is famous How To Ask Questions The Smart Way which will tell you more information than I did in this rant.

Filed under: English Gammu Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at February 01, 2012 11:00 AM

January 31, 2012

Michal Čihař

phpMyAdmin translations status

As phpMyAdmin is approaching to 3.5 release, it has come time to share about translations status. Here comes second round of translation status update.

Since last update we have two more translations at 100%:

  • English (Great Britain)
  • French
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Turkish

There are few which are really close to 100% and I hope they will get there soon:

  • Danish
  • Japanese

Just on next level is Czech, where I'm progressing quite slowly and would welcome help :-).

There was also great improvement in Romanian in past week so I hope we will see it soon on top of the list as well.

Was your language not mentioned? It's now perfect time to contribute to it.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at January 31, 2012 09:30 PM

January 24, 2012

Michal Čihař

It's too early for GSoC 2012

It looks like with start of the new year, people started to ask for phpMyAdmin's projects for GSoC 2012. Given that we have no information whether there will be Google Summer of Code this year and whether we will be chosen to participate, these questions look quite premature.

On the other side you can start contributing any time and if you are already known in the community, you might have better chance being accepted. So forget speaking about hypothetical GSoC projects for now and start fixing some bugs, which is something much more needed right now (given that 3.5 is in alpha state).

If you are looking for more information, we have basic facts for developers on our website, there is also a wiki page mentioning some tasks for junior developers.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at January 24, 2012 04:00 PM

January 20, 2012

Michal Čihař

More on Flattr

My last post about Flattr has received much more attention than I would expect from short rant, but the feedback forced me to think a bit more about the issue.

I guess that most of Flattr early adopters jumped in for getting some money for things they produce (regardless it is music, text, software or anything else). The initial setup required users to also give money to others and this limitation was later removed and now you can only receive money without giving anything out. In the beginning every now and they I've discovered some interesting thing to flattr, so I usually had to postpone it to next month to give at least some reasonable value. This way initial money people have put there circulated between users and on each transaction they were reduced by 10% fee, what could lead to natural reduction of money available in the system.

Flattr is of course trying to introduce new features to attract new users. Flattr-a-Twitter is probably nice thing, however I somehow did not really get on Twitter train and I think I never will. The new catalog looks nice, still I don't think I will spend time browsing it and looking for content there. So basically this adds nothing useful for me.

Another recent feature - thanking to people who have flattered your thing in last month is IMHO bad idea. I've always seen Flattr as simple way to give little money to lot of various things. In case everybody would send thank you email, it would become every month spam, which I would simply ignore.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at January 20, 2012 05:00 AM

January 19, 2012

Michal Čihař

phpMyAdmin translations status

As phpMyAdmin is approaching to 3.5 release, it has come time to share about translations status. Same as with past releases, you can expect this "spam" every week or so.

The 3.5 release comes with lot of new strings, so it's some work to get to 100%. However some translators have already managed this and we currently have five translations on 100%:

  • English (Great Britain)
  • Russian
  • Spanish
  • Swedish
  • Turkish

There are few which are really close to 100% and I hope they will get there soon:

  • Danish
  • French
  • Japanese
  • Slovenian

Just on next level is Czech, where I'm progressing quite slowly and would welcome help :-).

Was your language not mentioned? It's now perfect time to contribute to it.

Filed under: English Phpmyadmin | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at January 19, 2012 11:00 AM

January 13, 2012

Michal Čihař

Looking forward to FOSDEM

I just got confirmed my flight bookings for FOSDEM 2012, so I'm looking to meet all great people there again. This year we've again arranged there meeting of phpMyAdmin developers, now it also includes three new faces from last years GSoC.

As for my schedule I did not yet find time to check all the schedule, but what definitely sounds interesting for me is Open Mobile Linux Devroom and some talks in MySQL and Friends Devroom. Rest will be (as usual) scheduled on the fly as I meet people there. This year I decided to deliberately skip keysigning as last year I anyway did not manage to attend it and I expect this year to be equally busy.

In case you want to meet me there, just let me know, we can try to arrange something in free slots :-).

Filed under: Debian English Gammu Phpmyadmin Suse | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at January 13, 2012 11:00 AM

Looking forward to FOSDEM

I just got confirmed my flight bookings for FOSDEM 2012, so I'm looking to meet all great people there again. This year we've again arranged there meeting of phpMyAdmin developers, now it also includes three new faces from last years GSoC.

As for my schedule I did not yet find time to check all the schedule, but what definitely sounds interesting for me is Open Mobile Linux Devroom and some talks in MySQL and Friends Devroom. Rest will be (as usual) scheduled on the fly as I meet people there. This year I decided to deliberately skip keysigning as last year I anyway did not manage to attend it and I expect this year to be equally busy.

In case you want to meet me there, just let me know, we can try to arrange something in free slots :-).

Filed under: Debian English Gammu Phpmyadmin Suse | 0 comments | Flattr this!

by Michal Čihař (michal@cihar.com) at January 13, 2012 11:00 AM