see whatever…

jump to menu

September 2, 2006

and switching programming languages

Filed under: Java,Javascript,Jython,PHP,Programming,Python — see @ 11:18 pm

In Reqiem for an operator Barry Warsaw farewells the <> operator which will be removed in Python 3000. I have no real opinion on the topic itself although I think <> and != are one of the few not TOOWTDI things in Python and so a reasonable decision to remove one. But the followoing question in the same blog entry got me thinking:
“How often do you type semicolons at the end of your Python statements? How often do you type colons at the end of your C conditionals? Yeah, me neither.”

Actually I do tend to forget colons in Python after programming a while in Javascript or PHP, and I do forget using braces in e.g. “if” clauses in Javascript or PHP or Java after programming in Python for a while. Actually I forget to use a lot of things in other languages that are not needed in Python like () {} ; etc. What really made me nervous was building a simple JSP form this week where I had to use Java and I almost got angry about all the stuff I had to type which would have not been necessary if it would have been a Python or even Jython form. All the declarating, casting, complicated and verbose looping etc was simply a nervekiller.

So I guess getting rid of <> in Python in favor of != makes language hopping at least a bit easier.

About the only thing I sometimes wish for Python would be the removal of mandatory colons at the end of if, for, class, def etc. I guess this would make parsing of Python sourcecode impossible or at least “indeterminable” (is that an english word?). But the colon is one of the few places where a special character makes the code not more readable but a bit convoluted. Not a big problem as the parser complains about missing colons (which I see frequently ;) .

BTW, this post is somehow related. It makes me like the language even more as there still seems to be space for a bit of fun.

June 15, 2006

Updating to MySQL 4, PHP 4 and phpmyadmin

Filed under: PHP,Web — see @ 2:14 pm

About a year ago (after I got a new machine :) I tried to install MySQL 4 after having used v3 for quite some time. I never got it to work with PHP 4 and the current phpmyadmin tool so gave up at that time and installed MySQL 3.23 again.

But I noticed that most providers are using MySQL 4 now (even the cheaper ones some of the sites I sometimes need to update run on) which causes trouble if I want to import the online v4 dump into my v3 database. So up to a new try…

Installation of MySQL itself was not the problem but phpmyadmin did not want to talk to it. At least not with the PHP version I use which still is v4 as most (simple) websites I need to work on still use v4. After some googling I found that the reason is a changed password mechanism. No problem if you are content to use no password at all which is not an option even for my local development machine. So I did a longer googling session and found these forum entries which describe a solution. It is rather complicated but does work after several iterations…

So now all is working again, I even installed the current PHP 4 release. Importing the database data was not too difficult although I had some tries again as some sites still use a latin1 encoding while other newer sites I built all use UTF-8 encoding. I guess the best would be to work only in UTF-8, at least in the sites I “control” myself.

Nevertheless the whole procedure took way too long for a technology I only use because I need to (reasons are availability and price or deployed systems) and not because I like to.

April 5, 2006

file permissions

Filed under: PHP,Programming — see @ 8:36 pm

I guess I have been a bit ignorant regarding file permissions in Unix/Linux. I am developing on Windows only so this only bites me when I put something on a webserver which for my current needs almost never runs on Windows meaning it is most of the time an Apache or maybe Tomcat (no issue there of course) running on a Linux machine.

Today again I had some difficulties with the small CMS-like system I am developing (mostly as I want to learn a bit more from the ground up). Images uploaded from the media component of the system had a strange 0200 permission but needed a 0777 (or maybe not?) permission to show up on the resulting website at all. Until now I always worked with a simple FTP tool (SmartFTP, really nice BTW and free for noncommercial work) to change file permissions. But the upload tool written in PHP did set the permission that I was not allowed to even change it via FTP.

In the end I found a way but alltogether it showed me that I never really looked into the whole thing. Guess not that important for the kind of work I am doing for living and even privately but nevertheless I should look a bit more into it.

January 22, 2006

image/pjpeg !

Filed under: PHP,Web — see @ 10:07 pm

Developing and testing mainly in Firefox even gives headaches with server side programming which I thought was browser-opaque. Wrong. I was wondering why an upload of a simple JPG image would fail. After some debugging I first noticed I was oppressing all error messages I wanted to give in the app I developed… Kind of embarassing as this was I missed the error message which would have explained the original error.

The actual error was coming from Internet Explorer’s strange behaviour not sending a MIME-type of “image/jpeg” as all sane browsers and I guess also all sane programmers would do but instead send an “image/pjpeg” which I did not expected and so did not handle.

So one fault for me but a really strange one for IE…

Powered by WordPress