?

Log in

No account? Create an account
weird phone thing - Greg [entries|archive|friends|userinfo]
Greg

[ website | gregstoll.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| * Homepage * Mobile apps (Windows Phone, Win8, Android, webOS) * Pictures * LJBackup * Same-sex marriage map * iTunesAnalysis * Where's lunch? ]

weird phone thing [Jan. 25th, 2008|04:04 pm]
Greg
[Tags|, ]
[Current Mood |confusedconfused]

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.
LinkReply

Comments:
From: spchampion
2008-01-26 03:01 am (UTC)
How is this different than Perl?

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

(Reply) (Thread)
[User Picture]From: gregstoll
2008-01-26 03:57 am (UTC)
[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 :-)
(Reply) (Parent) (Thread)
[User Picture]From: omega697
2008-01-26 05:10 am (UTC)
(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
(Reply) (Parent) (Thread)
[User Picture]From: gregstoll
2008-01-26 06:26 pm (UTC)
Yay!
(Reply) (Parent) (Thread)
From: spchampion
2008-01-26 06:53 am (UTC)
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.)
(Reply) (Parent) (Thread)
[User Picture]From: gregstoll
2008-01-26 06:29 pm (UTC)
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...)
(Reply) (Parent) (Thread)
From: spchampion
2008-01-27 03:00 am (UTC)
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.
(Reply) (Parent) (Thread)