Fri, 10/02/2009 - 15:08
Hi there again! I’ve been silent again on my blog, but didn’t rest on development. In the one and a half months since the last digest, I started writing a PHP application This finally made me eat my own dog food :). It resulted in lots of polishing and quite a few bug fixes for the PHP plugin in KDevelop. Here’s a list of what I think are the notably changes since the last digest:
(Note: to view screenshots, go to the bottom of this article.)
- refactoring of parts of the Code Completion code, should already result in faster code under certain situations
- properly mark constants as “Kind: Constant” in the declaration tooltips
- offer argument hints for ctors during code completion in class init statements
- greatly improve the generate inline documentation of built-in PHP functions, classes, properties etc. pp.
- add documentation of public properties
- support aliased functions (thanks to Victor Grischenko for his patch)
- show more/all documentation, and not only the first paragraph
- fix type-lookup
- don’t get confused when a documentation file documents both, a method and a function (greatly improves e.g. MySQLi documentation)
- don’t offer “jump to declaration” for built-in PHP declarations
- add support for
- cleanup code-completion list, esp. show the return type of functions in the prefix field, and not something a la “function ReturnType ($arg1, $arg2, …)”
- improve the code-completion for include/require statements
- add language constructs to code completion (e.g. class, while, foreach, print, …)
- show declaration tooltip for magic constants, showing their current value
- make functions, methods and classes case-insensitive, just like PHP handles them
- some performance improvements, especially in code completion and parsing of the generated file containing php-internal declarations
- lots of bug fixes, don’t want to iterate them all ;-)
I created a Flickr account and will push screenshots to it for every upcoming digest I do. To see some of the features I talk about above, visit: http://www.flickr.com/photos/milianw/sets/72157622375662249/detail/
EDIT: A note to those that want to try this out , but cannot / don’t want to compile it: I heard that there is / will be an AUR package for Arch users available. And I’d really appreciate it if others could create packages for their favorite distribution as well. You’ll need bleeding-edge kdevplatform + kdevelop though!
Thu, 09/03/2009 - 18:36
Today I want to abuse the fact, that my blog is aggregated on some planets, to bring a project of a friend of mine into the spotlight:
The Linux-Minidisc project
It’s a project to bring Read/Write access on mini discs to Linux. It consists of a CLI and a Qt Gui. All code is licensed under the GPL and can be accessed via Git.
To get a nice introduction about the project, read this excerpt from a recent Linux Journal edition: http://users.physik.fu-berlin.de/~glaubitz/minidisclj.pdf
The project itself has a wiki under the following address: https://wiki.physik.fu-berlin.de/linux-minidisc/doku.php
As every other FOSS project, Adrian and his fellow developers need more man power. Especially someone who can spruce up the Qt GUI is needed. Help them!
Sun, 08/16/2009 - 01:24
So, after a period of silence I present you an unsorted list of features and bug fixes I did to the PHP plugin for KDevelop in the last few weeks:
added support for path autocompletion after require / include statements: This shares code with the Cpp plugin and it’s completion after #include. I plan to use this autocompletion eventually also for functions accepting filenames or paths. Think of fopen, file_get_contents etc. pp. So far only URLs that are covered by an open project can be completed. We will need support for custom include paths so we can support e.g. global PEAR or framework installations.
worked around a bug where the “schedule all project files for parsing” had no affect. Apaku is currently working on making some internal changes so I can remove the workaround and fix this properly. With this fixed/worked around you should retry the PHP plugin along with frameworks or similar to see how well it works. Just make sure to have the framework inside your project so it gets parsed.
fixed code completion of static class members for classes that where not defined in the current file
by sharing code with the cpp plugin I made it possible to show information about includes on hover. You can open the file from that popup or just see what classes, functions, variables etc. are defined there and jump to them quickly.
report errors when the user tries to include a directory
totally rewrite a huge part of the code completion: It now utilizes the token stream and can hence work much more reliably. Also the code is much cleaner in my opinion and it should be easier to extend its functionality. If you spot places where you think no code completion should happen or vice versa, please report that to me!
don’t crash on empty includes (i.e.
ignore xml declarations (i.e.
<?xml ... ?>)
support implicit declarations of referenced arguments, esp. important for e.g.
preg_match("#...#", $string, $matches);, before the
$matcheswas said to be undefined. Additionally references should be marked and shown as such now in the popups of e.g. function arguments.
support implicit array declarations, e.g.
$a = 1; // now $a is an array
fix bug which made the class browser not aware of changes in PHP class structures. Now we can see new classes, methods and members directly after writing them in a PHP file.
/// commentsyntax for doc-comments, especially useful for type hints of variables.
report error when someone tries to declare a class constant with an invalid type (i.e. not bool, int, float or string)
I’m very happy to say that we seem to get more and more (happy) users!
Wed, 05/27/2009 - 21:09
Has been a time since I wrote the last update for PHP / webdevelopment related work in KDevelop4…
First of all, Niko (nsams) is working diligently on the general debugger framework for KDevelop4. Of course gdb is still the main focus so far yet he always has his XDebug plugin (which is currently unusable) in mind. So expect some great debugging features once he’s done with the framework.
Another thing I’ve not yet written about is a bunch of commits I did just after the Hackaton: Remote Projects! Yes, finally you can work directly on the server with KDevelop. I still have to make sure that the user does not try to open a remote cmake project (or similar), because that is of course not supported. Only the Generic Project Manager (basically a list of files in a dir) works. There’s for sure some things to polish, yet I’d like to see user feedback for that use-case at least.
Note: There is still some functionality missing in other areas, like creating a new remote project from a template etc.
Out-of-class declarations of member variables
The PHP plugin itself got support for some more code, like declarations of members variables outside the class context which was reported by one of our early adopters (hint hint - do the same! we need more wishes and bug reports!).
Additionally I changed the logic of our DeclarationBuilder so it does not create a new variable declaration for each assigment expression. I think this makes refactoring, use-highlighting etc. in a PHP environment much better for many cases. Sadly it is not yet perfect since we still need to redeclare variables when their type changes. Fixing that would require potentially big changes to the DUChain and I’m not sure when it will happen.
Furthermore I’ve added some more inline error reportings, namely for redeclaration of
$this in a class context. This is also an area where you might help us a lot: Send us PHP snippets which fail when executed but are not yet highlighted in the editor. I’ll try to add them then. Just use the bugtracker on http://bugs.kde.org.
Also David (dnolden / zwabel) of Cpp-KDev4 fame made some changes which resulted in a good performance win. Thanks!
Tue, 03/03/2009 - 00:28
Hello Planet KDE!
I want to give you a little insight on the current state of PHP support in KDevelop4:
Me and Nikolaus Sams (nsams) are working diligently on a plugin for PHP support in playground. It’s somewhat stable, i.e. we fix any crashes we stumble upon, but I would call it Alpha state at most. It may eat your babies so to speak. Yet I’m happy to say that at least one user is already using it for production (hi leinir ;-) ).
implemented PHP support
Well, here’s a (not complete) list of features that are already working. Though I have to warn you: no screenshots included ;-) It’s actually all very similar to the C++ screenies you can see on the web.
Let’s start with a feature that only very recently was added for PHP - semantic highlighting. Niko moved some language independent parts of the C++ plugin from KDevelop to KDevplatform and now PHP has the same code highlighting features as C++.
I personally love this feature since it makes it even easier to grasp code and it makes the code highlighting more consistent since there is no visual difference between PHP built-in functions/constants and your own.
Arguably one of the most useful features the DUChain enables us to write is code completion. There’s already full support for:
- PHP built-in functions, classes, constants, superglobals
- user-defined functions, classes, constants, superglobals, variables, etc.
- proper code completion for objects which respects access modifiers (private, public, protected) and differentiates between static/non-static members and methods
- code completion for overridable and implementable functions inside classes
- hints in the argument list of function- and method class
- sane code completion after keywords such as “extends, implements, catch(), new, throw” and some more I think
There’s still some bugs to fix and a few features to implement. But I can easily say that even the current state of code completion makes one wonder how he could use Quanta (from KDE3 times) for such a long time! It’s simply nothing compared to this!
The next feature I hope to add is support for type hinting in function calls. I.e. only show arrays where arrays are requested and the same for objects of a given type. Also no PHP keywords are currently completed at all…
other DUChain/UseBuilder stuff
Thanks to the DUChain you already get lots of information about declarations, such as uses (which files, which lines etc.). Also very neat is the hover popup you might now from C++ which among others shows you phpdoc comments inside your browser. I also plan to integrate the php.net documentation into KDevelop, similar to what is already possible for QtHelp.
inline validation / syntax checking / linting
Another feature which saves lots of time is on-the-fly syntax checking: You won’t have to fire up your web-app inside a browser just to be greated by that pesty “syntax error, unexpected ‘CHAR’ in FILE on line XYZ” message… No! Instead you will see a nice reddish zig-zag line where you made the error and can fix it before heading off to the browser.
But we don’t only do basic syntax checking. We do more than that, thanks again to the power of the (holy?) DUChain. You can spot undeclared variables, function/method/class/constant redeclarations and more. Actually I hope that one day we spot most of the notices, warnings and errors PHP could emit.
We already have a multitude of regression tests which will make sure that we don’t mess up any existing stuff. Lets hope for even more of them :) I love test-driven development.
Well, thats pretty much it for the moment. You can have a look at what we are up to at the Quanta Feature plan on techbase.
If you are a PHP developer and can write C++ with Qt, why not get in touch with us? You can find us both on the KDevelop mailinglist and at least me and leinir are often found in #kdevelop on freenode.
Let me finish with a quick introduction of myself:
Some of you might now my from the LinuxTag in Berlin where I could be found at the Kubuntu-De.org community booth. At least with some of you I had a beer (well, I doubt it was only one). I hope to repeat this tradition in 2009. Every once in a while I can also be spotted at ubuntu-berlin events.
Tue, 02/24/2009 - 22:58
NOTE: This script is apparently against the licensing contract between universities and Springer, see: http://www.bib.hm.edu/aktuelles/news/newsdetail_9984.de.html
NOTE 2: I do not maintain this script anymore. Please look for an alternative.
That script has some quirks, the greatest of all that it was written in bash which makes it kind of hard to implement new features. And one which was requested was support for books which span multiple pages on SpringerLink.
So here I present
springer_download.py - a Python rewrite which should handle all the old links and some more. This is the very first program I’ve written in Python. And since it has to run on the Zedat servers it’s limited to Python 2.4.x without any fancy shmancy additions (a pity, since I’d love to use urlgrabber or pycurl).
I plan to put all my future code snippets in public repositories on GitHub. That way you can easily track changes and stay up to date. GitHub also has a nice “download” feature which you can use to get the current version. You can find my profile and my repositories at http://github.com/milianw
Note: This script is intended to be run under Linux or other *nix’es which fulfill the requirements (Python 2.4.x, iconv and pdftk). Windows is not supported.
- introduce multithreading for faster / simultaneous downloads
- add speed to progressbar
- use progressbar in source-downloader
- use one git-repo per project (makes links work properly)
Sun, 02/03/2008 - 21:18
I’ve just released a second Markdownify Beta with better PHP 4 support and some other small bug fixes. You can download it from sourceforge.
Sun, 10/07/2007 - 22:08
This is the first beta release of Markdownify - the HTML to Markdown converter for PHP.
It is very stable and should handle nearly all features of Markdown and Markdown Extra syntax. Missing are only two things:
- “Markdown inside block elements” for Markdownify Extra
- word wrapping
These two things will be added before the first “stable” release. Additionally some performance improvements will hopefully be added.
You are encouraged to use this release in your web applications. Please let me know if you find any bugs. Also a code review by anyone would be very much appreciated!
html2text.php is now history, long live Markdownify!
Fri, 09/14/2007 - 03:31
Yes, I’m finally gearing towards the release of my
html2text.php successor, dubbed Markdownify. I’m using exessive testing and utilize the MDTest suite to find potential regressions etc. I’m really enjoying to program little CLI scripts with PHP, it just works like a charm.
Here’s an example of how my test suite currently looks like:
To the left is the original input (HTML), in the middle you find the generated Markdown and to the right HTML again - but now generated via PHP Markdown by Michel Fortin. The pretty colors mark changes between the two HTML versions. I use PEAR Text_Diff for this and a little of my own code. But since all of the existing diff engines for Text_Diff took ages for the Markdown Documentation (~400 lines afair), I wrote a Text_Diff engine which utilizes
shell_exec() and GNU diff. This is blazingly fast and works like a charm! You can get the source code over at pastebin.org. Also take a look on the feature request I made. Dunno if this was the correct place for that…
Update 1: My work got submitted into the PEAR repository. To obtain the up to date source code, please head over to
shell.php in Horde’s Web CVS.
Yay, my first contribution to a PEAR project :-)
Update 2: The official Markdownify website launched! Take a look, download it and convert your HTML today.
Wed, 05/16/2007 - 14:04
A few days ago I started a complete rewrite of html2text. It now uses a new htmlparser (also written by me) which should make the whole HTML cleanup process obsolete. The generic XML parser which is currently used dies on invalid XHTML, with my parser it should be possible do handle errors and parse HTML 4.01 documents without any regex magic beforehand.
You’ll hear more of this in about a week as I’ll be on vacation until the 24th.