tidBITS

Playing MP3 files with java…

leave a comment »

For a language as popular as Java, lack of standard ways of implementing mp3 playback is disappointing. This is understandable though, due to horde of patent and licensing issues relating to MP3 as a format. A bit of googling and I found two methods: using the Java Sound API along with the MP3 plugin and using the third party JLayer API from JavaZoom. Here I’m using JLayer as it seems to be the more popular alternative.

First we need to download the jlayer from here. Extract it and add the jl1.0.1.jar to the project. When using an IDE like eclipse adding the jar to the build path suffices otherwise  jl1.0.1.jar should be added to the CLASSPATH.

JLayer provides two built in players that play mp3s using the library: javazoom.jl.player and javazoom.jl.player.advanced. I’m using the Player class.

Create an instance of the Player class while providing a FileInputStream object of the mp3 file. Then use the play() method of the class to start playback.

Below is a very basic implementation of the playback process:

import java.io.*;
import javazoom.jl.player.Player;

public class JavaPlayerTest {

public static void main(String[] args) {
try
{
FileInputStream mp3file = new FileInputStream(args[0]);
Player playmp3 = new Player(mp3file);
playmp3.play();
}catch (Exception e) {
System.out.println(e);
}
}
}

Written by Sayak Biswas

August 12, 2011 at 5:12 am

Posted in Programming

Set up C/C++ environment with vim & mingw

leave a comment »

For those who love writing code in vi/vim(let’s face it its the greatest code editor in the world) and miss it while using Windows, it is possible to set up vim in Windows. Here are the steps to install and set up Vim with MinGW(gcc/g++).

1. Download and install gVim from here.

2. Download MinGW automated installer from here and run the installer.

3. Select the package repository and the directory to install(default is C:\MinGW, I recommend leaving it as it is).

4. Select the optional components like C++, Fortran and MSYS base(this is useful; it provides the various bash shell tools like ls,grep,make,gawk etc).

5. The installer then downloads the latest version of the packages and installs them.

6. Finally, add MinGW’s bin directory to the PATH environment variable.

7. To test if MinGW is set up correctly, go to the command prompt and type g++ --version. If you see the version number as output, then congratulations.

Hope, this post has been helpful.

Written by Sayak Biswas

August 8, 2011 at 1:39 pm

Posted in Programming, Windows

HTML Entities……..

leave a comment »

Entities are essentially symbols in HTML jargon. Here is a list of entities and their codes courtesy Tizag .

Symbol Definition Numeric Value Correlating Name
Non-Breaking Space  
< Less Than < &lt;
> Greater Than > &gt;
Quotation Mark &quot;
¡ Inverted Exclamation ¡ &iexcl;
¢ Cent ¢ &cent;
£ English Pound £ &pound;
¤ Currency ¤ &curren;
¥ Yen ¥ &yen;
¦ Broken Vertical Bar ¦ &brvbar;
§ Section § &sect;
¨ Double Dot ¨ &uml;
© Copyright © &copy;
ª Feminine Ordinal Indicator ª &ordf;
« Left Angle Quotation Mark « &laquo;
» Right Angle Quotation Mark » &raquo;
¬ Negation ¬ &not;
® Registered Trademark ® &reg;
¯ Spacing Macron ¯ &macr;
° Degree(s) ° &deg;
± Plus or Minus ± &plusmn;
² Superscript 2 ² &sup2;
³ Superscript 3 ³ &sup3;
´ Spacing Acute ´ &acute;
µ Micro µ &micro;
Paragraph &para;
· Middle Dot · &middot;
¸ Spacing Cedilla ¸ &cedil;
¹ Superscript 1 ¹ &sup1;
º Masculine Ordinal Indicator º &ordm;
¼ ¼ Fraction ¼ &frac14;
½ ½ Fraction ½ &frac12;
¾ ¾ Fraction ¾ &frac34;
¿ Inverted Question Mark ¿ &iquest;
À Grave Accent-Captial A À &Agrave;
Á Acute Accent-Capital A Á &Aacute;
 Circumflex Accent-Capital A  &Acirc;
à Tilde-Capital A à &Atilde;
Ä Umlaut Mark-Capital A Ä &Auml;
Å Ring-Capital A Å &Aring;
Æ Capital ae Æ &AElig;
Ç Cedilla-Capital C Ç &Ccedil;
È Grave Accent-Capital E È &Egrave;
É Acute Accent-Capital E É &Eacute;
Ê Circumflex Accent-Capital E Ê &Ecirc;
Ë Umlaut Mark-Capital E Ë &Eml;
Ì Grave Accent-Capital I Ì &Igrave;
Í Acute Accent-Capital I Í &Iacute;
Î Circumflex Accent-Capital I Î &Icirc;
Ï Umlaut Mark-Capital I Ï &Iuml;
Ð Capital eth Ð ∓ETH;
Ñ Tilde-Capital N Ñ ∓Ntilde;
Ò Grave Accent-Capital O Ò &Ograve;
Ó Acute Accent-Capital O Ó &Oacute;
Ô Circumflex Accent-Capital O Ô &Ocirc;
Õ Tilde-Capital O Õ &Otilde;
Ö Umlaut Mark-Capital O Ö %amp;)uml;
× Multiplication × &times;
Ø Slash-Capital O Ø &Oslash;
Ù Grave Accent-Capital U Ù &Ugrave;
Ú Acute Accent-Captital U Ú &Uacute;
Û Circumflex Accent-Capital U Û &Ucirc;
Ü Umlaut Mark-Capital U Ü &Uuml;
Ý Acute Accent-Capital Y Ý &Yacute;
Þ Thorn Þ &THORN;
ß Small Sharp ß &szlig;
æ Small ae æ &aelig;
ð Small eth ð &eth;
ø Slash-Small o ø &oslash;
þ Small Thorn þ &thorn;
Œ Capital Ligature Œ &OElig;
œ Small Ligature œ &oelig;
ˆ Modifier Circumflex Accent ˆ &circ;
˜ Small Tilde ˜ &tilde;
Zero Width Joiner &zwj;
En Dash &ndash;
Em Dash &mdash;
Left Single Quote &lsquo;
Right Single Quote &rsquo;
Single Low Quote &sbquo;
Left Double Quote &ldquo;
Right Double Quote &rdquo;
Double Low Quote &bdquo;
Dagger &dagger;
Double Dagger &Dagger;
Per Mile &permil;
Left Single Arrow Quote &lsaquo;
Right Single Arrow Quote &rsaquo;
Euro Mark &euro;
TradeMark &trade;

Written by Sayak Biswas

March 17, 2011 at 1:57 am

Posted in HTML

Chrome on Ubuntu 9.10

leave a comment »

In my previous post, I gave a how-to of installing Chromium browser(development version of Google Chrome) on Arch Linux. In this post I’ll show you how to install Chromium on Ubuntu 9.10(Karmic Koala).
1. Go to System->Administration->Software Sources. Go to tab “Other Software”.
2. Click Add. In ‘APT Line’ paste the following:
deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
Click Add again and paste the following:
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
Click Close and Reload.
3. In a terminal paste the following:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xfbef0d696de1c72ba5a835fe5a9bf3bb4e5e17b5 && sudo apt-get update
4. Install chromium using the following command:
sudo apt-get install chromium-browser

That’s it. You’re done.
I’ve also made a screen-cast of the procedure. Yay! My first youtube video. :D

Written by Sayak Biswas

November 4, 2009 at 5:39 am

Posted in linux, Ubuntu

Tagged with , , , , , ,

Google Chrome on Arch..

leave a comment »

Actually its not the official Chrome, but the open-source development version, better known as Chromium. I installed chromium from aur as follows:
yaourt chromium-browser-bin
After trying it out for a few minutes, I knew it was going to replace Firefox as my default Web Browser. It has certainly improved quite a lot since I last tried it on Ubuntu. It used to crash a lot then. Now, it has become rock stable(well, almost). It’s fast and snappy. It has got some great themes. On first start, it imported all my Firefox bookmarks. Also, another thing that I liked was the Opera-style speed dial that I always longed for in Firefox (Opera never quite did it for me). Overall its great, though there is one thing from Firefox that I still require on Chromium – something like the DownloadThemAll! addon for firefox. Hopefully, it will be developed ASAP. Till then I’ll go back to “The Fox” for big downloads.

Cheers!!

Written by Sayak Biswas

October 24, 2009 at 1:59 pm

Posted in Arch, linux

KDE 4 on my Lappy…

leave a comment »

Here is a collage of various KDE 4 screenshots from my laptop:
Screenshots.jpg (1.7 MB)

Enjoy. :)

Written by Sayak Biswas

October 24, 2009 at 6:54 am

Posted in linux

Plymouth on Arch

leave a comment »

I’m now enjoying beautiful splashes at boot on my Arch box. Yes, plymouth works quite well on Arch. To get it working well, execute the folowing steps:
1. First get KMS enabled in your kernel.
2. Next install plymouth-git from aur:
yaourt -S plymouth-git
3. Then edit /etc/mkinitcpio.conf and add ‘plymouth’ (without the quotes) in the HOOKS line after base, udev and autodetect.
4. Rebuild initrd using(as root):
mkinitcpio -p kernel26
5. To change themes, do:
sudo plymouth-set-default-theme --rebuild-initrd
You can find themes in /usr/share/plymouth/themes.
6. Reboot
The only problem I have with this method is that plymouthd does not get stopped even after plymouth splash ends. For that I have to do (as root)
killall plymouthd
everytime I login(not a very viable solution). So, if you guys have any better solution, feel free to tell me.

Cheers!

Written by Sayak Biswas

October 22, 2009 at 2:38 pm

Posted in Arch, linux

Increased Boot-Up Speed….

leave a comment »

I found out a way to increase boot-up speed in Arch. Previously, I used to load the ‘network’ daemon in /etc/rc.conf ‘Daemons’ array. The ‘network’ daemon used to take quite a bit of time to load and also sometimes fail killing splashy(giving a message: “Something failed, killing splashy”) and falling back to text mode. But now I replaced the ‘network’ daemon with ‘networkmanager’ daemon and it works like a charm. Boot-up speed has increased and splashy does not crash anymore. It’s great.

To manage network with networkmanager in KDE4, install ‘kdemod-networkmanager-git’ and ‘kdemod-networkmanagement-knetworkmanager-kde4′ and reboot. You’ll see the ‘knetworkmanager’ icon in the System Tray. That’s it.

But one thing which I don’t understand is why ‘network’ daemon takes so much time to load and ‘networkmanager’ lesser.

Written by Sayak Biswas

October 22, 2009 at 1:48 pm

Posted in Arch, linux

Installed Arch Linux….

leave a comment »

I’ve moved over to Arch Linux. A really short review follows:

Its awesome. Installation was easy and for configuring the system for audio, video etc, the Beginners’ Guide in the Arch Wiki is sufficient. It makes setting up an Arch system a breeze.

I’ve set up my archbox with KDEMod4 and I shoud say KDEMod 4.3.2 rocks!! Its stable and zippy especially when you use it in conjuction with Compiz Fusion.

Another thing I liked in Arch was the BSD-style init scripts. All my system’s settings are stored in one file – in /etc/rc.conf. And that’s awesome.

I’ve saved the best for the last. Pacman. Yes, Pacman is the best thing that has ever happened to my system. It is zippy, it is easy and it keeps rolling. That means all the latest and greatest software is available without doing any reinstallation, which I could not have on Ubuntu and others.

Well, that’s it for now. Till then keep rollin’ and rockin’.

Written by Sayak Biswas

October 19, 2009 at 5:57 am

Posted in Arch, linux

Tagged with ,

I’m an SCJP…. :)

leave a comment »

Yay!! :D
I passed the SCJP exam with 93% marks. I’m awesomely happy about it. Right now I’m awaiting my certificate which I’ll be getting in a few months.
Other SCJPs share your experiences.
Yay again!

Written by Sayak Biswas

October 8, 2009 at 1:23 pm

Posted in Life

Follow

Get every new post delivered to your Inbox.