|
|
Tuesday, November 19th, 2002
|
|
|
|
My current company counter offered when I handed over my resignation letter. Quite a nice package. almost 100% increase in salary + promotion to Systems Analyst that will entitle me for a Team Leader position. So now just waiting for the counter offer in black and white to turn down the original offer by Fujitsu. Finally I can afford to live(comfortably) and probably get a car and move out of my university hostel to my own appartment.
|
|
Comments: Read 2 or Add Your Own.
|
|
Tuesday, November 12th, 2002
|
| Time: | 12:02 pm. |
| Mood: | hopeful. | | Music: | Minnalai Pidithu. |
|
|
Asked by my soon to be ex company to conduct ejb training for 4 weeks for some of the people who practically don't know Java and will probablly never use it. Funny but true. Anyway this will be a good opportunity to prepare myself to accept my university's offer to teach Java and Advanced OO part-time.
|
|
Comments: Add Your Own.
|
|
Saturday, November 2nd, 2002
|
| Time: | 1:11 pm. |
| Mood: | crappy. | | Music: | Ithayam - Poi Sollakudathu Kathali. |
|
|
I am getting too obssesed with this stuff http://oaks.nvg.org/nuss.html. Better go home and pack my bags for Penang
|
|
Comments: Add Your Own.
|
| Subject: | PhD |
| Time: | 1:06 pm. |
| Mood: | hopeful. | | Music: | Ithayam - Panikatrea Panikatrea. |
|
|
Finally managed to get enough money(RM2100) to do a PhD(permanent head damage) in software engineering(paid the fees yesterday). May of not fulfilled my dad's dream of seeing me as a medical doc, but in 3 years I still end up as a doc(even though not a medical one). I hope that comes close.
|
|
Comments: Add Your Own.
|
|
|
|
This is a sample victim of Kali Yuga http://home.earthlink.net/~kirby/philo/hindu.html First of all why do atheist do all they can to preach there is no God? A true atheist shouldn't preach anything. Else No Godness a.k.a Atheism will end up as a religion :). God nor no God, believing in something is better than believing in nothing. Things like this make me wonder, What if 15th century Spainiards were Atheist. What would they have used as excuse to conquer the unknown world or would they have had the will to do so in the first place?Cause "For The Greater Glory of Christ" wouldn't of been appropriate. What if the English were atheist in the 15th century? Would they have created 'polution' and 'mass slavery'(slavery was created much much earlier by some other goons)?There are so many what-ifs out there :). But I believe, people did what they did because of greed and not because they loved God. Most people still do what they do because of greed and not because they love God. Why do people convert other people? Cause God loves them for doings so? Nah it's because they believe they get to live in heaven with 1000 virgins *lol*
|
|
Comments: Add Your Own.
|
|
|
Going back home today. Deepavali in 2 days!
Penang here I come
|
|
Comments: Read 3 or Add Your Own.
|
|
Wednesday, October 30th, 2002
|
|
|
|
x-ray done, will be getting the results tommorow, a small setback on timing, but still good enough. Planning the stage for a better future.
|
|
Comments: Add Your Own.
|
|
Sunday, October 27th, 2002
|
|
|
|
EJB Training complete. Great reinforcing experience and a nice trainer too :)
|
|
Comments: Add Your Own.
|
|
Saturday, October 19th, 2002
|
|
|
My solution
import java.util.*;
public class MatArith
{
// START CODE
static int upper = 2147483647;
static int lower = -2147483648;
final static class Matrix
{
public static double[][] multiply(double[][] a, double[][] b)
{
if (a.length != b[0].length)
{
return null;
}
int rows = a.length;
int cols = b[0].length;
double c[][] = new double[rows][cols];
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
for (int k = 0; k < a[0].length; k++)
{
c[i][j] += a[i][k] * b[k][j];
if(c[i][j] > upper || c[i][j] < lower)
{
return null;
}
}
}
}
return c;
}
public static double[][] add(double[][] a, double[][] b)
{
if (a.length != b.length || a[0].length != b[0].length)
{
return null;
}
int rows = a.length;
int cols = a[0].length;
double c[][] = new double[rows][cols];
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
c[i][j] = a[i][j] + b[i][j];
if(c[i][j] > upper || c[i][j] < lower)
{
return null;
}
}
}
return c;
}
public static double[][] minus(double[][] a, double[][] b)
{
if (a.length != b.length || a[0].length != b[0].length)
{
return null;
}
int rows = a.length;
int cols = a[0].length;
double c[][] = new double[rows][cols];
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
c[i][j] = a[i][j] - b[i][j];
}
}
return c;
}
public static int[][] convertToInt(double[][] a)
{
int rows = a.length;
int cols = a[0].length;
int[][] value = new int[rows][cols];
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
value[i][j] = (new Long(Math.round(a[i][j]))).intValue();
}
}
return value;
}
}
public String[] calculate(String[] A, String[] B, String[] C, String equation)
{
double[][] D = null;
StringTokenizer sz = new StringTokenizer(A[0], " ");
double[][] X = new double[A.length][sz.countTokens()];
for(int i = 0; i < A.length; i++)
{
sz = new StringTokenizer(A[i], " ");
int x = 0;
while(sz.hasMoreTokens())
{
X[i][x++] = Integer.parseInt(sz.nextToken());
}
}
sz = new StringTokenizer(B[0]);
double[][] Y = new double[B.length][sz.countTokens()];
for(int i = 0; i < B.length; i++)
{
sz = new StringTokenizer(B[i]);
int x = 0;
while(sz.hasMoreTokens())
{
Y[i][x++] = Integer.parseInt(sz.nextToken());
}
}
sz = new StringTokenizer(C[0]);
double[][] Z = new double[C.length][sz.countTokens()];
for(int i = 0; i < C.length; i++)
{
sz = new StringTokenizer(C[i]);
int x = 0;
while(sz.hasMoreTokens())
{
Z[i][x++] = Integer.parseInt(sz.nextToken());
}
}
StringTokenizer st = new StringTokenizer(equation, "+");
while(st.hasMoreTokens())
{
double[][] E = null;
String z = st.nextToken();
StringTokenizer st2 = new StringTokenizer(z, "*");
if(st2.hasMoreElements())
{
while(st2.hasMoreTokens())
{
String s = st2.nextToken();
if(s.equals("A"))
{
if(E == null)
{
E = X;
}
else
{
if((E = Matrix.multiply(E, X)) == null)
{
return new String[]{};
}
}
}
else if(s.equals("B"))
{
if(E == null)
{
E = Y;
}
else
{
if((E = Matrix.multiply(E, Y)) == null)
{
return new String[]{};
}
}
}
else if(s.equals("C"))
{
if(E == null)
{
E = Z;
}
else
{
if((E = Matrix.multiply(E, Z)) == null)
{
return new String[]{};
}
}
}
}
if(D == null)
{
D = E;
}
else if((D = Matrix.add(D, E)) == null)
{
return new String[]{};
}
}
else
{
if(z.equals("A"))
{
if(D == null)
{
D = X;
}
else
{
if((D = Matrix.add(D, X)) == null)
{
return new String[]{};
}
}
}
if(z.equals("B"))
{
if(D == null)
{
D = Y;
}
else
{
if((D = Matrix.add(D, Y)) == null)
{
return new String[]{};
}
}
}
if(z.equals("C"))
{
if(D == null)
{
D = Z;
}
else
{
if((D = Matrix.add(D, Z)) == null)
{
return new String[]{};
}
}
}
}
}
int[][] M = Matrix.convertToInt(D);
String[] J = new String[M.length];
for(int u = 0; u < M.length; u++)
{
J[u] = "";
}
for(int i = 0; i < M.length; i++)
{
for(int j = 0; j < M[i].length; j++)
{
J[i] += M[i][j] + " ";
}
J[i] = J[i].trim();
}
J[M.length - 1] = J[M.length - 1].trim();
return J;
}
// END CODE
}
|
|
Comments: Add Your Own.
|
|
Thursday, October 17th, 2002
|
|
|
A program that I bumped into while browsing the net. Looks preety useful
import java.io.*;
import java.util.*;
public class ArClass
{
public static double[][] A = { {1.0, 2.0, 3.0, 4.0, 5.0},
{1.0, 3.0, 5.0, 7.0, 9.0},
{2.0, 4.0, 6.0, 8.0, 10.0},
{2.0, 2.0, 2.0, 2.0, 2.0},
{3.0, 3.0, 1.0, 1.0, 1.0}
};
public static double[][] B = { {1.0, 2.0, 3.0, 4.0, 5.0},
{1.0, 3.0, 5.0, 7.0, 9.0},
{2.0, 4.0, 6.0, 8.0, 10.0},
{2.0, 2.0, 2.0, 2.0, 2.0},
{3.0, 3.0, 1.0, 1.0, 1.0}
};
public static double[][] C = new double[5][5];
public final static int SIZE = 5;
public static MyThread[][] BigThread = new MyThread[5][5];
public static class MyThread extends Thread
{
private int row;
private int col;
public MyThread(int r, int c)
{
row = r;
col = c;
}
public void run()
{
for (int i = 0; i < SIZE; i++)
C[row][col] += (A[row][i] * B[i][col]);
}
}
public static void main(String argc[]) throws IOException
{
byte[] b = new byte[20];
Date start1 = new Date();
for (int i = 0; i < SIZE; i++)
for (int j = 0; j < SIZE; j++)
{
BigThread[i][j] = new MyThread(i, j);
BigThread[i][j].start();
}
Date end1 = new Date();
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE; j++)
System.out.print(" " + C[i][j]);
System.out.println(" ");
}
System.out.println("Elapsed time is " + (end1.getTime() - start1.getTime()));
System.in.read(b);
}
}
|
|
Comments: Add Your Own.
|
|
|
|
I wish I can migrate to a more 'mature' and less 'hypocrytical' country(if there is one).
|
|
Comments: Read 2 or Add Your Own.
|
|
Wednesday, October 16th, 2002
|
|
|
|
Phew it's over, managed to answer 2 questions and get 133 in rating points. Just 11 points behind to becoming a green. The sad part was had 30 minutes to answer the last one but couldn't and it was dynamic programming!!! Really need more practice in this thing.
|
|
Comments: Add Your Own.
|
|
|
|
Getting prepared for TopCoder, hope to advanced a bit more this time.
|
|
Comments: Add Your Own.
|
|
Tuesday, October 15th, 2002
|
|
|
|
If you never say no at work, people will just push you around. If you are a yes person then if anything comes up, it's your name that will be first(probably the only one) in the list to be selected for a task. They don't care if you are exhausted or overworked, they will still choose you. I believe this is a bad management practice and most of the time I am the victim. I use to do task without ever complaining and when it came to a time(yesterday) when I was really at the point of collapse I was still chosen for another task(after work). This time I said no!
|
|
Comments: Add Your Own.
|
|
Monday, October 14th, 2002
|
|
|
|
What a boring day and the worst part, nothing compiles in TopCoder's practice rooms. Keeps timing out!!!!
|
|
Comments: Add Your Own.
|
|
Sunday, October 13th, 2002
|
|
|
Finally done it. Finally it came to me. Now I understand why for TopCoder Tile problem(SRM 114 Div 2 Level 3) goes in a backward loop and Animals(SRM 115 Div 1 Level 2) goes in a forward loop. The answer was simple. In the Tile problem for example, all the tiles were unique. There are only a predefined number of tiles of a certain size. Say for example {"4x4","4x3","4x2","4x1","3x4","2x2","2x2","1x4","1x3","4x2","4x3","4x4","3x3","3x3","3x3","3x2","3x4","2x4","2x3","2x1","1x1"," 1x1"} has exactly only 2 tiles of size 16. We can't reuse these tiles. We lay them down once and that's it. In the Animals example {4,2,6,4}, there could be more than one 4-legged animal if the head count was 200. And it's possible to have 0 animals with 2 legs. The final answer would be how many different combinations could we make out of this. The solution was in front of my eyes but I couldn't see it for 2 days, cracked my head day and night over this(maybe I am getting too old for computer science).
I owe my understanding(finally) of dynamic programming to zorbathut who gave me an idea of what it was all about. Thank you dude, I hold you sky high. And my understanding wont be complete without Pochman's TopCoder Training Camp and his submissions of Tile and Animals in the practice room. Thank you dude!
Now I can go home from this hectic working weekend and sleep!
|
|
Comments: Read 1 or Add Your Own.
|
|
|
|
Close on the heels of dynamic programming. Finally seeing the light at the end of a long, dark, confusing and mathematical tunnel. I should of payed more attention at(/attended) the Discrete Structures class during my undergraduate days. Everyone used to tell me that discrete structures(and mathematics on the whole) is the lifeline of computer science, but I never listened. Like my father usually says, I will never listen till I learn it the 'hard way' and in this case 'the very hard way!' I wish I still had my discrete strutures textbook. Hmmm...
|
|
Comments: Add Your Own.
|
|
|
|
Woke up 5.00 am, and at work at 6.00 am. Man this must be one of those hectic days
|
|
Comments: Read 1 or Add Your Own.
|
|
Saturday, October 12th, 2002
|
|
|