Monday, March 22, 2010

Matlab-Java Integration, Working note.

Since Matlab runs on a JVM, it can easily integrate JAVA classes. Here is a quick view, mostly taken from the Matlab documentation.
 
[mFns, mexFns, javaClasses] = inmem; %Check which classes in memory

% classpath 
which classpath.txt
edit classpath.txt 

% imports
import java.lang.String
L = import % return import list 

% creating objects
strObj = javaObject('java.lang.String', 'Hello World')
frame = java.awt.Frame('Frame A') 
setSize(frame, 800, 400)
newFrameRef = frame

% concatenating object using cat or [] 
myObjs = [strObj; frame] 

% save trial.mat myObjs 
% load trial.mat 

% getting class attributes
names = fieldnames(strObj, '-full') % second argument optional 

% accessing object data
frameDim = getSize(frame) 
h = frameDim.height 

w = java.awt.Frame.WIDTH % static data, say, counters

% test class name
if (isjava(obj))
    name = isa(obj, 'class_name')
end

% invoking methods
% obj.method(args) OR method(obj, args) 
getTitle(frame) 
javaMethod('startsWith' , gAddress, str) % longer method names
java.lang.Double.isNaN(2.2) % static methods
javaMethod('isNaN' , 'java.lang.Double', 2.2) % static javaMethod 

methodsview java.awt.Frame % class name 

javaArray('java.lang.Double', 4, 5) 

Saturday, February 13, 2010

try out buzz - blogspot integration

Trying to incorporate this in google buzz

ComputerScience@Mattel


Mattel Inc, makers of Barbie Dolls are releasing a new Barbie, who is a computer engineer (Related IEEE Spectrum Article).

The release is scheduled for tomorrow coinciding with Computer Engineers Week starting tomorrow. One might wonder with the choice of the organizers starting the week to coincide with Valentine's Day :)

This is especially relevant considering the fact that the number of women in CS is decreasing; and the special incentives both by the Industry and Academia to promote women in the field, e.g., Anita Borg awards, IBM's EXITE, etc.

Personally, I wish luck to the efforts :)

Thursday, January 7, 2010

The road ahead.

The article, The Best and Worst Jobs, puts actuaries as the best job on a number of categories, followed by software engineers and computer systems analysts.

Interestingly, one thing they all have in common is that they empower others to do their jobs "better" or "efficiently". Put in simple terms, the end result of their effort does not result in any physical goods/labor, etc. Yet, the number of software professionals is growing every year.


One interesting analogy may be made to the machine operators in the 40s. They were necessary to operate the complex machines that resulted in the mass-production. However, they were eventually replaced with the advent of automation. The same pattern, though yet in its infancy, can be observed in terms of automated IDE's, code helpers, etc.

Further, while leaders like of the business such as Google, Microsoft, tend to constantly innovate, will the market for software code allow for multiple mediocres providers to survive. In fact, we already see that 1 in 10 software startups eventually fail. Now, one may speculate that while radios have since been absorbed into cell phones, and hence there is and will be a constant need to VLSI engineers, one should also note that even in that domain - most of the processes have become automated.

Ultimately, major progress in a field occurs while trying to solve problems imposed due to real world limitations. Computer science relies on other fields of science to provide it with problems which it tries to model in some fashion. This is also partly true of mathematics. Therefore, there will always be a need for great mathematicians.
However, how many mediocre mathematicians can be found except in educational institutions :) When we factor in the fact that usually, only those who are interested in mathematics tend to become mathematicians, and that number is considerably lower - one might begin to see an uncomfortable truth.

The average software engineer of the future whose predecessors wrote mediocre code for automating a mundane process will find himself out of a job in a market filled with many competitors and shrinking opportunities. We will probably see this trend over the next two decades.

Friday, November 6, 2009

BSNL broadband on Karmic Koala

I just installed the ubuntu (studio) 9.10 (karmic koala) on my brother's laptop. Installation went beautifully - including partition resizing (though the progress bar during partition resizing does not increase for a long time ~ 5mins ; it just suddenly is complete).

I've a BSNL broadband (dataone) connection with a UT300R2U modem supporting 1 Ethernet connection at IP: 192.168.1.1 and one USB to Ethernet connection at IP: 192.168.1.2 Couple of things though,

First had to move the ethernet cable from PC to laptop. So used the USB connection with the driver from: http://renirajnr.googlepages.com/downloads or alternatively from: http://rapidshare.com/files/65525451/UT-300R2U-USB_Driver.rar

The configuration for windows XP after installing the USB modem were as follows:

IP: 192.168.1.5 (actually can be any number above 2)
netmask: 255.255.255.0
gateway: 192.168.1.2

DNS Servers:
primary: 192.168.1.2
alternate: 208.67.222.222 (open DNS servers)
alternate2: 208.67.220.220

The modem settings for the USB connection to UT300R2u can be checked at http://192.168.1.2/ with the username "admin" and password "admin". The connection type most commonly is pppoe and one has to give the username (often the phone number) and password provided by bsnl.

Now that there was a working desktop internet connection through usb, I focussed on the laptop and got a pleasant surprise. The ethernet connection (dhcp) worked out of the box after a restart.
The settings for the static ip case were as follows:


IP: 192.168.1.4
netmask: 255.255.255.0
gateway: 192.168.1.1

The following code can set it up for the static case:

sudo ifconfig eth1 192.168.1.4 netmask 255.255.255.0 up
sudo route add default gw 192.168.1.1 eth1


(Ubuntu karmic names the ethernet connection as eth1 instead of eth0)

Anyway, now that I 've a working connection, I'll be spending most of today to get the system up to date.

Saturday, October 31, 2009

Formulaic literature

I was looking at Patrick Rothfuss's blog, whose first novel "The wise man's fear" was an award winning novel in the fantasy section. I read the book on a train journey between Bangalore-Jaipur twice, and seriously enjoyed it.

The second book has been repeatedly delayed. However, he has written a long blog post defending himself. One of the really funny thing is this guide to writing Mill's & boon romances.

http://www.eharlequin.com/articlepage.html?articleId=1102&chapter=0

the ABCD of indian mobile market

I attended the Mobile Application Conference at Nimhans convention center today. Interesting talks. Some of the key points made were

1. India vs Bharat dichotomy - N5800 vs 1100
2. 3G will affect the high end segment
3. small town segments - different needs (vernacular, etc.)

An interesting observation by people in the business was as follows: Indians are in general penny pinching, however, they are willing to pay for the following over mobile segment
A - astrology
B - bollywood
C - cricket
D - devotion

The surprising thing is that business such as SMS for businesses/market alerts were not mentioned.