weird phone thing
Mood: confused
Posted on 2008-01-25 16:04:00
Tags: phone programming
Words: 124

I was beginning to get a little worried about the new phone, since I charged it night before last and it ran out of power before bedtime. So I charged it last night and now it's still showing full power. Hopefully it's just a weird battery quirk, or maybe I had one of the side buttons pressed in my pocket? Either way, weird.

Also, I hate PHP. Any language where the expression "id" + 1 evaluates to 1 instead of (best case) "id1" or (not as good but still acceptable case) erroring should die. It doesn't help that I have no way of debugging it, just running the Greasemonkey script and inferring from the fact that the database is empty that something went wrong. Sheesh.


7 comments

Comment from spchampion:
2008-01-25T21:01:30+00:00

How is this different than Perl?

[erdos:~] champion% perl
my $id = 0;
$id = "id" + 1;
print "ID: $id\n";
ID: 1

Comment from gregstoll:
2008-01-25T21:57:35+00:00

[gregstoll@cantor ~ 09:19:42]$ python
Python 2.4.4 (#2, Aug 16 2007, 02:03:40)
[GCC 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> "id" + 1
Traceback (most recent call last):
File "", line 1, in ?
TypeError: cannot concatenate 'str' and 'int' objects

And that's why I prefer Python :-)

Comment from omega697:
2008-01-25T23:10:15+00:00

(11:09PM) [kurt@Mekong ~]$ irb
irb(main):001:0> 'id' + 1
TypeError: can't convert Fixnum into String
from (irb):1:in `+'
from (irb):1

Comment from gregstoll:
2008-01-26T12:26:47+00:00

Yay!

Comment from spchampion:
2008-01-26T00:53:41+00:00

Well I'll see your strongly typed language and raise you arbitrary white spacing:

[erdos:~] champion% perl


my $id = 0;
$id = "id" + 1;
print "ID: $id\n";
ID: 1

Let's see your language parse that!

(Seriously, any recommendations for a good Python book? I have been meaning to learn it. It's currently higher on my list than Ruby on Rails, which really does suck.)

Comment from gregstoll:
2008-01-26T12:29:41+00:00

Fixed spacing is one of those things I came to love about Python.

As for a book...I have "Learning Python" and "Programming Python" from O'Reilly which are decent.

(and Ruby the language is pretty neat, although I haven't tried Ruby on Rails...)

Comment from spchampion:
2008-01-26T21:00:43+00:00

RoR is neat, but it's really slow and immature. The departure of Zed Shaw with his angry rant leaves giant question marks about the future of the project.

On the other hand, since you already know Python, try out Django and see what you think. It's supposedly more mature than RoR and far more scalable.

This backup was done by LJBackup.