Saturday, January 24, 2015

Mount Moto G2 in Fedora 20

For some reason on my desktop, plugging in the MotoG2 didn't auto mount it. With the Netbook I had got this to happen automatically.

But my terrible memory meant that I forgot what I did. So once again I was searching for a way to get this resolved when I found this site.

The site had detailed instruction on getting an Android phone to mount in Linux. Here's what I did specifically in Fedora 20.

  1. First I installed the relevant packages
    • yum install gvfs-mtp kio_mtp libmtp simple-mtpfs
  2. Then used the command to find the list of phones
    •  simple-mtpfs -l
  3. Finally mount using the following command
    •  simple-mtpfs
  4. To remove, all that was required to do was
    • sudo umount <mount-point-directory>
 As simple as that!

Setting up a restricted Sudoer on Fedora 20

Since my kids also use my primary system, I no longer could give full sudo access to the default family user account and need to ensure that only I could administer the system.

On a previous occasion I had manually edited the /etc/sudoers file. But this time I learnt about a command called visudo.

The visudo command is similar to vi with the added benefit that when the editor is closed it also validates the file.

My main aim was to enable using the truecrypt utility from the normal user rather than from root.

With the help of this command I was able to make the change to the sudoers file. Below I've listed all the options I tried with my understanding of why they worked or didn't.

  1. I create an alias for all the commands I wanted to be able to run as a normal user. This is a short cut instead of having to use this list when granting users permissions
    • Cmnd_Alias TRUECRPT = /bin/mount, /bin/umount, /usr/bin/truecrypt
  2. Next step was to all the specific user access. In this example, username is the login user.
    • username    ALL=(ALL)       ALL
      • The command resulted in the user being able to run all the commands after being prompted for the username's password.
      • This was the previous setting that I wanted to remove.
    • username   ALL=(TRUECRPT)
      • This enabled only the relevant commands to be run by the user after the user enter their password when prompted.
    • username   ALL=(TRUECRPT) NOPASSWD: ALL
      • This resulted in a syntax error detected by visudo
    • username   ALL=(TRUECRPT) NOPASSWD: TRUECRYPT
      • This resulted in a syntax error detected by visudo
    • username   ALL=NOPASSWD: TRUECRPT
      • This was the command was the one that worked for me. It allowed the use of truecrypt and it's automounted partitions to be accessed without prompting the user for passwords.
With this I finally (think) I've understood how to configure sudoers. I'll update this post the next time I need to reconfigure it.

Saturday, September 6, 2014

Configuring the Samsung N150+ for sending emails

I've been experimenting with attempting to send emails from the command line but realized that I had never configured the laptop to do so.

A short search revealed this blog which had simple steps to help configure email. I've copied those here too.

su
yum install sendmail-cf
cd /etc/mail
cp sendmail.mc sendmail.mc.original
cp sendmail.cf sendmail.cf.original
vi sendmail.mc

Remove dnl from the beginning of  these lines: (Copy and comment out the original line for safety)
  • LOCAL_DOMAIN (‘localhost.localdomain’) dnl
  • FEATURE (masquerade_envelope) dnl
  • FEATURE (masquerade_entire_domain) dnl
Enter my domain name "<machine>.<domain>.home" at these two lines:
  • MASQUERADE_AS (‘machine.domain.home’) dnl 
  • MASQUERADE_DOMAIN (machine.domain.home) dnl

su
cd /etc/mail
m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
service sendmail restart
 
Finally a short test:

sendmail -s "Testing" testEmail@test.domain < /dev/null

I realized that I also had to check my spam email for this mail :-)

Sunday, October 20, 2013

Selecting a new camera

A few years back I was in the market for a new camera. The variety of options out there really made it hard for me to make a selection!

I like to think I'm a photo enthusiast. But I finally acknowledged that I don't get too much into the technicalities of photography but I enjoy taking photographs which essentially means composing them and framing the photograph. Secondly I was looking for a camera I could use on a safari I was planning to take as well as later to capture moments in get-togethers with family and friends. Occasionally I would like to indulge in "photography" of landscapes from a hobby perspective. So I was looking for something that would be generalistic and I could use the same camera in various situations.

So with that background I'd like to share the process I went through to make my camera decision.

The first decision to make is identify your budget. Trust me, this is important as without this you would not know when to stop. Having said this, I'd say keep a budget range i.e., what you you would like to spend and the absolute limit you should not cross. The latter is a financial decision and should be made without emotion and should be used to ensure you do not over spend.

Now we come to cameras. One of the decisions is whether to go for a "still" camera versus a "video" camera. With today's technology the line between these is getting thinner and thinner. I would recommend a video camera but with one major caveat. Video cameras require a lot of post processing, i.e., after the shot, a lot of time will be spent to edit the shot or even to identify frames to print. Another downside of video cameras (as opposed to still cameras) is low light shooting. Most commercial video cameras will not come with a "flash" option. So if you plan to take indoor shots it might be better going with a still camera that has video shooting capabilities.

For this entry I'm going down the path of choosing a "still" camera and hence from now on we won't talk about video cameras.

The next decision is whether to go with a DSLR or a semi-DSLR or a point-and-shoot digital camera. Without a doubt the quality of a DSLR is the best but it is not as versatile for 80% of the users I know off.
Unless you are getting into photography professionally or as a hobby I'd not recommend going for a DSLR. Another reason is the cost. The bare minimum "body" is rather cheap when you compare with the lenses you'll have to buy to get a decent zoom or wide angle shot. Not that the body is really cheap but keep in mind that with the DSLR costs can easily shoot up to get "what you want" out of the picture.
Yet another reason I didn't go for it was the need to change lenses for different shots. And then when you have too many lenses, carrying them around is an issue as well as taking a shot which may make the camera to heavy to hold and may mandate a tripod.
While they are the best, I wouldn't recommend DSLR for those of us who do not want to get into the technicalities of photography which includes understanding the mechanics of light and lenses as well as the time involved in selecting the right lens and switching them and of course the cost of it all!

It might be quite obvious from my paragraph above, the reasons I didn't go for the DSLR. This meant I look at the point and shoots or the semi-DSLRs. However, since both of these pretty much have "fixed" lenses, my research recommended getting a camera with the maximum zoom as this is the one thing that cannot be changed for such cameras. Considering I was going on a safari, I essentially looked for cameras with the maximum available zoom.

Now even with "Zoom" ensure you look for optical zoom. This is essentially zoom made available with lenses giving you the highest quality picture without distortion. Digital zoom would at some point distort and pixelate the picture and quality goes down as zoom goes up. Of course the downside is that as optical zoom goes up the size of the camera also increases.

Hence in this case you would have to balance the size which decides portability of the camera and the zoom desired. In my case, I just went looking for the cameras which had the best zoom. I found a Nikon, a Cannon and an Olympus all give me optical zooms in the range of 36x to 40x.

The next thing I did was to go see these cameras and look at the software loaded on the camera itself. In my case I couldn't find the Olympus so I ended up comparing the Canon and the Nikon.

I didn't do a very technical comparison. I liked both the interfaces (software).
I found the Canon to provide better quality images which I compared by taking a photograph of an advertisment at full optical zoom, then reviewing the picture at full zoom on the camera itself. The Canon had a shaper edges on the image than the Nikon.
The Canon was a bit more expensive than the Nikon but both were within my budget and so I didn't worry a lot about costs.
Next I looked at the video capabilities. Nikon won here because it offered full HD (1280) while the Canon offered semi HD (720). Secondly the Nikon also provided high speed recording which meant more frames per second albeit not at the highest quality. But still that meant I could shoot slow motion videos!
The Nikon also allowed one to take a "still" photo while taking a video recording which I've found to be an extremely useful feature and would recommend cameras that have this feature.

Ultimately I went for the Nikon with the highest zoom which esentially meant a semi-DSLR.

The money I saved (from buying the Canon) I invested in buying a second battery (which I strongly recommend) and a spare charger. The Nikon battery could only be charged if it's in the camera and I wanted the ability to charge my spare without using the camera.

Another suggestion when buying memory for your camera is to look for High speed cards. The standard cards are slow and I would strongly recommend buying high speed card to take your shots as that makes the camera respond faster. Have a look at the following websites to understand about the speed of the memory card:
The downside with semi-DSLR is that it is slow because of the motor used for zooming and focusing. DSLR would be a lot quicker one you get the hang of it but with a semi-DSLR taking the shot may take a while.

Hope you found this useful. In brief, if going for a still camera, decide your budget and get the camera with the highest zoom that fits the budget. And one last piece of advice. Technology changes quickly so do not spend too much on the camera. Look at useage requirements for the next two years before buying!

Happy buying!

Thursday, October 3, 2013

Setting up Tikona with D-Link DSL-2750U

I bought a D-Link DSL-2750U which is in my opinion the most versatile router I could find.

Versatile, because I can use it with an ADSL/ADSL+ provider like BSNL or a 3G provider using its USB port or a provider like Tikona that provides internet based on a ethernet connection.

Also its a N300 based router so I expect it to give me good Wifi Speeds. (Haven't tested that yet.)

Anyway, to cut my ramblings short, the intent of this blog entry is to document how I got the router to work with the help of Tikona's tech support.

Here are the steps:
  1. Reset the router to factory settings by pressing the Reset button under the router
  2. Connect a LAN cable from LAN port 1 to the computer
  3. Go to http://192.168.1.1/
  4. Enter the default user name and password (admin/admin)
  5. In the Local Network disable the DHCP server
  6. Then setup the wireless by going to the Wireless Basic option
  7. There setup the network SID (whatever you want)
  8. Hit apply
  9. Go to Wireless Advanced
  10. Select security as Auto(WPA/WPA2)
  11. Enter the network key (whatever you want)
  12. Hit Apply
  13. Reboot the router
  14. Disconnect the LAN cable from the computer
  15. Connect the LAN cable from Tikona to the computer
  16. Go to the login page (1.254.254.254) but do not login
  17. Disconnect the LAN cable from the computer
  18. Connect the cable from Tikona to LAN port 1 of the router
  19. Connect the computer/laptop to the Wifi network setup earlier
  20. Go to the login page (1.254.254.254) on the computer and login
With that I could access the internet using Wifi and Tikona. Next step was to secure the Wifi (hiding the SID, changing the default password, etc.).

So the router has proved that it can work with Tikona too as long as the DHCP server is disabled. Hope someone finds this useful.

Update:
I found out later that I could only connect computers to the Wifi as every device needed to login. Neither my phones nor my TV could login to Tikona's web site. So I decided to go back  to the plain-old WiFi router I used to have to share Tikona's connection and use this one for my ADSL connection only.

Wednesday, October 2, 2013

Making my Pentium-S 75MHz a bit torrent client

So the Pentium-S at 75MHz is probably technical worse off than the phone I own. But it was the first PC I owned! I'm sentimentally attached to it. And I want to use it.

Hell, so I decided, why not make it the bit torrent client. Get Linux with Transmission and SSH installed and use it for only that. No data, so should it not work, I don't care. Just reformat and start again!

But here was the plan. Install puppy linux & transmission and I should be off!

But things are never that easy.

So, first problem I faced, that when I tried to install the Wary Puppy (5.3). It wouldn't boot from the CD to which the ISO was written! I vaguely remember that this was an issue with the kernel used for this distribution and that the system did not support this.

So what I had to do was to install a really old version of Red hat linux, in fact this was before they forked it to Fedora core and RHEL! At that time (2001) I used to subscribe to PCQuest and in March every year the magzine would provide a distribution called PCQLinux which was based on Redhat's Linux. I found that redhat linux 7.1 was the one that would boot and so I installed it!

Once the install completed and I was able to login I wanted to begin work on installing Wary puppy. But things went up in smoke! Literally. I was rebooting the system when a puff of smoke came out the back and the system refused to start working.

I suspected the power supply had conked off. So, I bravely went and unplugged everything and took the power supply off intending to take it the next day and get it replaced in the store. But I decided to run one last check before I did that. At that time I noticed that I seemed to be getting a live line on both the input sockets. Turns out the cable I was using had shorted and on closer investigation I found the place where it had shorted. It was blackened and I concluded that's where the puff of smoke came from. So my next step was to get a replacement cable, replug everything back in and test. Which I did and found it all working! DUH! When things go wrong check the cable FIRST!!

Anyway, with that sorted out and a week later when I found the time, I had the option of manually installing puppy following the instructions at these websites

  1. http://www.puppylinux.com/install.htm
  2. http://www.puppylinux.com/hard-puppy.htm
But then I was lazy so thought of finding a different way to do it. I'll leave manual installation as a last option.

So what i did was to pull the HDD from the Pentium S and put it into another system. Boot of the WaryPuppy USB, run universal installer & the grub installer to ensure booting from the HDD and then switch the HDD back to the Pentium-S.

Only trouble was it didn't boot. There was a wierd error (something like "urr! wee..."). I put that down to an incompatible kernel. So the next step was to write out the oldest puppy I could find, viz., 'puppy-216-seamonkey' to CD. This too didn't work and I realized it too used the 2.6 kernel.

I was eventually stumped and virtually gave up. However, one Sunday, I thought let's give it the old college try once more.

I did do that and found a link http://www.murga-linux.com/puppy/viewtopic.php?t=9965 that explained how to manually install and configure puppy using Lilo.

Here's a summary of what I finally did:
  1. Created a directory /boot/wary5.5
  2. Copied the vmlinuz and initrd.gz to this folder
  3. Copied puppy*.sfs to /boot
  4. Modified /etc/lilo.conf and added the following
    1. # Puppy Linux
    2. image = /boot/wary5.5/vmlinuz 
    3. root = /dev/ram0
    4. label = Puppy
    5. initrd = /boot/wary5.5/initrd.gz
    6. append = "pfix=ram"
    7. read-only
  5. Once I saved this file, I then ran lilo.
  6. Rebooted and puppy started working! Or so it seemed
  7. Next step was to free up some disk space and remove the PCQuest Linux 7.1 based on Redhat Linux 7.1
  8. For the record here's the partitions I set up on the 4GB disk
    1. 256 MB /boot
    2. 128 MB swap
    3. Rest all in a single root partition
Well the sad part was that puppy booted but I believe Wary Puppy couldn't load the drivers to read the hard disks.

After a while puppy would just drop to the "init" . At this point I kind of gave up and turned to the puppy linux community for help by posting this query on the forum.

After a couple more frustrating weekends trying out various suggestions, I was ready to give up.

Then one day, my PC refused to boot. A couple of times I tried and the same result, it hung after a while during the boot process. I was really disappointed and discouraged!

But come weekend, I prayed (really) and tried again, and the PC didn't boot but it gave a memory error! So, I opened up the unit, took off the four sticks of RAM, wiped them clean and reinserted them back into their respective slots. And this time the PC started up!

Next, I booted in PCQLinux 7.1, and copied across the files for puppy linux 2.0.2 opera version, modified the /etc/lilo.conf to boot using these files and rebooted the PC.

To my absolute delight, PUPPY booted up! I was thrilled. As another experiment I rebooted into PCQLinux7.1 and copied across the files for Puppy 4.1.2 and rebooted. That worked too! Now that I was on a roll, I gave Wary 5.5 another try, but this failed at the same point and refused to boot.

So now that the system was up, I started exploring it all and found that puppy202 was more responsive that puppy412. So I decided to stick with 202. Besides 202 came with transmission out of the box while 412 didn't.

Having done that, the next thing was to start a torrent. Unfortunately, the version of transmission on puppy202 didn't recognize magnet URL schemes. The next hurdle was to find a way to convert magnet URLs to .torrent files. Here I turned to Google and found the following link which allowed just that. So I converted a test URL to a torrent and tried to do the download. The sample I used was converted to the following torrent file.
I don't remember the result nor the attempts to get this to work.

However in all my searches I couldn't find software compatible with puppy202 so I decided to continue with puppy4.1.2 and I found all the software I wanted off the shelf (kind of).


I also found this site which provided me options to download pet files for transmission. I had earlier tried to installing transmission downloaded from Barry's page here. This worked but was a version of transmission that didn't work with magnet URLs. The former site's 4th download had everything statically linked or so I thought. There was a dependency missing, viz., libfio-2.0.so which I found here. But I continued to still get errors as described here but I realized I could still run transmission in the CLI mode using the following commands
  1. transmission-cli or transmission-daemon
  2. transmission-remote
  3. Using the web browser once transmission is started by going to http://localhost:9091/transmission
But my final hurdle still needed to be crossed, viz., setting up an SSH server to access the system remotely. I left this for last thinking it would be easy since I'd seen a few entries about setting up an sshd server on puppy. And it was relatively simple when I found this link. Thanks to Sven, install and everything was running. Needless to say, I changed the default passwords for both root & spot and I was able to ssh into my puppy server.

With that I was almost at the end of my journey. Unfortunately, the journey never ends. I found that X forwarding on the ssh server wouldn't work and there was no way to login to the 'console' of puppy. I also wanted to get LILO setup on puppy so I could get rid of the PCQuest installation. Alternatively I need to get grub installed. So my setup continues...

For VNC and viewing the console I used X11VNC which I found here. (Plain  old vnc is available from here but does not work on the display 0, i.e., the main console). Installing server and client was simple enough. Started x11vncServer from the menu, and chose to start it every time the system boots up. Then few more screens (enter vncserver password, etc.) and it was all started.
From another system (my laptop) I tried to connect vncviewer to the :5900 but that failed. That's because I only allow ssh through my firewall. So, I now connected to the puppy PC using ssh and local forwarding (-L5900:localhost:5900) to enable connecting to the system's console (screen 0 in VNC). That freed me up quite a bit and I could administer the system remotely.

Finally I also forwarded the transmission web port (-L9091:localhost:9091) to enable access the transmission web interface remotely. I also created a symlink to /root/.config/tranmission-cli as /root/.config/transmission-daemon which allowed me to start a download using transmission-cli and then continue using transmission-daemon.

And finally to get everything started up automatically on a reboot I wrote a small script and invoked it /etc/rc.d/rc.local. rc.local made a call to the script startTransmission.sh which contains the following lines of code:

  # Starts the transmission daemon
  transmission-daemon
  # Verifies already downloaded files for the first torrent in the list
  transmission-remote -t 1 -v &
  # Gets file# as I don't have enough space to download the full torrent
  transmission-remote -t 1 -g 1,5,6,7,8,9,10

With that my project came to an end. Will append and update this blog post if I think of anything later.

Update:
One more useful link to remember is this one which helps to autostart GUI applicaitons on different desktops. If I ever need it this will be good to remember.

Update:
While searching for alternatives to allow a central file server, I found this link which claims to be a tool to remotely login into puppy. I've not tried it out, but it maybe a useful one to try

Tuesday, January 22, 2013

Installing/Upgrading to Fedora 18

Finally found some time on the weekend and got one of the systems at home upgraded to Fedora 18. And it happened to be a long overdue upgrade considering the previous version was Fedora 12.

I was expecting a simple upgrade and it was that. Quick, simple and relatively easy.

But there were a few bits of customization I had to do. I'm using the rest of this post to document the things I discovered and did
  1. Quite obviously all the games I had installed on this had to be re-installed. And I had to copy across a number of repositories for yum too.
    1. Adobe repository for flash player
    2.  rpm fusion for all the non-free stuff
    3. plex repository for plex media server to stream multimedia to my TV
  2. The installation didn't allow me to choose my hostname and domain so I got stuck with localhost.localdomain. Changing it required me to use the command hostnamectl which made it permanent across reboots. Source: http://docs.fedoraproject.org/en-US/Fedora/18/html/Release_Notes/sect-Release_Notes-Changes_for_Sysadmin.html
  3. On another system I wanted to run Preupgrade.But FC18 has stopped support. Instead you have to use a tool called fedup. More details here: https://fedoraproject.org/wiki/FedUp. Some useful hints for update also available at https://fedoraproject.org/wiki/Upgrading_Fedora_using_yum
  4. Plexmediaserver refused to work. Looking over the logs I realized that SE was preventing rsync from writing into the plugins directory. So, I had to add a policy to allow this using a few commands one of which was audit2allow. However this command wasn't installed by default in FC18 and I had to install it using yum install /usr/bin/audit2allow. Source: http://danwalsh.livejournal.com/61710.html
  5. To get Plexmedia to work finally I had to run the following commands:
    1. grep  rsync /var/log/audit/audit.log | audit2allow -m mypol
    2. semodule -i mypol.pp
    3. systemctl stop plex
    4. cd /var/lib/plexmediaserver/Library/Application Support
    5. rm -rf Plex\ Media\ Server
    6. systemctl start plex
    7. systemctl status plex
    8. The above command highlights any errors. I saw a lot of failures with rsync and hence started fiddling around with the SE Linux policies.
    9. I had to repeat the commands about 6 times and it still didn't work
    10. Finally, I gave up and disabled SELinux. (in /etc/sysconfig/selinux) I'm sure there is another way but I was running out of time and patience.
    11. Rebooted and plex started up. So its confirmed that SE Linux was preventing rsync.
  6. Good links on plex adminsitration
    1. http://wiki.plexapp.com/index.php/PlexNine_PMS_TipsTricks#Linux
    2. http://wiki.plexapp.com/index.php/PMS
    3. http://wiki.plexapp.com/index.php/PlexNine_PMS_TipsTricks#Plex_Media_Server_Tips 
  7. With that success I then tried to upgrade another existing FC17 system using Fedora Update, aka fedup, to upgrade the second system to FC18.
    1. This command line utility is simple too:
      1. fedup --network 18 --debuglog fedupdebug.log
    2. This was for a network update, i.e., the latest versions of the packages I had installed were downloaded and then once I rebooted there was an option to Upgrade.
    3. The only issue I faced was that I kept getting a no host found error when downloading the package perl-ExtUtils-ParseXS-3.16-235.fc18.noarch.rpm.
    4. Finally I had to copy this off the ISO I had downloaded to use for the fresh install on the first system.
    5. Once that hurdle was crossed the remaining packages were downloaded and the upgrade was smooth.
    6. I'm now blogging this using the upgraded FC-18.
    7. One weird issue I'm facing right now is in the browser (Opera) when writing this blog, after typing about 3-4 characters, the cursor moves to the start of the line, types a j and then starts typing normally for the next 3-4 characters.
      1. I'm hoping this is some temporary issue and a reboot resolves it.
      2. If not, I'll update this post with the details.

Setting up FC after a fresh install

Fedora Core (FC) has this awesome release cycle of 6 months and every time they come out with a new version it's great. The downside, I've got to do an upgrade or a fresh install every six months. While they do their best to enable users to upgrade to the next version, sometimes you just have to do a fresh install. And then it takes me about six months to get the system customized and working with everything I want (not need).

So the idea of this post is to help me reduce that time the next time I do a fresh install. I plan to list all the 'new software' I install here along with instructions (and links) for easier use next time.
  1. After the fresh install do a 'yum -y update'. This will ensure every thing's up-to-date
  2. Add my user name to the sudoers file. Edit the /etc/sudoers file and add the following line after the Defaults section. The Defaults section is a bunch of lines starting with the word Defaults. When you edit the /etc/sudoers file add the following line to it:
    <username> ALL=(ALL) ALL. This will enable the sudo command with all sudo permissions to username. Not the most secure, but the most convienient.
  3. Install synergy
  4. Install the rpmfusion repositories for yum using the command:
    sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
  5. Run the following commands:
    1. sudo yum install kdenlive
    2. sudo rpm -ivh adobe-release-i386-1.0-1.noarch.rpm
    3. sudo yum install flash-plugin nspluginwrapper.x86_64 nspluginwrapper.i686 alsa-plugins-pulseaudio.i686 libcurl.i686
    4. sudo yum install tiger*vnc*server*
    5. sudo yum -y update

Sunday, October 24, 2010

Removing Linux from a dual boot system

I've had to remove Linux on some systems which were dual bootable with Linux. (As much as I prefer Linux, sometimes Windows is the right system to have)

In the past, I'd used the windows 98 rescue disks and the command:

fdisk /mbr

This worked well for me previously, but this time I had a system without a floppy drive and was at a loss to be able to run fdisk on Windows XP.  That's when I found this site and tried the recommendation and ran the following command:

fixmbr

I was intimidated at first by all the messages I saw on the screen, but went ahead boldly and ran everything. And it worked well. I now booted straight into Windows and never went through the grub login screen!

The next step was to get into windows disk manager and drop the linux (and linux swap) partitions and reformat them to NTFS.

Once done, I now have a system free of Linux.

Thursday, April 29, 2010

Improving your Code

In my experience, I've come across engineers of different calibre. Some who are natural engineers (developers or QA) and others who could do with a bit of help to get to the point of being great engineers. Being a developer I've always been on the look out for ways to improve the code that is produced. The other day I came across this presentation and it helped me to organise my thoughts on the subject. I've summarised the presentation here and added my opinions to too
Composed methods
Each method does one task. This makes it granular and easy to read and understand.
Within a method all operations are at the same level, functionally.
Smaller methods also are documented by the method name. In fact, working backwards will help you to identify methods that need to be refactored. After implementing the method, change the name to reflect what the method does. Instinctively, you'll identify that the method name is too long or it does not summarise the operation correctly. This means the method needs to be refactored!
Test Driven Development
Every engineer I've spoken to has heard this term and most aren't aware what it means and how to do it. The most common question I've heard is: "What's the use of unit-testing?". I'm not going to get into that discussion here, but will summarise the benefits.

  1. Think like a user. The code/implementation being delivered needs to be used.
  2. Aids in created composed methods, because smaller atomic methods are easier to test
  3. Improves reliability by providing an automated regression suite
Static Analysis
FindBugs and Checkstyle, are two tools that help in reducing common bad practices, bugs and code complexity.

Good citizenship
In other words, ensure all references have the right scope. This includes:
  1. Scope identifiers, viz., private, default, protected, public. My recommendation is make everything private and increase scope as and when required
  2. variable scope, viz., block, method, field, static. My recommendation again is to declare a variable as close as possible to it's point of usage and take it higher up only if required. Another recommendation is to rather pass values around using method parameters rather than increase a variable's scope.
With these two it implies that one should avoid using static references. This can further be extrapolated to avoiding SINGLETONS. Singletons combine responsibilities, making objects global and difficult (if not impossible) to test. Instead create a POJO to hold the data and a factory to create a single instance. This not only separates out responsibility and concerns but also make it easier to test.
KISS
Keep It Stupidly Simple! That also means, choose the simplest implementation for the current requirement. Don't go about indulging in speculative development. A lot of the times, simple things are cheap to throw away. If it gets complex you probably need a framework and should look at reusing existing ones rather than building a new one. Simple code is refactor-able and easy to change hence resulting in more agile and adaptable implementations.
Refactoring is not rework
Many times I've heard the complain:
"We had to change <insert your code here> and we wasted time in refactoring. If only we had done a little up front design we would have done it right the first time!"

But this is not true. You saved time the first time you did it without having to worry about complexity. Secondly, if you followed the principal correctly, you would have implemented something simple and hence cheap to throw away. And Thirdly, who ever got it right the first time!
If you are a Linux fan, even today there are new releases of Linux and if you are a Windows fan, Windows is at version 7.x No one got it right the first time, not even Einstein. So why do you expect yourself to be perfect. You will have to change whatever you do. If you come to terms with that, then why not be simple. Don't get attached to the code. And refactor. It's part of software engineering. It's part of implementation cost. It cannot be reduced! And hence it is not waste but part of the process.
This kind of thinking is usually triggered by managers asking: "How can we improve the process and reduce waste". Managers have to ask this. They control the budget and who doesn't want the best value for money? But we as engineers have to stop viewing refactoring as waste and something to be reduced. It is part of the software engineering process!
Ask Question
As simple as this sounds a lot of the time, questions aren't asked especially to authorities. This means you question suggestions, opinions, decisions, implementations, traditions, etc., etc. Questions will either lead to a change, hopefully for the better or will reaffirm that you've got the right implementation. So what's the harm in asking them? In today's world questions are no longer an indication that you don't know something. Quite the contrary, it's an indication whether you are paying attention and an indication of how much you've understood. I've always been of the opinion that 'There are no stupid questions, only stupid answers'. The only exception is when, you've not done your homework before asking the question or weren't paying attention. In which case, apologise for your bad behaviour' but still ask the question!


Monday, September 14, 2009

AIR on FC 11

YAY!!! Got AIR installed on my laptop!!! It's strange that Adobe refuses to publish a 64 bit version of AIR. Had to do a lot of R&D (another word for googling ;-) ) to find out the hacks required to get it working.

Adobe's official site has instructions on how to install it on FC-11 From this site got the hint to replace all *i386* packages with *i586*.

It's wierd that you need 32 packages to run AIR. What a pain!!! But it works. I got the Yammer client working, and will now once again try to get Tweetdeck working!

Update:

Tweet deck is working too! :-)

Tuesday, February 17, 2009

handling the apparent slowdown

Recently an ex-co-colleague put in an email questions that I do believe are on the minds of a number of people and that I've been asked a couple of times already...

  • How do you see the current market scenario?
  • Is there any opening in java/j2ee?
  • Also is it advisable to switch in this time frame, when companies are doing employee cuts?
 Good questions.And below is my Rs. 0.02...
 
In any scenario, it best to be where you know there is a need for your particular skills. In the current scenario of a slowdown, I'd suggest looking at it as an opportunity. This is the time to do the tihings you always wanted to do but were unable to find the time for it.
 
So as a few examples
  • this is the time to get that certification you've always been putting off
  • this is the time to do that bit of R & D on the new technologies you've been dying to give a spin
  • this is the time to join that open source project and contribute to it, not only with code, but maybe with feature suggestions, bug reports, reviews, etc.
On the job front, I wouldn't say that the market is down, quite the opposite! The market is hot but it's very choosy. Hiring takes place only if you match 80%-90% unlike earlier where even a 20% match was enough to hire a person. While it makes landing a job a little time consuming, it does mean that a job is more secure, as once hired there is a genuine need you statisfy and hence less likely to be laid off!
 
So my advice would be, do not panic and use this as an opportunity! And whatever you do, create a report. A simple blog, or a one page word doc which will be the additional proof that you've done something constructive. This will help not only you but also the organisation you work in.
 
What do you think?
 

Sunday, February 1, 2009

Design Patterns - Creational Patterns

I finally began a long overdue task of upgrading my design skills by reading the book Design Java. During this process I'll start another series to summarise my readings.

The book is based on another well know book by the Gang of Four but with a focus on implementing the original 23 design patterns in Java. Very rightly, it starts by highlighting the importance of design patterns today as:
  1. Design patterns describes the communication between objects
  2. They are recurring solutions to recurring problems, thus enabling reuse of solutions to common problems
Design patterns are divided into three categories, viz.,
  1. Creational Patterns: Cover the cases for object creation
  2. Structural Patterns: Compose groups of objects into larger structures
  3. Behavioural Patterns: Defines communication and data flow between objects in a system
Another thing I liked is the way the book highlights the learning pattern for design patterns.
  1. Acceptance: You accept that it is an important part of your work. I'm past this point and that's why I'm here! ;-)
  2. Recognition: This is the learning stage where you begin to recognise the patterns, both the problem and solution patterns
  3. Internalization: This is where you apply your knowledge.
These three steps aren't specific to the learning of design patterns but in fact are the general steps to learn anything and everything. It's an internalised process but knowing the explicit steps helps in understanding the process.

Two things to remember when using any design patterns are:
  1. Program to an interface and not an implementation: This principle is the at core for reducing dependence on an implementation. Programming to an interface allows implementation to change with time for any reasons, e.g., better algorithms, newer technologies, newer frameworks, etc.
  2. Favour Composition over inheritance: While this is not what we are taught in the OO theory, in reality favouring composition over inheritance eases up decoupling many a time. When I was first told this by one of my previous team leads (Irfan Mohammed), I thought he did not know what he was talking about! However, now I'm older (and hopefully wiser) and have realised the wisdom in his words then. I now go on preaching the same thing to everyone I meet!
Creational Patterns:
Creational Patterns are used when we need to handle special cases while creating new objects. The simplest way to create objects in Java is to use the new operator. However, many a time, special cases need to be considered and Creational Patterns may be used to solve them.

These are the five Creational patterns.
Factory Pattern
Creates different implementations for an abstract class or interface based on the input parameter(s). The client is unaware of the implementation being returned. If the implementation is changed, only the factory needs to be changed and the remaining part of the client is not affected.


From a previous post, I've also highlighted the benefits of using a static factory instead of calling the constructor directly. This is a variation on the Factory Pattern and I'd like to re-iterate to use the new operator only inside a Factory.

Abstract Factory Method
The Factory pattern applied to the Factory! Creates different factories that in turn provide different implementations for an abstract class or interface based on the input parameters.

Singleton Pattern
The Singleton Pattern is probably the most well know pattern. It's aim is to create a single object for a given class. There are a number of ways to do this in Java of which I favour the following:
  • Creating a static implementation
Use a private constructor to prevent object creation.
The methods and data within the class are static

This pattern doesn't create a single instance and can still fulfill the requirement of having a single point within the system.

The downside to this is that the object is not dynamic, meaning it cannot be passed around nor can it implement any interfaces. It is best suited for utility classes.
  • Factory that ensures only a single instance is returned
This has two flavours. An external factory or an internal static factory method. In both cases the factory ensures that an object instance is created only if one doesn't exist or returning the already created instance.

I favour the factory pattern over using static implementations because it is a bit more flexible and reduces the static coupling that the first method mandates. The additional benefit of the latter is that it can easily be extended to provide a pool of objects or to remove the singleton requirement if found necessary later.

Builder Pattern
From what I understand, the builder pattern and the factory pattern are different parts of the same coin.

The Factory or Director is used to create the Builder objects.

When the factory creates instances that are more complex in nature and which in turn build different implementations even though the interface implemented is the same. In terms of a UI, the builder is responsible for constructing different views or different UI to represent similar data in different representation based on a slight difference in the data. The book gives an example of using the Builder Pattern to create multi-select list of items a group of checkboxes if the number of items are three or less or a multi-select listbox if there are more than three items. The Factory decides which builder is to be created based on the data sent to it.

Prototype Pattern
The Prototype Pattern is largely used to create copies of an object. This is useful when the object creation is expensive. For example a database lookup or network call is required to populate and create an object. However, the same data in the object may be required to be manipulated or represented in different ways. Again an example from the book is of creating the prototype object after a database file lookup. Then creating a copy of the data a sorted list.

The book also talks about the default Java method for creating object copies, i.e., the clone method, and rightly highlights the common pitfalls of the clone method. IMO, the first rule for the clone, method is don't use it! But there are times you can't avoid it, and one has to be extremely careful in implementing an override.

Secondly, just overriding the clone method results in a shallow copy, i.e., all mutable referenced objects are common to both the prototype and the clone. If this is not desired and one needs a deep-clone Java does not really help you and you have to implement it yourself. Up until I read this book, this meant going through the complete object graph and recursively calling clone on every referenced object. But, the book highlight a simple cheat, use serialisation! It's so neat and elegant. Use a ByteArray to serialise the prototype using the ObjectOutputStream and then deserialise the object to create a deep-clone using the ObjectInputStream. Simple! Neat! Few lines of code! But it does have it downside, viz., every object in the graph must be Serializable.

The caveats for the prototype pattern is mainly it's impact on performance. While creating the copies of the prototype relatively cheaper than creating instances of the prototypes, there still is an expense of doing a deep- pr shallow-copy. Every instance retrieved of the prototype is always a copy which in turn will have a hit on performance.

My 2 paise here, especially in cases where read-only information is required, it would make sense to return an immutable interface to the object or an immutable clone if possible. But then this is a creational pattern and the reason one would use it is to create mutable instances of objects that are expensive to create from scratch. But I couldn't resist documenting my thoughts... (after all it is my Blog...uh... Blikki) :-D

Summary
To summarise this blog entry, I've gone through the first section of the book and looked at the creational design patterns, viz.,
  1. Factory
  2. Abstract Factory
  3. Builder
  4. Singleton
  5. Prototype
Of these I think Factory is the basis for all creational patterns and the rest are really subtle extensions of it. And this is how I'll remember them:

Factory creates objects. If the objects created are factories in their own right then the top factroy is an Abstract Factory.If the objects construct something like UI etc., then the objects are Builders. A Singleton is a Factory returning only one instance of the object while a Prototype would be one that creates copies of an object.

Five creational patterns all linked with the core pattern The Factory!

Sunday, December 14, 2008

Savio's Notes: Java Book: Effective Java - Chapter 2 - Item 1

The first in a series of notes about the book Effective Java by Joshua Bloch will cover Chapter 2 - Item 1. Some sharp readers would be wondering why not Chapter 1. Those who have read the book will be aware that Chapter 1 is more of an introduction to the book and it also will explain why I didn't make any notes for it. So worry not, you haven't missed anything yet!

Item 1

Use static factories instead of constructors
I never thought of it in these terms, but I had always felt uneasy whenever I used the new operator in code. I always tried to never to use the new operator and have either a third utility class that returned a newly minted instance or have a static method that did the same.

But Joshua Bloch puts it more eloquently and convincingly and here are his reasons:
  1. Static factories unlike constructors can have more meaningful names which in turn help code readability
  2. Static factories unlike constuctors do need to create a new object every time. They could implement some kind of caching mechanism to enable reuse of instances
  3. Static factories unlike constuctors can return sub-types of their return types
The book also lists disadvantages of this item as:
  1. Classes without public or protected constructors cannot be sub-classed. But he goes on to state that this may be an advantage as it forces the use of composition over inheritance which is further elaborated in Item 14
  2. Besides the use of naming conventions there is no way to distinguish a static factory from other static methods in the class
In conclusion the book recommends using static factories unless you are convinced that it dooesn't suit your needs. Alternatively if you are confused go with constructors as they are the norm.

From my part, I will now be trying this pattern more often to put in private constructors and use static factories. Maybe the convention to use would be to have the static factory name as getInstanceUsingXxxx(...)

Savio's Notes: An introduction to a blogging series

I recently got my hands on a copy of Effective Java - Programming Language Guide by Joshua Bloch. I've been meaning to read this book for quite a while now as I've heard nothing but praise from most people I know who have read it. Also, having read Effective C and absolutely loving that book, I'm a little biased because of the title of this book.

So I began reading it and got through the first three chapters and thought to my self: "Hey this is common sense stuff and still there are some common mistakes pointed out too!"

It's always great when someone else (a more famous person than oneself) confirms what one is thinking. Now I'm not trying to say that I've known everything that I've read so far. Quite the contrary I've also learnt a quite a bit of new stuff. Which is exactly why, given my terrible memory I though I should make notes for the same.

Now had I been in the office, I'd have Wiki-ed this. So rather than that, I thought let's start a kind-of series on my blog called Savio's Notes that will track these notes of mine on this and various topics.

As the title of the series suggests, the series is not one that is polished and proper. It is an aid to a quick reference and a summary of sorts of the things I'd like to remember.

I'll use the following convention for the title of the post when I create one that belongs to the series: Savio's Notes: Sub-series: Post title

With that introduction I'll now move to the first post in the series, viz., Savio's Notes: Java Book: Effective Java - Chapter 2 - Item 1 to Item 6

FC 10 - A good distribution that can get better

While helping the Sword CTSpace to set up the office during their transition out of Symphony, I had the opportunity to experiment with FC 10, i.e., Fedora Core's latest release, viz., Version 10.

First impression were excellent. This is a release that just great in terms of ease of use and hardware detection. In fact, up until this release, whenever I installed a version of FC on a laptop, I always ended up removing it because the laptop would never work as it was designed to work.

But this time, I had a new laptop, an Acer Extensa 4620 upgraded to 4 GB of RAM which came with Windows Vista Home Basic, 32 bit edition. The 32 bit edition of Vista refused to recognise all 4 GB and a bit of googling, revealed that this is an inherit limitation of the 32 bit OS.

So the alternative was to get a 64 bit OS on the laptop. Since FC-10 was freshly released I thought of using that and also because a 64 bit Vista required me to shell out more cash.

Well sufficient to say, I've tried it for a fortnight now, and I'm so happy I made the decision. Of course, there are a few things that annoy me, but I can live with them. For the record, here is a list of my failures (only because I gave up) with FC10:
  1. Dual display support: I failed with this both on the desktop and the laptop. No amount of R&D and trials & errors seemed successful. Finally from most of what I found on the net was that FC had changed the display related architecture from FC9 onwards and it was still in development.
  2. Webcam: The webcam doesn't work, but to be fair, I've not really tried to get it to work. (Now working as per update 3)
  3. Acer Keys: Some of them worked, like the sound, brightness while others (application quick launches) don't. Most of those that don't I rarely ever used even if I were on Windows. So not a big issue for me.
  4. Bluetooth: This works sometimes and not the rest of the time. When it does work, it's only for file transfers. I still can't get my Nokia to synch my calendar and contacts. I really miss the way Nokia PC Suite works on Windows and wish that Nokia would get a Linux version of PC suite out. ( (Now working consistently as per update 3)
  5. Opera: My biggest miss is that I couldn't get Opera for FC10-x64. It just refused to work. And I'm a BIG fan of the browser. I really miss it and currently get by using Firefox. (Now working as per update 1)
But I still think FC10-86x64 is GREAT! I couldn't think of using something else. Well... Maybe Ubuntu, but I've just gotten used to the way FC works I don't think I'll really shift. And of course there's Puppy Linux. Now that's a distribution that so very cool! I wish, we could have something like that for all our Linux distributions. But till that time comes, I'll stick with FC for my larger computers and keep Puppy as part of my the Emergency Rescue kit as well as for my older hardware and basic browsing needs.

However, my final verdict is still is to say with FC8 if you need stability and don't want to be hassled with cutting edge technology issues. But if your willing to rough it out a bit and learn a lot along the way I'd suggest going for FC-10 and you won't be dissappointed.

Update 1

I finally got Opera to work on FC 10. Yippee!!! Well for the record here's what I did to get it to work.

After a bit of a browse through the forums, I realised that there were a few who go it to work and that there is a special 64 bit version that needed to be downloaded. So back to the Opera download web-site. Unfortunately, the site doesn't recognise 64 bit version of linux correctly and hence I had to manually navigate and select the right version to download. Once done, this would not install because of a dependancy on libXt. When I checked, I had libXt installed and the latest version. Then, why???? Few more tries and it dawned on me... Opera wanted the 32 bit version, not the 64 bit version that I had installed!!! Duh!!! That was strange. So after a yum install libXt.i386 I tried installing opera again and success!!!

A bit strange that opera required the 32 bit library, but I won't complain, because I now have my favorite browser working on my favorite OS!!!

Update 2

Found some good stuff at http://www.mjmwired.net/resources/mjm-fedora-f10.html to help in the setup of FC-10. When used with caution and it is quite helpful.

Update 3

I'm not sure what I did but the webcam has begun to work. I do know that I did a yum update and also installed GYachE Improved an improved client for the Yahoo Messenger. After installing the new client I thought I'll check if it supports the webcam and it worked! I then tried Cheese the Webcam Booth, which I had installed earlier. And it worked this time. So another success on FC-10. Yipeee!!!

I also figured out to get the bluetooth to work consistently. I had earlier set the bluetooth applet for gnome to be visible always. After I changed this to be displayed only when bluetooth was active, everything worked well and consistently!

Update 4

I just managed to get Virtual box to recognize the attached USB devices. However to achieve this I needed to run VirtualBox as root. Which is not what I really want to do. Till I figure out on which file(s) I've not got the permissions on I'll make do with having to run it as root.

Thursday, November 6, 2008

svn+ssh setup at home

Finally I seemed to have managed to set up my SVN server to be accessible over the internet using ssh. And I owe it all to the excellent (and simplistic) notes found here.
And I didn't have to open any ports other than the already open SSH port.
Well Istarted off wanting to do it with http, but then thought hey, why open another port, let's get it working with the ssh stuff only. I had tried it once before using these formal instructions but didn't get very far.
Update
I've had trouble getting ssh with keys to work on the home dell box. Turns out it was an incorrect permission setting on the .ssh & key files. Anyways, thanks to this site I traced it out and set the permission to 600 for all the files and to 700 for the directory. Now I can try all the cool stuff I've been dying to try...

Update 2017-Mar-04
Once again, due to system failures and my normal SVN server's desktop refusing to start up I w as forced to migrate my SVN setup to another machine. I imagined it to be a daunting task. but it was surprisingly simple.

I setup the new server on the Samung N150+ netbook. Not ideal, but sufficient for my needs considering I'm patient and cheap. :-)

I've listed the steps below:

  1. Ensure svn is installed on the new system.
    1. Since my netbook was running fedora 24 I had to issue the following command "dnf install svn". Of course, since I'd installed it before there wasn't much more to be done.
  2. Ensure OpenSSH is installed.
    1. The command "dnf install openssh" confirmed that I had it installed.
  3. Ensure SSH is started at boot time.
    1. The command "systemctl enable sshd.service" took care of this requirement.
  4. Next I copied over the repository from the system that refused to start.
    1. Since my old system refused to start, I un-plugged the HDD containing my SVN repository and took it out of the system.
    2. Fortunately it was a SATA drive.
    3. So I took the Seagate external HDD that I had and removed the adapter from it.
    4. Next I plugged the internal HDD into the adapter and voila, I was able to access this drive using the USB.
    5. Then copying the repository across was a piece of cake.
  5. Finally, I created a sym-link to the repository using the command "ln -s /path/to/actual/svn/directory /repository"
  6. I was able to validate access to the repository with the command "svn svn+ssh://localhost/repository list". And I got my repository listed out.
During the time it took to copy the almost 60GB repository across (to another external USB HDD) I was able to update this blog post and still had time to spare.

Wednesday, June 25, 2008

Code Reviews

I've been asked repeatedly to document what I look for when I do a code review. While I've never been able to give what I think is a good verbal answer before, what I'll attempt to do in this post is to list down all the things I try to look for during a code review in no particular order.

  1. Spelling mistakes: Though calling a variable currentValue or currintValue does not really harm the logic it just makes code look less professional and harder to read and understand.
  2. Copy Paste errors: This is something that is most often overlooked and can cause so much of pain when debugging. Getters and setters that are copied & pasted and the variable being accessed/modified isn't. Error messages and codes are copied but not changed
  3. Feature correctness: Probably the most important thing in a code review is the answer to the question: 'Is the requirement met?'. Other questions include 'Is it met correctly?' and  'Are the conditions correct?' While reviewing functionality, I usually look at breaking the logic/conditions using negative scenarios.
  4. Code reuse: If the same line(s) of code are used in more than one place, it should be refactored.  New methods or new variables need to be created to ensure no two lines of code are exactly the same.
  5. Code reuse: Are there existing API's that do the same thing. Can existing API's be tweaked to do the same thing?
  6. Documentation: This is another thing that does not affect functionality. But documenting what is being done is very important. Most of the time the question I get is what should I write in the document.I usually ask a question in response: "Tell me what this code does?" And I've always received a great answer from the code-owner. I then tell them to put what they just told me into the documentation. To sumarise the documentation should contian what is being done. How it is being done can be found out by reading the code.
  7. Assumptions: Are the assumptions made valid both from a business as well as a technical point of view? Are null values handled?
  8. Tests: Is there enough of coverage? Is there a test that fails without the fix? In some cases especially old legacy code makes it hard to write tests. In this case documentation becomes more important. Not only in the code, but it also needs to be informed to QA and a test-case added by QA for their regressions. An update to the bug-tracking tool too becomes mandatory.
  9. Conditionals: Remove if/else/switch statements by extracting the logic in the conditions into external classes. Let polymorphism handle the decision making
  10. Simplify logic: At every step I look at reductions. Reduce lines-of-code, reduce instances used, reduce complexity. The KISS principle is the guiding force. For the unaware KISS stands for Keep It Simple & Stupid!

The biggest issue with performing code reviews is time. To reduce the time lost in reviews, here are a few suggestions:

  1. Code formatters: Today's code formatters have advanced quite a bit and they can be configured to automatically take care of coding conventions and simplistic documentation.
  2. Checkstyle: This will highlight coding convention deviations at the time of writing the code itself. So the developer can take care of this at the time of writing the code itself.
  3. Developer feedback: The developer should highlight areas of code that need special attention and deviate/change generated code.

Other than time is to imbibe into the developers the habit of performing peer reviews. Peer reviews provide the following benefits:

  1. First level of code reviews
  2. Learning new coding styles
  3. Sharing knowledge across the team. This includes domain knowledge, API knowledge, best practices, implementation styles, etc.

Tuesday, April 8, 2008

Installing a Jacuzzi

Recently we installed a bathtub-cum-jacuzzi at home. I learned a lot during this process and thought of using this post to highlight the same.

First let's give credit where credit is due:
Replacing a Bathtub
This web-site provides excellent step-by-step instructions and diagrams to guide a DIY enthusiast.
How to Install a Shower/Bathtub
This is less illustrative than the previous link but still contains a bit of useful information
How to Plumb a New Bath Tub
This link collaborates and confirms most of the information provided by the other two sites.

Now my 2 paise:
We decided to go with a 6 feet by 2.5 feet rectangular bath tub. We also added a six nozzle jacuzzi, three on each of the two longer sides of the tub. The tub is about 1.5 feet deep.

We started with this project because of a leakage from the bathroom into the one below which required us to remove and completely redo the waterproofing of the bathroom. Since we were tearing the bathroom apart it only seemed like the right thing to start this long overdue project.

Waterproofing the bathroom involves laying concrete followed by a layer of brick-bat, which is bricks along with a tar-like-substance. The bricks are added to absorb an water that might find it's way into this layer. Another layer of a plain cement concrete goes over the bricks. Once this sets then we kept water stagnant in the bathroom for a week to ensure there were no leakages. We also added dyes to the water and changed them out. First we started by adding blue ink to the water and then we switched over to red as the bathroom below already seemed to have a bluish tinge in the celling. (Probably from our previous tests to see the source of the leakage)

Having resolved the leakage problem, the next step was to place the tub. This is tougher than it sounds. Not only is the bathtub heavy it is also bulky with no place where one can get a good hold. We were three guys struggling to get it in place.

The layout of our bathroom did not allow us to place the bath-tub directly on top of a P-trap and hence we had to get an elbow assembly. A word of caution here, a standard CI elbow will not work as we learned the hard way. We ended up getting a Jaguar bathtub elbow fitting.

All plumbing joints for a bathtub should be able sealed. This includes the drain system. Because of the volume of water flowing it would be advisable to have threaded and/or sealed joints. However only using a sealant like M-Seal or car-patch is useless and will not withstand the pressure.

Once all the leak proof drainage is bought and tested it will be time to set the bathtub in place. First, put a layer of bricks and mortar. Though we didn't do this (I though of it after we finished), my suggestion would be to create a single brick platform along the complete area the the tub would rest on. Next, create a border with bricks such that the base of the tub will fit into this border. It does not need to be a tight fit. The idea of this border is to create an area for containment of a PCC slurry. Fill the PCC into this area and then lower the bath tub into this. IMO, this will allow the PCC to fill in any gaps that could exist below the tub thus giving it all the support it needs at the bottom. Since we did not do this, now when we stand at certain place in the tub I can feel the bottom flexing under my weight.

Having laid the tub's foundation, now place the tub gently over the wet PCC slurry. Tighten the drain and over-flow outlets and pay special attention to levelling of the tub. Even though we I did pay attention to this, the tub may have moved and we now have a small area of the tub that does not drain out. Test the levelling with a mug of water and ensure it all drains out.

That's it!!! Let it set for a day and the following morning your tub should be ready for use.

Another suggestion, when testing the drainage joints, block the outlet just before the P-trap (Nani trap). This way you test the complete drainage plumbing too. Most plumber will use the bathtubs drain plug to check for leakages which doesn't let the water enter the drain system at all. Plug the outlet in the P-Trap itself or if possible block the P-Trap to enable a thorough testing of the drainage system. Remember this is a bathtub which will contains tens of liters of water. Once this water gets into the drainage system even a tiny leak will not take long to become a major one and cause you a major headache in future. Everything should be absolutely dry!!! 

Monday, April 7, 2008

How important is the UI

Sameer made a good point about the UI being ignored by most designs. In fact I find this very strange. As far as I understand the client or the end user firsts sees the UI. Only when that is fine do the they evaluate the other things like performance & stability.

This is not only in software development. It's in every aspect of consumerism. When you buy anything, it's got to look good before it attracts you. Only after the first impression attracts you do the other factors come into play.

However, having said that, only a good UI will not clinch the deal. It's just the first step. Can you even think of buying a good looking car that performs terribly. In short, I disagree with Sameer that only the UI matters. No, the UI is 50% of the battle. The other stuff is the other 50%.

However what I think Sameer is trying to get at is that the UI though only cosmetic requires a large part of the time and effort and if not done well can screw up even the best and most stable and robust of applications deliveries. And the vice-versa is also true, i.e., a good UI actually makes the client happy and willing to be patient on the other stuff.