The New Twentieth Anniversary Macintosh C2D comes with USB 2.0, Blu-ray drive, touch screen, wireless network, and almost everything you can think of…
The safe way to customize UITextField’s placeholder is subclassing the UITextField and overriding placeholderRectForBounds:, Apple won’t bother you on this one. However, if you want to take the risk, you can try this way:
[self.MyTextField setValue:[UIColor darkGrayColor] forKeyPath:@"_placeholderLabel.textColor"];
Use KVC to access/set UITextField’s protected ivar directly, fast and risky.
SweetFM is an open source Last.fm player for Mac OS X. It has a “lovely” feature exports radio tracks to your iTunes.
This hack had been merged into main tree of SweetFM, you can check the commit here. Thanks, @tenpaiyomi.
However, due to the limitation of the Last.fm API, the radio playlist (in XSPF format) does not contain track’s genre. In fact, there’re no genres but tags, Last.fm uses tags to categorize almost everything they have in the database: album, artist, track and users.
Since we can only know the track name, album name and artist name in their XSPF format response:
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>+Cher+Similar+Artists</title>
<creator>Last.fm</creator>
<date>2007-11-26T17:34:38</date>
<link rel="http://www.last.fm/expiry">3600</link>
<trackList>
<track>
<location>http://play.last.fm/ ... .mp3</location>
<title>Two People (Live)</title>
<identifier>8212510</identifier>
<album>Tina Live In Europe</album>
<creator>Tina Turner</creator>
<duration>265000</duration>
<image>http:// ... .jpg</image>
<extension application="http://www.last.fm">
<artistpage></artistpage>
<albumpage>...</albumpage>
<trackpage>...</trackpage>
<buyTrackURL>...</buyTrackURL>
<buyAlbumURL>...</buyAlbumURL>
<freeTrackURL>...</freeTrackURL>
</extension>
</track>
...
</trackList>
</playlist>
We will see empty id3 genre tag in exported .mp3 file. That’s not good.
Lucky, SweetFM uses Chris Drew’s ID3.framework, and we can add genres if we have. So, the way to create genre now back to another Last.fm API: track.getTopTags.
<toptags artist="Cher" track="Believe">
<tag>
<name>pop</name>
<count>97</count>
<url>www.last.fm/tag/pop</url>
</tag>
<tag>
<name>dance</name>
<count>88</count>
<url>www.last.fm/tag/dance</url>
</tag>
...
</toptags>
First, get the artist and track name from radio playlist. Then, filled them in to track.getTopTags request, send it, receive the server response, and parse the tag name node using XPath:
After creating the DeviceTrack with genre tag, we still have several steps to put the genre into mp3 file, but they are much easier, you can check them over github if you want.
This hack had been merged into main tree of SweetFM.
You can use this to enable Emoji keyboard with Apple’s iPhone SDK:
Update on Feb. 4, 2009: I take down the sample code since you can easily find it all over the internet now.
loading…