Programminghttp://schlitt.info/opensource/blog/programming.html
ProgrammingenCC by-nc-saTobias SchlittTobias Schlitt <toby@php.net>Thu, 19 Sep 2013 06:37:18 +0000Thu, 19 Sep 2013 06:35:38 +0000eZ Components Feed dev (http://ezcomponents.org/docs/tutorials/Feed)http://www.rssboard.org/rss-specificationPython. Good, bad, evil -3-: Flow control exceptionshttp://schlitt.info/opensource/blog/0724_python_good_bad_evil_03_flow_control_exceptions.html
My grandma is a wise lady. She told me many useful mantras which I should repeat every night before going to bed. One of these is <strong>Never use Exceptions
for flow control</strong>. And she is so right with this. It is even so true, that every <a href="http://en.wikipedia.org/wiki/Object-oriented_programming">OOP</a> newbie should get this mantra tattooed on his hand. During my experiments with <a href="http://en.wikipedia.org/wiki/Python_%28programming_language%29">Python</a> I sadly found it violated in a central place: When it comes to implementing an iterator.
Tobias SchlittThu, 01 Apr 2010 07:21:47 +0000Python. Good, bad, evil -2-: Native setshttp://schlitt.info/opensource/blog/0722_python_good_bad_evil_02_native_sets.html
One thing I really liked in Python is the data structure <code class="inline">set</code>, which is built into the language core. A set in Python is defined as known from mathematics and beside mathematical use cases, it is helpful in everyday programming live. In this episode of my series on Python, I give you a short insight into how sets work in there, how you can achieve similar results in PHP and why I like the Python approach.
Tobias SchlittThu, 18 Mar 2010 16:51:15 +0000Python. Good, bad, evil -1-: Missing bracehttp://schlitt.info/opensource/blog/0720_python_good_bad_evil_01_missing_braces.html
Every programmer should learn a new programming language once in a while. Be it for inspiration or just for fun. After some homework in C# some years ago and quite some Java at university (again), Python was my language of choice. This is the first article in a series I plan to write about what I like in Python, what is disturbing but works out and what is really evil. In this article I give a short overview on my motivation to dig into Python and start with a first topic: The missing braces.
Tobias SchlittSun, 21 Feb 2010 08:33:55 +0000PDV → VIP, now on github!http://schlitt.info/opensource/blog/0719_pdv_vip_now_on_github.html
phpDocumentor for VIM (PDV) is a project which resulted from my efforts to create a <a href="/opensource/blog/0543_comfortable_php_editing_with_vim_6.html">comfortable programming environment for PHP in the VIM editor</a>. Since the server which hosted the SVN repository is to be switched off the next days, I finally <a href="http://github.com/tobyS/vip">moved development over to github</a>.In addition to that, I seized the chance to rename the project itself to VIP (VIM integration for PHP). The repository does not only contain the PDV script iself, but also a filetype plugin for PHP, some useful color schemes, a PHP skeleton file, settings for other (related?) programming languages and more.
Tobias SchlittTue, 16 Feb 2010 07:35:26 +0000Heap, heap, hooray!http://schlitt.info/opensource/blog/0718_heap_heap_hooray.html
I recently had the problem that I wanted to retrieve the smallest items from a stream of data. When talking about a stream here, I refer to a data set that I do not want to load into memory completely, since it has quite a few elements. The best way to process such data is a stream approach, where you work always on a single item at a time, iteratively, without loading the full data set.In my special case, I had a database with 140,000 records. The processing of these records could not happen in the DB, since I needed to create vectors from text and perform calculation on these. Basically, I needed to check each vectors distance to a reference vector and keep only the k closest ones.So, what is a good approach to solve such a task? I decided to implement a custom data structure based on a <strong>max heap</strong> to solve the problem. In this article, I present the solution and compare it to two different other approaches in terms of a small benchmark.
Tobias SchlittSat, 06 Feb 2010 11:10:40 +0000eZ Components Open Bookhttp://schlitt.info/opensource/blog/0713_ez_components_open_book.html
<strong>Attention</strong>: This blog post is in German, due to the fact, that the book is also in German. In short: Kores and my book about eZ Components can now completely be found <a href="http://openbook.galileocomputing.de/ez_components/">online</a>, for free. Das von Kore und mir verfasste eZ Components Buch, gibt es jetzt als Open Book <a href="http://openbook.galileocomputing.de/ez_components/">komplett online zu lesen</a>.
Tobias SchlittMon, 21 Sep 2009 06:08:50 +0000Scalar type hints in PHPhttp://schlitt.info/opensource/blog/0712_scalar_type_hints_in_php.html
Ilia recently brought up the topic of scalar type hints again. I would love
scalar type hints, but a sensible implementation is not easy. I summarize some
approaches in this post and talk about the problems they raise.Tobias SchlittThu, 02 Jul 2009 08:29:54 +0000An awful lot of files in SVNhttp://schlitt.info/opensource/blog/0710_awful_lot_of_files_in_svn.html
Derick was always bitching at me when doing releases for the huge amount of
time needed to process the Webdav components sub directory. We always
supposed, that the Subversion performance issues here resulted from the
Webdav test suite, which consists of an awful lot of small test files and
some sub-directories. I finally found the time to refactor the tests and
the performance improvement is astonishing.Tobias SchlittWed, 03 Jun 2009 23:07:22 +0000Defining a frameworkhttp://schlitt.info/opensource/blog/0709_defining_a_framework.html
At this weeks IPC, I attended the talk "Framework? No thank you, I will use
my own!". In this article I take up my controversal thesis, that it might
be wise to create your own framework, and explain my view in detail. In
addition, I analyze, what a framework actually is and how it is typically
seen in the PHP world. Do you use an OSS framework? Or did you build your
own?Tobias SchlittSat, 30 May 2009 21:09:53 +0000GOSUB for PHPhttp://schlitt.info/opensource/blog/0705_gosub_for_php.html
Since version 5.3 PHP supports the GOTO statement. While this statement is useful to solve daily programming tasks like implementing finite state machines, it has some serious drawbacks against other programming languages that support the structured programming paradigm. Therefore the PHP core developers decided with one voice to enhance the language by a GOSUB statement.
Tobias SchlittWed, 01 Apr 2009 09:10:21 +0000