Archive

Archive for April, 2008

BoobBox??

April 28, 2008 Leave a comment

Monday again. Start wasnt good. Roomie and me have a tiff. I got to be more tolerant. And my car repair costs 700$ 😦 

Not even sure what the issue was. Need to check it out. Well, by now the “boobbox” heading would have caused enough impatience… 
I was talking to one of my friends. Lets call her cleopatra. So, cleopatra and me are talking about music systems. I mention that I had bought  my mom this sony mini-radio/taperecorder thing. Still cant remember the name. So she blurts out …boobbox? (she wanted to say boombox). It was so spontaneous and so funny. If I were outside…I wud have laughed until tears came out. In office, I had to hold my laughter until my face became red. btw, she was sooooooo  embarrassed, in her terms.
Geez, that was quite a spelling mistake!!
Categories: Uncategorized

Marrisa mayer

April 24, 2008 Leave a comment

She is absolutely amazing! Check this out – http://www.sanfranmag.com/story/adventures-marissa#story_top

Categories: Uncategorized

what happened on weekend

April 21, 2008 Leave a comment

Phriday – Went to “forgetting sarah marshall”. Real load of crap. Cheap dirty jokes. Male frontal nudity. Had to do lot of stuff on saturday, atleast planned to do a lot of stuff. Slept at 3:45pm 😦 and then woke up at 11:30 . There was a macys sale going on. Rushed to see if anything good was going on. Big disappointment. Missed the car registration. Need to go on munday. Then came back and dozed off until 900pm 😦 That was very disappointing.. 😦 Again 3:00 until sunday morning. Woke up @ 2:00 and went out with few frnds.
Went to see google office!! It was impressive!! I mean it was like home… the food was free and was all around. There was gym. fooze ball, table tennis. I mean for christs sake there was a fooze ball table outside a conference room. Totally totally informal. I like it that way. Played the fooze ball for sometime…was interesting! Then went to dinner to my roomies frnds place. I didnt want to go..I mean firstly I am socially inept and then I didnt know these ppl well enough. Well, I had to go anyway… But it didnt suck…had some good time!!
So sunday was “ok”. Google was cool. You have to just work there… before the fuzz dies out.

Categories: Uncategorized

Cache creek

April 14, 2008 Leave a comment

We went to atlantic city thinking we wont find any casino in CA. Guess what? This is a sin city. There are more casinos here than you can imagine. But they all suck. They dont have the money. It shows. Atlantic city was rich, classy. The games here was shitty too.

Roulette… I didnt see the numbers at first. I thought the wheel was spinning real fast. Then I thought this was way too advanced..that the numbers disappeared. Guess what!! The color where the ball falls.. a respective color card is picked up… Geez.

Ditto with craps. The higher dice, gets the respective color card picked up.

Well, they gave us 25$ bonus points since it was our first time. But you had to put 1$ to start with. I did and won 80$. It was on a 5cent machine. So didnt mind the winning!

And hey, apparently, its cheap to pay for your food. but not cheap to thrust your stuff on others throats.

Categories: Uncategorized

Threads

April 11, 2008 Leave a comment

Thread.sleep(). I finally get it. Thread.sleep() is a static method. You can call it on any thread you like, as you have, but what will sleep is the current thread, the one that called the method, not the one you called it on, unless they are the same, which in your code they don’t seem to be.

Class A extends Thread{

public void run(){
while(true){
doLongProcess();
Thread.sleep(1000);
}
}
}

What happens here is …the doLongProcess() executes. On Thread.sleep, the main thread, which is Class A sleeps…for that time. and then the processing continues…since you have while(true).

Categories: Tech stuff

Elmo and Praveen

I had to get sthg for nithya. She is just too cool. I have never gifted anyone anything. Just took wine to swapnas place. Its kinda sticky situation for me. I cant stand the emotions that go with it. Well, So I ask ppl around on whats the best thing I could get for a kid. I get few good suggestions.. but all point to Toys r us. So here I go. And Am I out of place or what? I take 4-5 rounds of the store, spend like 40-50 mins… Cant find a thing. Found a teddy – BORING. Found few slippers…didnt appeal to me. I knew the kid liked toys which made some sound.. I then kinda stumbled upon ELMO. It was funny and looked great. So, I took it!!

And if thought that was tough, u aint see nothin. To give it to someone was more nerve wracking! 1. She isnt well. Has viral fever. Bad timing-I
2. She gets some stick from daddy. Bad timing -II. (Me say to elmo , “elmo, maybe next time”)
Well, while me done with dinner,,,,which was amazing… she back to her cheerful self. Me go and talk again…and lo and behold…show her elmo. She likes it. Me like it too.

Phew, It was like proposing to a girl or attending an interview. And all I was doing is giving a gift.

I need therapy.

Anway, chk me with elmo

Categories: Uncategorized

Me techie?

I got my car yesterday. He brings the car outside to my office and its Apple Inc. This company has charm. People see you coming out of this company and you are like a techie guru. This driver was all telling me about his new laptop and takes me inside his truck and show it to me. he spends 2k on a piece of crap. I tell its amazing.

Categories: Uncategorized

Startegy pattern

Simple way. You have list of objects, you need to perform a function on them. The way you perform the function may differ. For eg sorting a list. You can use diff sorting strategies. You dont want to couple a strategy of sorting with the list.

First interface,

  • Strategy: This is an interface to describe the individual algorithms.
    public interface SortInterface {
    public void sort(double[] list);
    }

    SortInterface.java

  • ConcreteStrategy: Implements Strategy Interface and contains the logic for the algorithm.
    public class QuickSort implements SortInterface {
    public void sort(double[] a) {
    quicksort(a, 0, a.length - 1);
    }
    private void quicksort(double[] a, int left, int right) {
    if (right <= left) return;
    int i = partition(a, left, right);
    quicksort(a, left, i-1);
    quicksort(a, i+1, right);
    }

    private int partition(double[] a, int left, int right) {
    int i = left;
    int j = right;
    while (true) {
    while (a[i]< a[right])
    i++;
    while (less(a[right], a[--j]))
    if (j == left) break;
    if (i >= j) break;
    exch(a, i, j);
    }
    exch(a, i, right);
    return i;
    }

    private boolean less(double x, double y) {
    return (x < y);
    }

    private void exch(double[] a, int i, int j) {
    double swap = a[i];
    a[i] = a[j];
    a[j] = swap;
    }
    }

    QuickSort.java

    public class BubbleSort implements SortInterface {
    public void sort(double[] list) {
    double temp;
    for(int i = 0; i < list.length; i++) {
    for(int j = 0; j < list.length - i; j++) {
    if(list[i] < list[j]) {
    temp = list[i];
    list[i] = list[j];
    list[j] = temp;
    }
    }
    }
    }
    }

    BubbleSort.java

  • Context: The context maintains a reference to a Strategy object and forwards client requests to the strategy. Context may also define an interface to let Strategies access context data.
    public class SortingContext {
    private SortInterface sorter = null;

    public void sortDouble(double[] list) {
    sorter.sort(list);
    }

    public SortInterface getSorter() {
    return sorter;
    }

    public void setSorter(SortInterface sorter) {
    this.sorter = sorter;
    }
    }

    SortingContext.java

  • Client: The client sets the concrete strategy in the context and invokes the context to run the algorithm. You can also have the context set the Concrete strategy implementation itself, based on the request.
    public class SortingClient {
    public class SortingClient {
    public static void main(String[] args) {
    double[] list = {1,2.4,7.9,3.2,1.2,0.2,10.2,22.5,19.6,14,12,16,17};
    SortingContext context = new SortingContext();
    context.setSorter(new BubbleSort());
    context.sortDouble(list);
    for(int i =0; i< list.length; i++) {
    System.out.println(list[i]);
    }
    }
    }

    SortingClient.java

Categories: Tech stuff

Disappointing day

Well, Last couple of days have been really sad. My ex-roomie in NJ, doesnt want to pay me the money he owes me :(. Instead of paying me the money, he is making all the reasons not to do it. Suddenly out of the blue, I get accused of being unfriendly and being a great torturer.

And it is all when I ask for my money. Is kinda funny really. Wish it were india, there are ways to take money from such people.

And I cut my finger big time while making butter chicken, and it tastes like shit.

Categories: Uncategorized