Introduction About Site Map

XML
RSS 2 Feed RSS 2 Feed
Navigation

Main Page | Blog Index

Archive for the ‘Programming’ Category

PHP Sucks on Backward Compatibility (or How ‘Gallery’ and PHP 5.3 Don’t Play Nice)

As a bit of a dinosaur in technology (I still use a Palm PDA and single- or dual-core AMD), backward compatibility and long-term support are important to me. I am not a fan of PHP even though many programs that I like (the latest being Roundcube) use it almost exclusively.

Many problems seem to occur for those who use old versions of Gallery with the latest PHP, which has become notorious for its backward compatibility deficiencies. One bit of software that I use which is not compatible with PHP 5.3 is Gallery 1.x. It’s a version that I hacked a bit to suit my purposes, so upgrading would flush all my customisations away. Whether a sandboxed compatibility mode is available (such that, e.g., PHP 5.2 is run for specified paths) I do not know yet, but based on what people are saying suppressing the warnings and errors should be possible. It’s not a real solution but a cosmetic hack. If your Web host undergoes a PHP upgrade to 5.3 it can lead to lots of issues associated with out-of-date software. “A short time ago,” wrote my host (with which I host about 10 domains), “we emailed you to let you know that we were upgrading all our servers to the latest version of PHP. This is now complete. We therefore recommend you have a quick check of your site and ensure everything is working as it should.”

The bottom line is, from my personal point of view, is that PHP yet again proves that backward compatibility is too much for it to handle and, as such, one oughtn’t rely on long-term usage of programs written in PHP. Other authors pointed this out before. It’s quite the blunder. In Web-based environments in particular, a case of “lose compatibility or get cracked” may become more common if we become dependent on PHP.

OpenCV, Android, and Hardware Limitations

Car navigation using computer vision algorithms/programs (as opposed to GPS/maps) is scarcely explored in the form of mobile applications. With many built-in cameras and increasing processing power/RAM it would be desirable to exploit — to the extent possible — whatever general-purpose devices have to offer while idle; single-purpose appliances like TomTom make less business sense nowadays and development frameworks for mobile platforms have become versatile enough to empower third-party developers. Based on conversations with colleagues, OpenCV and its many plugins should be somehow available for Android as well, albeit it may require some hacking and adaptation to the hardware at hand (high-end ARM for the most part).

If the goal is to make vehicles with cameras mounted onto them interpret a scene like humans do, then analysis of video sequences on mobile hardware (efficient applications) ought to be explored, with special emphasis on performance. C++ has little memory footprint and high efficiency. Contemporarily, resolution at a high capture rate is satisfactory enough for the task, but it is unclear whether a good algorithm that segments and tracks a scenes can keep up. A GPU-like processing power is available on some phones, but not all (drivers for non-x86 architectures are poor or scarce, too). MobileEye offers peripheral and assistive hardware for this reason, recognising the known caveats.Vuforia does augmented reality for mobile platforms and a company called ThirdSight also makes mobile applications with computer vision methodologies. Not so long ago (April 2010) it was reported that “development of new automobile safety features and military applications [...] could save lives.” The hardware is not specified in the report. To quote, “Snyder and his co-authors have written a program that uses algorithms to sort visual data and make decisions related to finding the lanes of a road, detecting how those lanes change as a car is moving, and controlling the car to stay in the correct lane.”

While purely automatic driving is currently verboten, computer-aided driving is legal and forms a growing trend. It need not involve any mechanics either, as it’s most about message-passing to a human (HCI).

Making Spirals in Octave/MATLAB

Occasionally, in numerical programming, one may wish to plot or instantiate a grid of a circular (or spiral) nature. Here are some code samples for those trying to achieve it. The following sets some values of interest:

lines=10
degrees=180

Now, let us generate some linear, equally-spaced points:

t_map = linspace(0,lines*pi*2,lines*degrees*2);

What we have here is the 2 for 360 degrees, which may depend on what one tries to achieve. For the more complex case shown later, this will be essential. Now, let’s do the sine/cosine magic:

x_map = t_map.*cos(t_map);
y_map = t_map.*sin(t_map);

This can be plotted with plot(x_map, y_map), but let’s do something more interesting by assigning colour to the sample points and then plotting them as dense dots. The following would work:

flat=zeros(1000,1000);
  for ll=(size(x_map,2)/2):-1:1
    flat(floor(x_map(ll*2))'+500,floor(y_map(ll*2))'+500)=1
  end
imshow(flat)

The values here are rather arbitrary and can be used for demonstrative purposes. The problem itself seems to be commonly recurring, thus the need for a blog post. Different colours can be assigned to sample points, which achieves something like the following:

Spiral examples

PageRank 7

Finally, for the first time ever, I have gotten a site whose front page is PageRank 7. That would be Techrights. I didn’t see it coming and this is part of a group effort, so it’s a victory for many of us who worked on it for years. I cannot think of another Linux-oriented site which has PageRank 7 or higher. It’s an important milestone for sure, even if it’s mostly symbolic.

Today was generally a great day and I met an old friend who is now a boxer. Did some programming, ran successful experiments, and some of the changes are compiled without an issue, removing the zlib dependency from Cyrus. Now is the time to have these tested and the plan is to use the existing interfaces with some test data and detect mis-correspondence in CRC polynomials. Tomorrow, heavy blogging will resume and maybe a trip to London will wait until Monday.

Outperforming PCA, Revisiting MATLAB

Post-denoising small

I currently work on a very fascinating project which deals with 3-D face recognition, as already stated back in January. Progress has been noticeable recently (easier to get coding done when the Internet is mostly unavailable due to Bad Telecom [1, 2, 3]) and the accompanying text is now about 50 pages long.

A few observations about MATLAB: the programming framework has not really developed much since 2003. It’s either quite stagnant or improved only in unseen places. I did not forget how to develop a GUI environment very rapidly.

A few observations about PCA: the method is a little antiquated and it can probably be outperformed by more problem-specific implementations of algorithms we explore.

A few observations about Bad Telecom (or Bastards Telecom, although some people view the word bastard as too strong): they only ever serve the customer properly if he/she becomes a threat to the reputation of the business. It is sad that customers must be seen as a risk before they can actually get progress made.

Fedora, Importance of GNU/Linux Competition, and Technological Freedom

FEDORA 11 is a fine distribution of GNU/Linux, but my session got stuck (frozen) today. Generally, scheduling on the desktop in this out-of-date operating system is somewhat deficient. Windows sometimes do not respond for a period of several seconds. The bug where a text selection cursor is made permanently visible and allows no real interaction with any applications kicked in… againtoday. It happens quite rarely with other distributions and there’s an escape route out of it, e.g. if the terminate signal can be sent to the application causing it, assuming it can be identified. But not this time though. Bearing in mind that it’s not the very latest version of Fedora and having used the fourteenth release since it was made available (even installed it for others), it does seem fair to say that for a smooth experience on the desktop, one is still better off going with the Debian family. Mandriva (predominantly but not strictly RPM-based) has been very good too, probably a lot better than Fedora.

The problems with Fedora are not really caused by adherence to freedom. Some creases and bugs, however, might not be addressed early enough because Fedora’s adherence to freedom (not strict adherence, but better than Ubuntu’s for example) limits the extent of its userbase, which in turn reduces the incentive Red Hat has to concentrate on the desktop side of things.

I have been working with Fedora 11 since last Friday (just waiting for my home computers to get back online with the new line activated) and as much as I try to love Fedora, I cannot help feeling that Kubuntu and Ubuntu have been giving me less hassle. Deep inside I wanted to declare that Fedora was better, but the experiences simply suggest that any such claim would be wishful thinking, even deceptive. The problem is that Canonical was made quite arrogant (hello Hubris!), which harms Ubuntu on technical and communal grounds alike. Canonical could use more competition.

It may be true that Linux in the mainstream is all about Android, Google, Ubuntu, mainframes, and Red Hat Enterprise Linux these days. That’s fine. As long as Fedora uses and reuses the same pertinent packages, there is no risk of Fedora truly falling behind. The wonder of Free software is, as long as one is allowed to copy the competition or branch out of it, unfair advantage is harder to gain. Canonical and Google have both attempted to produce “added value” (or enhancement) which is hard to emulate, replicate, or even get involved in. They are using some very vendor-specific code, which changes the balance of control not just with copyright assignment. It’s not progress and it is usually counter-productive.

Next week I will resume GNU/Linux advocacy and do a lot less programming (below is a new screenshot of the application I have been developing, but it’s unfortunate and regrettable that the code depends on a proprietary framework) and there is a lot of thinking to be done regarding strategy. Generally speaking, the world’s population loses control over technology at a very rapid pace* and software freedom is no longer the only freedom worth pursuing by a developer with passion for humanism. The head of the Free Software Foundation (FSF) has just stepped down and it is hard to blame him; maybe he too reached similar dilemmas and came to realisations that software freedom is not enough. Collaboration too is crucial (GPL encourages it), not to mention education in general.

Expressions GUI
____
* I spent half an hour this morning chatting with a lady in her 70s. She too — not too surprisingly — feels as though mobile phones are a burden rather than a blessing. In general, she is also concerned about today’s society which lacks face-to-face interaction and intimidates her generation that’s not at all accustomed to a technological control grid. Free/libre software is being used a lot in this context (primarily for companies to bring their user-hostile proprietary layer to market immediately), not as much is being produced though. If technology is not built to provide the user some more control, then it usually tries to control the user. But people are not made sufficiently aware of it, unless the FSF speaks out, as it recently did against Android.

Developing With Fedora 11

GMDS/PCA

FEDORA 14 was a bit of a mixed bag, but it was definitely an improvement compared to previous versions. I’ve used it since it was released (and blogged quite a lot about it). At the moment I use an older version:

bash-4.0$ uname -a
Linux [XXXXX] 2.6.30.10-105.2.23.fc11.i686.PAE #1 SMP
Thu Feb 11 07:05:37 UTC 2010 i686 i686 i386 GNU/Linux

Not to worry, it’s up to date and it runs the latest KDE. The general impression has been positive, having worked on this operating system for the past week or so (still awaiting my Ethernet’s return, so working from a lab, not via SSH). A few remarks about the weak spots:

  • X (org/server) blows up under particular circumstances where a newer version of X might be expected. If an attempt is made to invoke it from a remote host (SSH with X forwarding), the whole of Fedora blows up and the session must be restarted. If run locally, the same type of X issue simply raises a hardware-based exception and produces a major warning, then gives the option to gracefully shut down the affected program. It’s not good, but it’s definitely better than the former scenario, which is reproducible by the way.
  • Dual-screen handling is fantastic. It is still a plug-and-play experience, even with Fedora 11 in place.
  • There are far too many visual artefacts and drawing bugs (direct rendering is lacking). Again, this may just be the fault of old X and nothing whatsoever to do with the drivers of this GPU (Fedora seems to favour free drivers).

Aside from X rants, this platform is fantastic for development. Everything has worked well so far, except Firefox with occasional crashes (occurring at least once a day).

Is Fedora ready to become the most widespread GNU/Linux desktop? Probably not yet. But for development? Sure, why not? Fedora 14 is more mature, but that too has some wrinkles which I covered here before.

By the way, the screenshot at the top (click to zoom) shows the application I’ve been developing recently. More details will be published shortly as blogging distracts from persistent coding, and vice versa.

Retrieval statistics: 22 queries taking a total of 0.308 seconds • Please report low bandwidth using the feedback form
Original styles created by Ian Main (all acknowledgements) • PHP scripts and styles later modified by Roy Schestowitz • Help yourself to a GPL'd copy
|— Proudly powered by W o r d P r e s s — based on a heavily-hacked version 1.2.1 (Mingus) installation —|