I forgot to post this one in my blog when I found out lyrics can now be seen in iTouch’s firmware of 1.1.3. I’ve been wondering myself why Apple took a very long time to have this feature enabled. Actually even with the firmware 1.1.3 they never announced it. With this, we can finally sing a long while we listen to our favorite music.

Adding lyrics is an old feature of iTunes though. Just copy and paste it in the Lyrics tab of the music in iTunes when you select its properties. Now, we can finally make use of the lyrics. Keep in mind though, that this feature is not found in nano video or below. only with iPhone and iTouch. Searching for lyrics and pasting them one by one is a hassle though, but there’s a neat widget in Mac that actually fetches the lyrics for you when you play the music in your iTunes. The widget is called TunesTEXT. Pretty nifty, saves you all the trouble of finding the lyrics.

If you want all your mp3s to have lyrics, just leave your iTunes running. Once the next song plays, TunesTEXT automatically searches for the song and appends it into the mp3 file. Now, I can really say owning an iTouch is very much worth it. This was the number 1 feature that I wanted ever since iPod was created and it’s finally here.

Java and Javascript have different ways to replace strings like the feature “find and replace” that you see in text editors.

Java’s replace method is not ideal for noobs but only for people who know about regex. I am not that quite familiar with regex and if you wish to use that replace method under the String class in Java, you’d have to familiarize yourself with it in order to use it. The String class though, has lots of other useful methods that can be used to simulate how a search and replace function works. Here is a workaround method for people who only want a simple search and replace with the search and target both String. No regex knowledge needed.

The replace function contains two options. ‘i’ means the search would be case insensitive and ‘g’ means global, meaning it will search all instances of the search string within the str variable. If you do not include ‘g’ as its option, then only the first instance of the search string will be replaced.

Java and Javascript should have provided simple replace methods that greatly help newbies to these languages. The replaceString() method in Java is a good workaround for easy to use search and replace purposes in java.

Languages like Java and Javascript provide a method called indexOf() that returns an int of the first position of the string key found in a string. strpos() in PHP acts differently. If it finds the substring within the string, it returns an int value of the position of the substring. If it does not, it returns a boolean instead.

I find this stupid. It would have been easier if it still returned an int value like the usual -1 to indicate it didn’t find any substring inside the string.

To do an if statement using strpos() of PHP just like this Java code:

Do this in PHP:

Notice the 2 equal sign succeeding after the exclamation point? That line checks if the statement is false. If you wish to change it to a true condition statement, just put in 3 equal signs.

Related Posts Plugin for WordPress, Blogger...