Wednesday, September 21, 2011

MacPorts and OS X Lion

so its been while without messing with MacPorts after upgrading to Lion and I went ahead to check its status and it was outdated, so I tried to get it up to date:

# port selfupdate
Warning: port definitions are more than two weeks old, consider using selfupdate
---> Updating the ports tree
---> Updating MacPorts base sources using rsync
MacPorts base version 1.9.2 installed,
MacPorts base version 2.0.3 downloaded.
---> MacPorts base is outdated, installing new version 2.0.3
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl

Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)

so WTF!

after surfing a while learned that after upgrading to OS X Lion the MacPorts seems to have problems AKA doesn't work anymore, there are a few guides to upgrade it out there but as for sanity, I'd rather get it uninstalled.

1) got a list of all your ports:
# port -qv installed > AllMyPorts.txt , you can use porticus as well, its up to you

2) Try to uninstall all the ports:
#port -f uninstall --follow-dependents installed

too many nested evaluations (infinite loop?)
Log for atk is at: /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_atk_1.32.0_0/main.log
Warning: Failed to execute portfile from registry for atk @1.32.0_0
too many nested evaluations (infinite loop?)

that didnt work so:

# sudo port -f uninstall installed (not the ideal but it eventually remove all the dependencies)

3) at this point you will no longer have MacPorts installed so download the new version for Lion (2.0.3)

4) Eventually you will get an error message when installing saying that xCode is not installed or was installed with UNIX development (10.5+) so go and download xCode4 (Apple Store, its free no worries), once the AppleStore says "Installed" you need to actually install it! so go to Applications then look for xCode4 and install it and give it a try again to the MacPorts installer.






Sunday, September 11, 2011

Twython: Python API for Twitter

pretty neat, easy to use API for twitter, its twython, I got it installed and working in less that 2 minutes:

Pre-requesites: Python already installed on the box.

$ sudo easy_install twython
$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
>>> from twython import Twython
>>> twitter = Twython()
>>> results = twitter.searchTwitter(q="NASA", rpp='10')
>>> for tweet in results['results']:
... print "User: %s \n Tweet: %s" % (tweet['from_user'], tweet['text'])
...
User: CarlaEid
Tweet: Reading: http://t.co/1Rlpmr0 #Arabic #NASA
User: raccoonTweetzz
Tweet: If NASA sends a pregnant woman into space and gives birth...is the baby an alien? (•͡.̮ •͡ )
User: JHarley36
Tweet: @PrettyMoneyPaid I've been working for NASA.
User: chrome_ghost
Tweet: 9.11 as seen by the only american not on earth at the time. http://t.co/SInyMAh
User: sebargue
Tweet: RT @monterocnn: Así se vieron ataques contra Nueva York desde el espacio. Video: http://t.co/x0BB9tm
User: supermorgy
Tweet: @mariefrance16 Nasa work ako Marie. Downtime kami. Kaya nag hahabol productivity. Will watch it with honnie on Saturday!
User: bongiss
Tweet: @Lalalishh nasa new york ka? Haha
User: UNIVERSITAM
Tweet: UNIVERSITAM: LA NASA LANZA LAS SONDAS GRAIL CON DESTINO A LA LUNA http://t.co/ebBGucY
User: taroshaw
Tweet: RT @Mrkat0: NASAの人工衛星落下へ 重さ6トン、月末にも http://t.co/lKXubuz
ジョー、君はどこに落ちたい…?
User: hugonz
Tweet: Y no, la NASA no cuenta. RT @circulobastiat: "Los grandes avances de la civilización jamás han venido deun gobierno central" Milton Friedman
>>>