Be a man… Submit a man-page patch today !

June 26, 2010

All of us (well, at least some of us) like to test the limit of existing things.. That’s what I tried to do with the below given program. I decided to find the limit of the directories created in directories for an ext3 file system using mkdir(). Any one of you could find the reason behind it ? Well, it was for fun :)

# cat test_max_directories.c
————————————————
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>

int main()
{
char dirname[50];
int i;
/* The max number of subdirectories in one directory for ext3 is 32000 */
int limit = 32001;

for (i = 0; i < limit; i++) {
sprintf(dirname, “testdir%d”, i);
if ((mkdir(dirname, 00777)) == -1) {
perror(“Error in creating directory!”);
printf(“errno = %d\n”, errno);
exit(1);
}
}
return 0;

}

———————–

As expected, strace showed that it failed, however with an EMLINK error:

mkdir(“testdir31998″, 0777)             = -1 EMLINK (Too many links)

Here comes the next  thing…. EMLINK error is not present in the man page of mkdir(2) … Wo hoo… a big chance to submit a patch to Linux Kernel Man page project …. I have started the exciting process of preparing the patch, mail and follow up process.

First, I should download the latest kernel man pages which is now in a git repository:

#apt-get install git-core

#git clone git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git

After check out, I have made the necessary changes in mkdir.2 page and prepared the patch using the command:

# git diff

I got the below listed patch:
————

diff –git a/man2/mkdir.2 b/man2/mkdir.2
index e6cb28c..d01bafd 100644
— a/man2/mkdir.2
+++ b/man2/mkdir.2
@@ -73,6 +73,10 @@ is a symbolic link, dangling or not.
Too many symbolic links were encountered in resolving
.IR pathname .
.TP
+.B EMLINK
+The new directory cannot be created because the number of sub directories
+in a directory is limited to LINK_MAX defined by the file system.
+.TP
.B ENAMETOOLONG
.IR pathname ” was too long.”
.TP

—————————

Here comes the most exciting part… Create a proper mail and convince the man page maintainer to include this to the mkdir man page.

First, I should choose the right mail id’s to send the patch. From the mailing list it should be mailed with:

To: mtk.manpages@googlemail.com

CC: linux-man@vger.kernel.org

(make sure that you are already subscribed to linux-man@vger.kernel.org)

Then it is important to give the correct subject line. It gives the required importance to the patch. A wrong subject line could ruin to chances to mainline your patch . As I have previous experience with this mailing list, I chose the subject line:

[PATCH] mkdir.2: Add EMLINK error

Next important thing is what we should write in the mail. We should support our patch and show it’s importance. It should have the “Signed-off-by : Name <mail id> and properly placed patch along with the mail. Some groups will reject the patch right away if we attach the patch with the mail as a separate attachment.  So, observe the mailing list and then decide how to send the patch.

——————————————-

Dear Michael,

While executing the below given program in ext3 file system, I came
across the EMLINK error in mkdir(2) syscall.

# cat test_max_directories.c

#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>

int main()
{
char dirname[50];
int i;
/* The max number of subdirectories in one directory for ext3 is 32000 */
int limit = 32001;

for (i = 0; i < limit; i++) {
sprintf(dirname, “testdir%d”, i);
if ((mkdir(dirname, 00777)) == -1) {
perror(“Error in creating directory!”);
printf(“errno = %d\n”, errno);
exit(1);
}
}
return 0;
}

# ./a.out
Error in creating directory!: Too many links
errno = 29

An strace of this execution shows that the mkdir(2) call generates an
EMLINK error when it reaches the limit of  maximum number of sub
directories in one directory

#strace ./a.out
——————————

—–
…..
mkdir(“testdir31998″, 0777)             = -1 EMLINK (Too many links)
dup(2)                                  = 3
fcntl64(3, F_GETFL)                     = 0×8002 (flags O_RDWR|O_LARGEFILE)
brk(0)                                  = 0x804a000
brk(0x806b000)                          = 0x806b000
fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), …}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7f71000
_llseek(3, 0, 0xbffc3078, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(3, “Error in creating directory!: To”…, 45Error in creating
directory!: Too many links
) = 45
close(3)                                = 0
munmap(0xb7f71000, 4096)                = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), …}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7f71000
write(1, “errno = 29\n”, 11errno = 29
)            = 11
exit_group(1)                           = ?
Process 16246 detached
———————————–

However, reference to EMLINK is not present in the mkdir(2) man page.
The following patch adds the EMLINK error in the man page of mkdir(2).

Kindly let me know if there are any issues.

Best Regards,
Maxin B. John
www.maxinbjohn.info

Signed-off-by: Maxin B. John <maxinbjohn@gmail.com>

——-

diff –git a/man2/mkdir.2 b/man2/mkdir.2
index e6cb28c..d01bafd 100644
— a/man2/mkdir.2
+++ b/man2/mkdir.2
@@ -73,6 +73,10 @@ is a symbolic link, dangling or not.
Too many symbolic links were encountered in resolving
.IR pathname .
.TP
+.B EMLINK
+The new directory cannot be created because the number of sub directories
+in a directory is limited to LINK_MAX defined by the file system.
+.TP
.B ENAMETOOLONG
.IR pathname ” was too long.”
.TP

—————————————————————————
Next process is to follow it up. I got frustrated when nobody from the list replied to me about the patch for the next two days… So I have sent the follow up mail to the list as a reply to my first mail. All I wanted to show was that my patch was relevant.
—————————–
Hi,

A quick google search shows that the sus v3 version of mkdir(2) has
reference to EMLINK error

http://www.opengroup.org/onlinepubs/000095399/functions/mkdir.html

[EMLINK]
The link count of the parent directory would exceed {LINK_MAX}.

Please let me know your opinion on this.

Best Regards,
Maxin B. John

————————————
There were no replies even after 2 days of sending this mail also. So I just decided to ping the group. A mail as a reply to my previous mails just to let them know that I am waiting to know their opinion:
——
ping …
——
Finally I got this reply from Michael Kerrisk, the Linux Kernel Man pages maintainer:
———————————
Hello Maxin,

- Show quoted text -
On Mon, Jun 21, 2010 at 5:48 PM, Maxin John <maxin.john@gmail.com> wrote:
> Dear Michael,
…..
Thanks for the very precise and well supported bug report!

Yes, the page should be fixed. …..

…………………………
Bingo.. they accepted the patch, with some modifications though… :)
Links:
http://permalink.gmane.org/gmane.linux.man/1484
http://permalink.gmane.org/gmane.linux.man/1471
http://permalink.gmane.org/gmane.linux.man/1478
http://permalink.gmane.org/gmane.linux.man/1483
Come, be a man … Submit some kernel man page patches :)
1

webm support for mplayer in Ubuntu

May 26, 2010

Today, I have read the blog of Praveen (http://www.j4v4m4n.in/2010/05/26/webm-support-for-fedora-13/) about how he added support for webm in Fedora13 (for ffmpeg).  Though I heard about Google releasing VP8 codec as Free Software, I never thought of downloading a .webm file( What’s the use of it , if you can’t play it :) ). However, after downloading the ‘bigbrotherstate.webm” file from Praveen’s blog, I have tried to play it in my favorite media player, ‘mplayer’ and failed.

maxin@maxin-laptop:~$ mplayer /home/maxin/Downloads/bigbrotherstate.webm
MPlayer SVN-r29237-4.4.1 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing /home/maxin/Downloads/bigbrotherstate.webm.

Exiting… (End of file)

———————–

Then I started my night long effort by tinkering with the mplayer source and VP8 patches and finally made it working in Ubuntu Linux.

Mplayer playing the “bigbrotherstate.webm”

webm in mplayer

webm in mplayer

I have created a log file for this activity: Here it goes:

As per the project (http://www.webmproject.org/code/build-prerequisites/), the VP8 Codec SDK (libvpx) has build dependency on Yasm assember for optimized building on x86 (32 and 64 bit).

At first, get the Yasm assembler from (http://www.tortall.net/projects/yasm/wiki/Download)

wget http://www.tortall.net/projects/yasm/releases/yasm-1.0.1.tar.gz
tar zxvf yasm-1.0.1.tar.gz
cd yasm-1.0.1
./configure
make
sudo make install

Now, go for the libvpx and build it.We can download the libvpx source from webm project page:http://code.google.com/p/webm/

wget http://code.google.com/p/webm/downloads/detail?name=libvpx-0.9.0.tar.bz2
tar jxvf libvpx-0.9.0.tar.bz2
cd libvpx-0.9.0
./configure
make
sudo make install

There comes the mammoth task of downloading the patches for adding webm support to mplayer :mplayer-vp8-encdec-support-r1.tar.bz2

wget http://code.google.com/p/webm/downloads/detail?name=mplayer-vp8-encdec-support-r2.tar.bz2

tar jxvf mplayer-vp8-encdec-support-r1.tar.bz2

ls
allcodecs-register_VP8.diff
avcodec-AVCodecContext_add_VP8_specifics.diff
avcodec-minor_version_bump.diff
avcodec-VP8_CODEC_ID.diff
avformat-minor_version_bump.diff
ffmpeg-only
libavcodec-build_VP8.diff
libavcodec-new_options.diff
libvpxdec.diff
libvpxenc.diff
Makefile-avcodec-add_webm_demux.diff
Makefile-avformat-add_webm_demux.diff
matroska-add_V_VP8.diff
matroskadec-add_webm.diff
matroskaenc-add_webm.diff
mplayer-only
riff-VP80_fourcc.diff

Hmm.. a number of files to fight with :)

Anyways, get the latest mplayer source:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

cd mplayer
patch -p1 <../../mplayer-vp8-encdec-support/libvpxdec.diff
patching file libvpxdec.c

Index: allcodecs.c
===================================================================
— allcodecs.c    (revision 23341)
+++ allcodecs.c    (working copy)
@@ -349,6 +349,7 @@
REGISTER_DECODER (LIBSPEEX, libspeex);
REGISTER_ENCODER (LIBTHEORA, libtheora);
REGISTER_ENCODER (LIBVORBIS, libvorbis);
+    REGISTER_ENCDEC  (LIBVPX_VP8, libvpx_vp8);
REGISTER_DECODER (LIBVPX, libvpx);
REGISTER_ENCODER (LIBX264, libx264);
REGISTER_ENCODER (LIBXVID, libxvid);

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/libavcodec$ patch -p1 <../../../mplayer-vp8-encdec-support/libavcodec-new_options.diff
patching file options.c

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/libavcodec$ patch -p1 <../../../mplayer-vp8-encdec-support/libvpxenc.diff
patching file libvpxenc.c

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/libavcodec$ patch -p1 <../../../mplayer-vp8-encdec-support/libvpxenc.diff
patching file libvpxenc.c

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/libavcodec$ patch -p1 <../../../mplayer-vp8-encdec-support/Makefile-avcodec-add_webm_demux.diff
patching file Makefile
Hunk #1 succeeded at 512 with fuzz 1 (offset 14 lines).

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/libavformat$ patch -p1 <../../../mplayer-vp8-encdec-support/Makefile-avformat-add_webm_demux.diff
patching file Makefile
Hunk #1 succeeded at 257 (offset 2 lines).

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/libavformat$ patch -p1 <../../../mplayer-vp8-encdec-support/Makefile-avformat-add_webm_demux.diff
patching file Makefile
Hunk #1 succeeded at 257 (offset 2 lines).

Index: matroskadec.c
===================================================================
— matroskadec.c    (revision 23341)
+++ matroskadec.c    (working copy)
@@ -36,7 +36,9 @@
#include “isom.h”
#include “rm.h”
#include “matroska.h”
-#include “libavcodec/mpeg4audio.h”
+#if CONFIG_MATROSKA_DEMUXER
+ #include “libavcodec/mpeg4audio.h”
+#endif
#include “libavutil/intfloat_readwrite.h”
#include “libavutil/intreadwrite.h”
#include “libavutil/avstring.h”
@@ -824,7 +826,7 @@
/*
* Autodetecting…
*/
-static int matroska_probe(AVProbeData *p)
+static int ebml_probe(AVProbeData *p, const char probe_data[], const int probe_data_size)
{
uint64_t total = 0;
int len_mask = 0×80, size = 1, n = 1, i;
@@ -848,15 +850,13 @@
/* Does the probe data contain the whole header? */
if (p->buf_size < 4 + size + total)
return 0;
-
-    /* The header should contain a known document type. For now,
-     * we don’t parse the whole header but simply check for the
-     * availability of that array of characters inside the header.
-     * Not fully fool-proof, but good enough. */
-    for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) {
-        int probelen = strlen(matroska_doctypes[i]);
-        for (n = 4+size; n <= 4+size+total-probelen; n++)
-            if (!memcmp(p->buf+n, matroska_doctypes[i], probelen))
+    /* The header must contain the document type from the demuxer
+     * specific probe function. For now, we don’t parse the whole
+     * header but simply check for the availability of that array
+     * of characters inside the header. Not fully fool-proof, but
+     * good enough. */
+     for (n = 4+size; n <= 4+size+total-(probe_data_size-1); n++)
+        if (!memcmp(p->buf+n, probe_data, probe_data_size-1))
return AVPROBE_SCORE_MAX;
}

@@ -864,6 +864,23 @@
return AVPROBE_SCORE_MAX/2;
}

+/*
+ * Autodetecting…
+ */
+static int matroska_probe(AVProbeData *p)
+{
+    static const char probe_data[] = “matroska”;
+    return ebml_probe(p, probe_data, sizeof(probe_data));
+}
+#if CONFIG_WEBM_DEMUXER
+static int webm_probe(AVProbeData *p)
+{
+    static const char probe_data[] = “webm”;
+    return ebml_probe(p, probe_data, sizeof(probe_data));
+}
+#endif
+
+
static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matroska,
int num)
{
@@ -1117,11 +1134,12 @@

static int matroska_aac_sri(int samplerate)
{
-    int sri;
-
+    int sri = 0;
+#if CONFIG_MATROSKA_DEMUXER
for (sri=0; sri<FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++)
if (ff_mpeg4audio_sample_rates[sri] == samplerate)
break;
+#endif
return sri;
}

@@ -1146,6 +1164,7 @@
/* First read the EBML header. */
if (ebml_parse(matroska, ebml_syntax, &ebml)
|| ebml.version > EBML_VERSION       || ebml.max_size > sizeof(uint64_t)
+        || strcmp(ebml.doctype, s->iformat->name)
|| ebml.id_length > sizeof(uint32_t) || ebml.doctype_version > 2) {
av_log(matroska->ctx, AV_LOG_ERROR,
“EBML header using unsupported features\n”
@@ -1274,11 +1293,13 @@
ff_get_wav_header(&b, st->codec, track->codec_priv.size);
codec_id = st->codec->codec_id;
extradata_offset = FFMIN(track->codec_priv.size, 18);
+#if CONFIG_MATROSKA_DEMUXER
} else if (!strcmp(track->codec_id, “V_QUICKTIME”)
&& (track->codec_priv.size >= 86)
&& (track->codec_priv.data != NULL)) {
track->video.fourcc = AV_RL32(track->codec_priv.data);
codec_id=ff_codec_get_id(codec_movvideo_tags, track->video.fourcc);
+#endif
} else if (codec_id == CODEC_ID_PCM_S16BE) {
switch (track->audio.bitdepth) {
case  8:  codec_id = CODEC_ID_PCM_U8;     break;
@@ -1881,6 +1902,7 @@
return 0;
}

+#if CONFIG_MATROSKA_DEMUXER
AVInputFormat matroska_demuxer = {
“matroska”,
NULL_IF_CONFIG_SMALL(“Matroska file format”),
@@ -1892,3 +1914,19 @@
matroska_read_seek,
.metadata_conv = ff_mkv_metadata_conv,
};
+#endif
+
+#if CONFIG_WEBM_DEMUXER
+AVInputFormat webm_demuxer = {
+    “webm”,
+    NULL_IF_CONFIG_SMALL(“WebM file format”),
+    sizeof(MatroskaDemuxContext),
+    webm_probe,
+    matroska_read_header,
+    matroska_read_packet,
+    matroska_read_close,
+    matroska_read_seek,
+    .metadata_conv = ff_mkv_metadata_conv,
+};
+#endif
+

————————————————

No need to apply riff patch:
XXXX patch -p1 < ../../../mplayer-vp8-encdec-support/riff-VP80_fourcc.diff

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/etc$ patch -p1 <../../../mplayer-vp8-encdec-support/mplayer-only/codecs_conf-VP8.diff
patching file codecs.conf
Hunk #1 succeeded at 2183 with fuzz 2 (offset 241 lines).

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/libmpdemux$ patch -p1 < ../../../mplayer-vp8-encdec-support/mplayer-only/demux_mkv-V_VP8__webm_doctype.diff
patching file demux_mkv.c
patching file matroska.h

maxin@maxin-laptop:~/Downloads/mplayer/svn/mplayer/libavcodec$ patch -p1 <../../../mplayer-vp8-encdec-support/avcodec-AVCodecContext_add_VP8_specifics.diff
patching file avcodec.h
Hunk #1 succeeded at 2665 (offset 6 lines).

Index: configure
===================================================================
— configure    (revision 31226)
+++ configure    (working copy)
@@ -300,6 +300,7 @@
–disable-libschroedinger-lavc   disable Dirac in libavcodec (Schroedinger
decoder) [autodetect]
–disable-libvpx-lavc     disable libvpx in libavcodec [autodetect]
+  –disable-libvpx-vp8-lavc disable VP8 in libavcodec [autodetect]
–disable-libnut          disable libnut [autodetect]
–disable-libavutil_a     disable static libavutil [autodetect]
–disable-libavcodec_a    disable static libavcodec [autodetect]
@@ -695,6 +696,7 @@
_libdirac_lavc=auto
_libschroedinger_lavc=auto
_libvpx_lavc=auto
+_libvpx_vp8_lavc=auto
_libnut=auto
_lirc=auto
_lircc=auto
@@ -1141,6 +1143,8 @@
–disable-libschroedinger-lavc)  _libschroedinger_lavc=no   ;;
–enable-libvpx-lavc)   _libvpx_lavc=yes  ;;
–disable-libvpx-lavc)  _libvpx_lavc=no   ;;
+  –enable-libvpx-vp8-lavc)   _libvpx_vp8_lavc=yes  ;;
+  –disable-libvpx-vp8-lavc)  _libvpx_vp8_lavc=no   ;;
–enable-libnut)      _libnut=yes     ;;
–disable-libnut)     _libnut=no      ;;
–enable-libavutil_a)         _libavutil_a=yes        ;;
@@ -7624,6 +7628,45 @@
fi
echores “$_libvpx_lavc”

+
+echocheck “libvpx_vp8″
+if test “$_libvpx_vp8_lavc” = auto; then
+  _libvpx_vp8_lavc=no
+  if test “$_libavcodec_a” != yes; then
+    res_comment=”libavcodec (static) is required by libvpx_vp8, sorry”
+  else
+    cat > $TMPC << EOF
+#define HAVE_STDINT_H 1
+#include <vpx/vpx_decoder.h>
+#include <vpx/vp8dx.h>
+#include <vpx/vpx_encoder.h>
+#include <vpx/vp8cx.h>
+int main(void)
+{
+    vpx_codec_dec_init(NULL,&vpx_codec_vp8_dx_algo,NULL,0);
+    vpx_codec_enc_init(NULL,&vpx_codec_vp8_cx_algo,NULL,0);
+    return 0;
+}
+EOF
+    _inc_vpx_vp8=
+    _ld_vpx_vp8=-lvpx
+    cc_check $_inc_vpx_vp8 $_ld_vpx_vp8        &&
+    _libvpx_vp8_lavc=yes                       &&
+    extra_cflags=”$extra_cflags $_inc_vpx_vp8″ &&
+    extra_ldflags=”$extra_ldflags $_ld_vpx_vp8″
+  fi
+fi
+if test “$_libvpx_vp8_lavc” = yes ; then
+  def_libvpx_vp8_lavc=’#define CONFIG_LIBVPX_VP8 1′
+  _libavencoders=”$_libavencoders LIBVPX_VP8_ENCODER”
+  _libavdecoders=”$_libavdecoders LIBVPX_VP8_DECODER”
+  codecmodules=”libvpx_vp8 $codecmodules”
+else
+  def_libvpx_vp8_lavc=’#define CONFIG_LIBVPX_VP8 0′
+  nocodecmodules=”libvpx_vp8 $nocodecmodules”
+fi
+echores “$_libvpx_vp8_lavc”
+
echocheck “libnut”
if test “$_libnut” = auto ; then
cat > $TMPC << EOF

—————————————

Now Compile mplayer:

./configure  –enable-libvpx-vp8-lavc
make

Finally… after 5 hours of fight with the includer files and Makefiles and modifying some files (sorry.. in half sleep), I got .webm support working with mplayer…

Now, my newly built mplayer can play .webm files.. Yooo.. hoooo…

Thanks to Praveen for inspiration and .webm file.

Finally, see mplayer in action.
./mplayer /home/maxin/Downloads/bigbrotherstate.webm

Hoping to submit the modified patches after re-creating the patches against the latest mplayer source code from SVN.  I will be pushing the modified source code to my blog-site.

Update: The modified tar file is available under the following URL:

http://rapidshare.com/files/398835122/mplayer-with-webm.tar.gz.html

4

Humor :) from THE CHURCH OF EMACS

April 28, 2010

Most of  us believe that the people who follow THE CHURCH OF EMACS are very serious guys with little sense of humor. That’s not true … Just follow this URL for some serious techie FUN :

http://www.gnu.org/fun

For example, when you run command in Linux:

$ ^How did the sex change^ operation go?
-bash: :s^How did the sex change^ operation go?: substitution failed

$ [ Where is Bill G?
-bash: [: missing `]‘

(… from : http://www.gnu.org/fun/jokes/unix.errors.html )

Now it’s a fashion to attack the church. I do enjoy it too :)

x——————————————————————————–x

/*  One sample GPL v3 licensed joke. I swear that it’s not created by me */

Hierarchy of the Church

  1. GODS — Creates Free ideas, software and hardware from emptiness and likes to be flattered through prayers.
  2. DEMIGODS — Capable of proving that NP problems and P problems are the same (NP=P), writes free software for to prove it and tries to alleviate the bullying nature of GODS by distributing the ideas of GODS freely. They still insist on flattering GODS through prayers and defends the bullying of GODS.
  3. SAINTS — Writes Free software using Free software tools.
  4. SEMI SAINTS — Use lots of Free software and believes in the church of EMACS but signed NDAs or agreed to proprietary software licenses.
  5. PROPHETS — selected by ALMIGHTY (One of the GODS) to reveal his thoughts about humanity.
  6. LAITY — does not care about NDAs or proprietary software licenses but runs after BUZZWORDS to show that he is capable of grasping BUZZWORDS.
  7. Sinners — Insist on using devil’s software, believing that it is of superior quality.
  8. Devils — Creating NDAs and proprietory software licenses to entangle humanity in their net

Examples of Devils

Evil Empire: Microsoft

Lucifer: Bill Gates

Evil Countries: SUN, HP, ORACLE, etc.

Other major Devil leaders: Scott Mcnalley, Larry Ellison, etc.

CONFESSION AND REPENTANCE

Please take some time to think about yourself. You can repent and confess at any time by visiting our CONFESSION CENTER which is open 7 days a week, 24 hours a day.

Rules for repentance (This is the only important principle of THE CHURCH OF EMACS):

  1. $10 for each invocation of a proprietory licensed software.
  2. $1000 for each NDA you signed.
  3. $10000 for each NDA you participated in creating.
  4. $10000000 for each NDA you wrote.
  5. $100 for each proprietary software license you agreed to.
  6. $1000 for each proprietary software license you participated in creating.
  7. $10000 for each proprietary software license you are responsible for writing.
  8. All your sins will be forgiven if you develop a major new Free software package.

Warning: Taking THE CHURCH OF EMACS seriously is hazardous to your health; especially MENTAL HEALTH.

x—————————————————————————————————-x

+  Some  Hello World C codes ( Side effect of reading “Deep C Secrets”):

0. ifelse1.c

#include <stdio.h>
#include <setjmp.h>

jmp_buf buf;

int main()
{

if (setjmp(buf)) {
printf(” World\n”);
return 0;
} else {
printf(“Hello”);
longjmp(buf, 1);
}
}

1. ifelse2.c

#include <stdio.h>

int main()
{
if (printf(“Hello”) == 0) {
} else
printf(” World \n”);
return 0;
}

4

902 people downloaded “ChickenWarrior” : my first Mobile game

March 30, 2010

Today, I have visited the “ChickenWarrior” game page in Betavine: http://www.betavine.net/bvportal/application/ChickenWarrior/index.html

I was amazed to see the number of downloads for that silly simple game: 902

 Now, I really feel sad for what I have done. I just created a small game like program for my K300i mobile out of curiosity. All it did was just added some chunk of code to move the half baked images across the phone and a bit of collission detection code as part of game’s logic. I didn’t even added the code to show the score at the end. All I wanted was just to prove that we can do some game programming in GNU/Linux for our dearest Mobile Phones.  After that, I have never looked into that code again and never even thought of improving the game (images and code quality).

The source code of the game is available in Google Code. http://code.google.com/p/chickenwarrior/

Today I feel guilty for publishing a half baked game.  But on the other hand, I did what I felt right that time.. ” Release early Release often!!” : One of the principles of Free Software Movement. I have done the first part right: I released it early.. after that I haven’t followed it… I haven’t released even it’s next version.

I can’t blame anybody else but myself. I dreamt of a number of applications on Mobile Phones. I will be coding it in the near future .

1

Don’t you have mother and sisters ? Moron !!!

March 9, 2010

Year 2008…

In one fine morning, I received a mail from my manager in Sony, informing that, I will be visiting Sony Headquarters, Minato, Tokyo, Japan. I will be visiting japan along with the list of people given below:

1. Satheesh-san (Senior manager)

2. Sonali-san (Senior Engineer)

3. Saneesh-san (Engineer)

blah… blah..

Stay will be arranged in Shinagawa Prince Hotel , Tokyo .. aaha..!!!

I have started the epic journey from Bangalore Airport. This time, transit was in Hong Kong International Airport, one of the best in the world. In my previous journey, transit was in Singapore. So, I was pretty excited about visiting each and every part of the Hong Kong Airport. After that, we have reached Narita Airport (Tokyo International Airport) in time and reached the Prince Hotel in “Airport Limousine”: It’s just a bus , nothing to do with limousine cars :)

After attending the amazing annual International technology exhibition of Sony in it’s headquarters and some presentations in Osaki gate city office, we started our journey back to India. This time, Saneesh-san had some more activities to be completed on Sony Erickson office. So, me, Sonali-san and Satheesh-san started our journey to India.

In the way back, during transit at Hong Kong Airport, Sonali-san made a shocking discovery. While waiting for the HongKong -> Bangalore flight in Airport, she thought she lost her credit card. Though I tried to convince her that she might have kept the credit card  in one of those big suitcases, she started weeping.In my broken Hindi, I tried my level best to console her.

HongKong: The land of Jackie Chan… All those people, who are sitting besides me and whoever walking near to us were thinking something else :) .. For them, a lady is crying and a guy is sitting near to her.. both talking in a “pre historic language” . What he might have done .. All those eyes were asking the same question ” Don’t you have mother and sisters ? Moron !!!”

Sonali-san kept on weeping without interruption. Though I am an atheist, this situation demanded the help of gods. My mind started the process of optimally selecting the “God” who fits for this situation.

1. Ganapathy : Rejected.. No…no.. noo… I haven’t started anything new

2. Sri Krishna: Rejected.. No no.. I am not dealing with a number of women

3. Allah : Rejected.. No.. It’s not safe to think about Allah during international travel.. Learn from Shah Rukh Khan

4. Holy Spirit :  Rejected.. No.. though there are a number of “Duty Free” Alcohol shops

5. Jesus:  Perfect fit… here, I am crucified for something that I haven’t done..

One quick idea from God: I have opened my Laptop, booted it and asked Sonali-san to chat with her brother. Luckily, he had the contact number of Bank and along with the necessary details of her card. He made the necessary steps which was just enough to cheer up the weeping girl.

Based on a real story:

Only Jesus saves.. Everyone else make backups :)

5

Oscar, Hollywood and my memory lane

March 9, 2010

Yesterday night, before sleeping, I thought about the Oscar award night. Watching Hollywood movies was one of my hobbies and I almost never missed a chance for that. My father , who was also a fan of movies, used to take me to watch English Movies in “Priya”, the first 70MM theater in Kollam (now , Dhanya Theater, part of Muthoot group). That relationship made me a fan of Oscars and I almost never missed the chance to watch the award night ceremonies.

Most of the times, I found joy in finding out the “original” hollywood movie behind the Malayalam/Tamil/Hindi Movies. Whenever I got an opportunity to talk about Movies, I found pride in preaching about “the magic in Hollywood”. I thought of me as a man who knows too much about Hollywood movies and most of the times, that arrogance was visible in my talks. All those thoughts were about to change when I joined Sony….

When I joined Sony India, our office was in Maruti Infotech Centre, Domlur in Bangalore. It was a nice place and the Linux Project group was a small group of amazing people with deep knowledge in Linux. In my work place , cubicles were more or less open. I was sitting near to 3 ladies :

1. Miki – san: Our Japanese teacher who was born in First November (never ask the year, she insists :) ), which happen to be my birthday also.

2. Gayathri-san : My team mate and she is from the most dangerous place in kerala known as Kannur :)

3. Hiromi -san:  A devotee of Satya Sai Baba and a good friend to us all

Most of the ladies from Kannur knows “Kalarippayattu”: A traditional martial art in Kerala. For the Japanese people, it is part of their curriculum to learn Martial arts. This situation demanded me to concentrate on my work mostly because of the following reasons:

1. I don’t know any form of martial arts

2. I would love to be in a normal shape

However, I couldn’t control the tendency to boast about my “deep” knowledge in English movies. In most of the tea times, I used to talk about the movies that I have watched.. the “inspiration” behind the local movies.. etc.. etc..

Once, I happen to talk about the English movies in my cubicle also. I found myself intellectually superior when I talked about various Hollywood movies and how the actors performed in those movies. With ever growing curiosity about Japanese culture and people, I have voiced my question : “Hiromi san, do you watch English movies ? ”

She smiled and after some seconds of silence, she said:

Yes, I do, Maxin-san. In fact, I have acted in a number of Hollywood Movies”

That was a great surprise for me and I couldn’t speak for some time. My colleague, who sits besides me, is a famous Heroine in Hollywood and also in Japan.

Hiromi Nishiyama : http://www.imdb.com/name/nm1036751/

Hiromi-san’s famous movies includes “1st Testament CIA Vengeance”, “Soap girl” ,…etc. Hiromi-san’s mother is  a famous Movie director in Japan .Last year, Malayala Manorama news paper has reported about  Hiromi-san and her mother’s visit to Kerala.

Now, I no longer work for Sony. But I got an opportunity to work with a group of amazingly talented people. I will never forget those people in my life.

Finally, Dear friend, don’t boast.. Just shut up and code.

3

Customizing the Opensuse 11.2 on my Compaq presario Laptop

December 20, 2009

I was sort of happy with my Debian lenny installation in my laptop. However, the time taken for booting the machine was slightly higher (specially when I set the wlan on dhcp). So, for a change, I have switched to Opensuse 11.2 today. Till now , everything goes well.

Opensuse 11.2 boots in a minute and almost everything is up now. One of the interesting commands specific to opensuse is zypper. It is equivalent to the ‘apt-get’ in debian.

maxin@linux-fqsa:~/Documents> zypper search vim
Reading installed packages…

S | Name                   | Summary                                | Type
–+————————+—————————————-+———–
| avimanager             | Manage your (large) movie (DVD,DivX,-> | package
| avimanager             | Manage your (large) movie (DVD,DivX,-> | srcpackage
| gvim                   | A GUI for Vi                           | package
| gvim-debuginfo         | Debug information for package gvim     | package
| supercollider-vim      | SuperCollider support for Vim          | package
i | vim                    | Vi IMproved                            | package
| vim                    | Vi IMproved                            | srcpackage
i | vim-base               | Vi IMproved                            | package
| vim-base-debuginfo     | Debug information for package vim-base | package
i | vim-data               | Vi IMproved                            | package
| vim-debuginfo          | Debug information for package vim      | package
| vim-debugsource        | Debug sources for package vim          | package
| vim-enhanced           | A version of the VIM editor which in-> | package
| vim-enhanced-debuginfo | Debug information for package vim-en-> | package
| vim-plugin-devhelp     | Developer’s Help Program for GNOME     | package

After copying the firmware for Broadcom BCM4311 802.11b/g WLAN , the wireless lan is working and I am able to connect to the internet.

One of the annoying thing about opensuse was the absence of mplayer or vlc player with the installation media itself. We need to setup the players and resolve the dependencies by ourselves as described in this URL:

http://www.susegeek.com/media-player/install-configure-mplayer-free-opensource-media-player-in-opensuse/

Since, I wanted to wash my clothes, I have decided to go with the easiest way (can’t think of spending time for a generic application like Mplayer after using debian (apt-get) for a long time).

The mplayer installation steps in Opensuse 11.2 is as listed below:

sudo zypper ar http://packman.iu-bremen.de/suse/11.2 mplayer

sudo zypper mr -r mplayer

sudo zypper in mplayer

Well done ! … It’s done :)

mplayer in opensuse 11.2

mplayer in opensuse 11.2

7

The best FOSS event ever: Foss.in/2009

December 6, 2009

Wooooww..

I am still intoxicated by the charm of Foss.in/2009. I can’t believe that it is over. It was , by far, the best  FOSS event that I have ever attended.

The reason why I felt it most attractive was it put the “zip on the mouth” and provided you with two powerful hands which could mould your idea into a reality- be it in Software or in Hardware.  This time, there were less talks and more “workout sessions”, which means we could work with the project of our choice, code and if the core developer likes it, it will be committed to the repository , right away!!!

There are pros and cons to every events. Now, let me show you the list of pros and cons of the foss.in  so that you will get a feel of what happened over there. Since, I have the habit of finding pleasure in finding the faults, let me put the cons first :)

Cons:

1.    The Foss.in people used OSX laptop for projecting presentations in the Main Auditorium

Pros:

1. Less number of Talks (More time for workouts.. go to first floor, meet the people and work with them).

2. Timing was great : 11 AM to 10 PM – In Bangalore, considering the traffic, if you are fortunate enough,  you can  reach a place like NIMHANS and attend the programs if it is scheduled at 9AM. It also allowed the “Software Professionals” like me to, go to office for their daily bread,come back in the evening and attend Foss.in. I was able to attend the Keynotes everyday and also participate in some of the hands on sessions in the evening (after 6 PM ) because of this schedule.

3. Selection of  Talks/Speakers were good.

4. I got the opportunity to meet some of the great minds and discuss something with them. The list is as follows:

a. Harald Welte : We discussed about Openezx project and issues with Motorola not realeasing the kernel source code for A1600 mobile.

b. Santhosh Thottingal: We discussed about the Silpa project. Silpa is an amazing project and Santhosh is doing amazing things with it. He explained the algorithms that he has used in the Silpa project for Language computing.

c. Stefan Schmidt : We discussed about the Openezx project. Tried to boot the A1600 with the latest 2.6.x kernel . However, the attempt failed after about 5 -6 attempts and he guided me to have a look into the bootloader code “Blob”

d. Baiju. M:  He has presented about “Buildout” . We discussed about Silpa.

e. Jain Basil Aliyas:  The “scribus” boy. We discussed about how his girl friend got engaged to another person . Probably he is so busy with his codings, that he couldn’t spare time for her :)

f.  Milosch Meriac: We discussed about Openbeacon project and he helped me in setting up the arm toolchain for openbeacon project in my laptop.

g. Ciju Rajan : My college mate and now a proud “IBM LTC” guy. I have attended his presentation on “Suspend and Resume”  in Linux.

h. Hundreds of other “Birds of the same feather”  flying with their groups  and very rarely fighting with the birds with slightly different color (KDE v/s GNOME ) :)

5.  The “TRDP” band’s performance at the end of Foss.in was awesome. It was the first time I came to know that the Kannada Folk songs are this sweet. Kudos to Raghu Dixit for a wonderful evening.

In this event, I also witnessed some of my friends get their form back . One such example was Justin’s workout with Openbeacon project. He was so interested in the project that he spent 2 days with Miloch and finally coded the “Jana gana mana ” using the Openbeacon’s PWM in FreeRTOS. Miloch became so happy that he gifted the Openbeacon board and tag to Justin and he accepted Justin’s code to the openbeacon repository after some optimizations.

Justin.. way to go…

Sujith was running around with the KDE guys despite his health issues.  He was totally with the  KDE group that I seldom found him attending other sessions :) .. Kudos to Sujith

I felt sorry that I couldn’t attend Jain’s presentation on Scribus. I have also missed Pramode sir , who couldn’t attend  Foss.in/2009 due to health issues. Felt sad when Atul Chitnis said he is not going to lead from the next Foss.in onwards.  I think he should be the “BDFL” of Foss.in. I also felt happy when Atul Chitnis mentioned the amazing hack of “GPL” by RMS. In fact, it was the first time I heard Atul said something good about RMS :)

In effect, it was kind of “event of a lifetime” for me. Some of the snaps from Foss.in

Me along with Harald Welte and Stephan Schmidt

Khasim and Sony Team

Khasim and Sony Team

7

User 2 Hacker workshop at NIT, Calicut

December 6, 2009

I have started my journey from Bangalore to Kozhikode on October 23.  The purpose of my journey was to conduct a workshop on Tathva-09, the three-day annual techno-management festival of the National Institute of Technology, Calicut (NIT-C).

A week before this, Vivek (my friend from GEC who is currently doing in MS in NITC, a GNU/Linux hacker and geek) has called me and asked me whether I can present a session on how to contribute to Free Software projects. Though, it was the first time for me, I never wanted to say “NO” to Vivek. I have agreed to conduct the “User2Hacker” session and prepared the presentation in Latex+ beamer using Lyx.

I have reached NITC campus on 24th, Saturday morning. The organizers has arranged for a cab to pick me and they also arranged accommodation for me at the NITC hostel.

Since  I was free on that day, I have decided to attend the “beagle board” session by Khasim. The session was very interesting and Khasim demonstrated some amazing ideas using beagle board. He also mentioned about the new “Hawk Board”.After that event, me and Vivek went to the Lab to setup the softwares needed to conduct the “Hands on session” . We have installed vim, indent, svn, git ..etc on  20 machines.

Next day, I went to Vivek’s room after breakfast. After that,  we went to the lab. As I have called up Pramode sir about the talk, he has informed a number of students about the talk and almost 10 people from GEC, Thrissur came to attend my workshop. The total number of students attended the workshop was around 50. I was happy about this number as this was the healthiest number of participants for a “Hands on workshop”. Later I have presented the “User2Hacker” workshop.

User2Hacker @NITC

User2Hacker @NITC

Response from the students were very good. Some of them hav already contributed to the FOSS community. Some of them are willing to contribute provided somebody guide them in the right way. I liked their attitude and determination. For me, this was the purpose of my workshop. I am glad that I could at least make a number of  to seriously think about the various possibilities of the FOSS world.

The organizers were very energetic and professional. I felt the freshness of college after a couple of years. I thought about my days in GEC. The organizers has arranged a cab for my travel from NITC to Kozhikode Town.

I have tried the “Manchurian Dosa” for the first time from Kozhikkode. It is similar to Masala dosa .. however, in Manchurian Dosa, they replaced ordinary “masala” in masala dosa with Gobi Manchurian. It was an experiment worth trying :)

The Hindu reported “The User 2 Hacker workshop had a positive response” : http://www.hindu.com/2009/10/26/stories/2009102650160200.htm

3

First (silly, silly, silly) official kernel patch

September 23, 2009

Today, I got a mail from Greg Kroah-Hartman !!!

Starred from Greg Kroah-Hartman <gregkh@suse.de>
to linux-usb@vger.kernel.org
cc Maxin John <maxin.john@gmail.com>,
“Maxin B. John” <maxinbjohn@gmail.com>,
Greg Kroah-Hartman <gregkh@suse.de>
date Wed, Sep 23, 2009 at 7:25 PM
subject [PATCH 056/142] USB: serial: Spelling correction in Motorola USB Phone driver
hide details 7:25 PM (24 minutes ago)

From: Maxin John <maxin.john@gmail.com>

Spelling correction in Motorola USB Phone driver

Changed: * Mororola should be using the CDC ACM USB spec, but instead
To: * Motorola should be using the CDC ACM USB spec, but instead

Signed-off-by: Maxin B. John <maxinbjohn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

drivers/usb/serial/moto_modem.

c |    2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff –git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c
index b66b71c..99bd00f 100644
— a/drivers/usb/serial/moto_modem.c
+++ b/drivers/usb/serial/moto_modem.c
@@ -8,7 +8,7 @@
*  published by the Free Software Foundation.
*
* {sigh}
- * Mororola should be using the CDC ACM USB spec, but instead
+ * Motorola should be using the CDC ACM USB spec, but instead
* they try to just “do their own thing”…  This driver should handle a
* few phones in which a basic “dumb serial connection” is needed to be
* able to get a connection through to them.

Wow, he has accepted my silly patch. It is now in the linux-next git tree

Link to the patch: moto_modem.c

It was one of my dreams to submit patches to the Linux Kernel (can be anything, just anything).  Now it is true !!!

It’s now in Linux-2.6.32-rc1 tree:

2