PHP scales well

I think PHP scales well because Apache scales well because the Web scales well. PHP doesn’t try to reinvent the wheel; it simply tries to fit into the existing paradigm, and this is the beauty of it.

Read on shiflett.org after a small pointer by Slashdot into the right direction. This guy really knows what he is writing – or at least it seems to me as I think exactly the same way as he does (which is a somewhat arrogant way of saying things, I suppose :-)).

WinInet, Proxies and NTLM

For quite some time now I heard about customers telling me that PopScan seems to be having problems with proxy servers using NTLM authentication. I knew that and I told everyone that this is not supported.

But I could not understand it: Why did it not work. I mean, I went from my own HTTP-Routines to WinInet just to be able to use the system-wide proxy server settings and connections

When using WinInet and INTERNET_OPEN_TYPE_PRECONFIG with InternetOpen, the whole thing is supposed to just work – as long as IE itself does work. But in my application this wasn’t the case and I had no idea why. As soon as NTLM was enabled at the proxy, I was just getting a 407 HTTP_PROXY_AUTHENTICATION_REQUIRED status from the proxy, despite the correct password being used

MSDN was of help (taken from the documentation of InternetOpenRequest):

If authentication is required, the INTERNET_FLAG_KEEP_CONNECTION flag should be used in the call to HttpOpenRequest. The INTERNET_FLAG_KEEP_CONNECTION flag is required for NTLM and other types of authentication in order to maintain the connection while completing the authentication process

I’ve added this flag (and some more – now that I already was at it), recompiled, tested and -yes- finally it does what it should: It works just out of the box. No more 407, no more entering password for the users. One more thing that switched its state from “not supported” to “supported and working splendidly”.

This is with a NTLM-enabled Squid Proxy, but it should work with Microsoft ISA too.

Web Applications and the View State

Today, it came to my mind, that I know of a problem with some web applications, which apparently few else seem to know about. What is worse, is that those new technologies like ASP.NET and Java Server Faces seem to run straight into the problem.

This article is even bigger than the usual, so I split it up.
Continue reading “Web Applications and the View State”

Eclipse, CVS and putty

I’m a really big fan of Eclipse. This Java-IDE has many great features I have never come across in other IDEs so far. The new context based syntax-highlighting comes to mind (it analyzes your sourcecode and can – for example distinguish between local variables and constants)

Actually, it’s only because of Eclipse that I now can write fairly good Java code. The thing was incredibly helpful during my first struggle to get something to work, so I made quite some progress in a quite small timeframe.

There is one thing though, I never got to work: CVS integration

I’m using CVS strictly over SSH, with the help of Putty, Pageant and Public Key authentication. Despite the fact I’ve entered the correct settings for the “ext” method (using Puttys plink.exe as CVS_RSH) in Eclipse, it never worked (it failed with various messages)

Of course there is the new extssh-Method, but this is non-standard. Where I can access the CVS-Server using extssh from eclipse, it does not really help because then the command line tools and TortoiseCVS stop working because they don’t understand extssh

Finally I found the solution: Even though it doesn’t make sense, you have to enter “cvs” under CVS_SERVER in the CVS-Settings. I don’t know why. It’s just that way. So to use Eclipse together with the command line tools and Tortoise to access the CVS-Repository from the same working copy, this is what you have to enter under Window/Preferences/Team/CVS/Ext Connection Method:

CVS_RSH yourfullpathtoplink.exe
Parameters {user}@{host}
CVS_SERVER cvs

Then you add a repository in the repository-view using the following settings:

Host your.host.name
Repository path /path/to/repos
User username
Password empty
Connection type ext

Before you finally click “Finish”, open up a command line window and log in to your CVS-Server using plink:

plink user@host

Maybe you are asked to store the host key in plinks database. Do so. Then make sure that you can login without a Password-Request popping up (Pageant must be running, your key must be loaded and authorized on the server). If that works, click “Finish” in Eclipse.

The price of abstraction

This article was featured on Slashdot today. It’s about the current state-of-the-art Linux-Desktop being quite demanding in Hardware – even more demanding than the arc-nemesis Windows XP.

And it’s true.

I see one of the problems in the basics of the Unix philosophy: Use small tools to do a specific task and another in the OpenSource-Philosophy: Write clean code.

These two approaches create wonderful architectures and abstractions of small tools doing their work.

What nobody seems to recognize: This so wonderful and well thought-out architecture is bloated per se. Let’s say you are playing a Video-File in a KDE-Video-Player running in KDE. This is what’s running on your system to acomplish this task (I hope I get all the (bigger) components really running – maybe there are more (or less) of them):

  • Linux Kernel
  • KDE-Sound-Server
  • X-Window-Server (complete with un-used network transparency which would not work with the video anyway
  • The whole QT-Library
  • Some basic KDE-Abstractions (kdelibs)
  • Your media player

Every one component ist cleanly seperated from each other – every one can be replaced without disturbing other components. Every one is designed cleanly using many abstractions to provide this replacability even for internal components.

But it get’s even more complicated: Many of the acting components are independant processes which creates the need for quite a bit of IPC wich is always slower than direct calls.

No wonder this is slow!

In Windows for example quite a lot of the stuff described above is actually running in the kernel or at least very close to it, maybe using undocumented interfaces to the kernel.

Playing a video mostly depends on DirectX which uses mostly in-process calls. It’s dirty, it’s unstable (maybe), but it’s fast, doesn’t flicker and happens to just work (the less independant components involved, the less can go wrong).

Of course that’s not how software should be written. It’s how it is written when fast and impressive resuslts are requested.

.Python

This Paper was featured on Slashdot today. It’s about an implementation of Python based on Microsofts CLR. The following quote speaks for itself:

I wanted to pinpoint the fatal flaw in the design of the CLR that made it so bad at implementing dynamic languages. My plan was to write a short pithy article called, “Why .NET is a terrible platform for dynamic languages”.

Unfortunately, as I carried out my experiments I found the CLR to be a surprisingly good target for dynamic languages, or at least for the highly dynamic specific case of Python. This was unfortunate because it meant that instead of writing a short pithy paper I had to build a full Python implementation for this new platform […]

This is very interesting. Imagine having access to all the Tools, Components around .NET from a wonderful language like Python. But it does not end here: As your Python code in the end gets compiled to MSIL, you can even create libraries in Python and share them with users of languages like C#. This is nice!

Too bad I don’t speek Python. But then again: If it’s working with python: What about Perl? PHP? Unix Shell [;-)]?

Debugging

Debugging can be so much fun if you just know how to entertain yourself while doing it. I’ve taken the screenshot below when I did some debugging on a stupid AV and finally found why it happens. Then I’ve added a Gexperts Debug-Statement to visualize whether I was right.

debug_fun.png

It seems, I was…. Talk about programs not knowing when it’s time to die. If only Delphi itself could tell me before it’s crashing…

(read the thing from bottom to top: 19:00 ’till 19:02 I was debugging and the app was crashing. Then I found the problem, added the debug-statement which checks for a NULL-Pointer and outputs the message if there’s indeed one of them and at 19:02:42 I ran the thing again and it warned me that it’s going to crash. At 19:05:46 it was fixed)

A programmers Editor…

… doesn’t have to take that much care of usability. And the installation routine of EditPlus certainly doesn’t.

edp.png

Besides the fact that this dialog appears when it’s already too late (after the installation has completed) and that it contains redundancy (the “Send To” entry and the additional context menu entry do practically the same), the marked wording is very ridiculous or can you imagine a mouse button with an attached (?) editor?

As usability would not matter (remember: programmer’s editor) that much, a more useful and less ridiculous wording would be “Add EditPlus to the Context Menu of Explorer”.

The wording is one of the things that are very often very wrong in software by semi-professional companies (not excluding my own software) and this usually gets even worse in the installers as they are often not very well tested (or not at all). Those InstallShield things are the worst as many developers just click together the installation, then click through the dialogs and put the thing on the web.

This is the reason why my parents still have not succeeded in installing software on their own while nearly everything else went quite well the last year.

Why o why is my harddrive so small?

I have the whole windows profile on its own NTFS-Partition that I’ve mounted to the “Documents and Settings”-Folder, so I can easily copy my clean windows image over the current system partition without losing any data. So my profile is about a year old where the system partition is quite clean.

Yesterday I’ve asekd myself why my the free space on my profile partition is shrinking and shrinking over time without me installing that much stuff (and removing it from time to time). Just per accident I found out: It’s windows installer: Whenever I’m installing one of those .msi-Files (or .EXE-Based InstallShield installers using MSI technology), a whole lot of junk gets into my profile and is never removed:

  • *.msp: msp-Files are like MSI-Files, but are used to patch an existing installation. I currently have 253 MB’s worth of msp-Patches in my profile (Local SettingsTemp. Value: Unknown because Windows Installer is not nearly documented enough
  • msi*.log: Logfiles of MSI-Installations. No value whatsoever. I have 106 MB worth of MSI-Logfiles in my profile.
  • *.msi: Whenever I install and MSI-File (or an exe-based MSI-Installer), the MSI-File is copied somewhere. Although it’s not in the profile, I’ve 217 MB worth of spare .MSI-Files on my harddrive – not counting the ones I have downloaded to my download-directory.

So: I have about 600 MB worth of data which hs no real purpose on my computer and I don’t know whether I can delete it or not as MSI is not really documented (there’s just some technical documentation for developers available).

Another nice sample of how strange Windows Installer can be: All CHM-based help-files recently stopped working with an Windows Installer Message asking me to provide the path to pgadmin2.msi – a postgres frontend which I have already deletetd ages ago – just now that I have removed the msi-installer from the original download directory, MSI wants to access it when doing things that don’t even remotely have to do with the file it asks for. Why?

Microsoft: If you sell us your installer technology as the non-plus-ultra solution for the old problems with overwritten dlls, incomplete installations and such: Please fix your tool or at least document it enough!

Responding to search-strings

I’ve just looked at the logs of this webserver and – under the search strings used to find this page, found this: <blockquote>delphi cannot debug anymore</blockquote>It happens that tough I have not written about this particular topic, I certainly have some hints to this fellow searcher (although, they possibly come to late now):

  • Have you compiled your project with debug information? (Project/Options/Compiler).
  • Have you rebuilt your project after changing above settings?
  • Do your files by any chance have Unix-Lineendings? If so, the debugger won’t work
  • Have you restarted your PC? Sometimes this works too.

I’m quite sure there are more things that could make the debugger unusable, but unfortunatly I can’t currently think of any more of them. Maybe becuase just the ones listed above are common enough that I remeber them? Delphi is very nice, but sometimes it can be so unstable