getting SOURCE from .src.rpm
[info]rareisme
1007 rpmdev-setuptree
1010 rpm -Uvh tar-1.22-2.fc11.src.rpm
1011 cd ~/rpmbuild/SPECS/
1015 cd SOURCES/
1017 cd ../SPECS/
1018 rpmbuild -bp tar.spec
1022 cd SOURCES/
1026 cd BUILD
1028 cd tar-1.22/
Tags:

changing "cd" command in Linux the way I want.....
[info]rareisme
Prob definition:
My /home/omap2430 directory contains all linux source folders. If I go to that folder and try to build any linux kernel, it always means that I want to build them for ARM architecture and with some Cross Compiler...... As of now, for this I am exporting some variables.... I am doing this manually..... Now I want this to be automated..... so use cases are

1. As soon as I do, cd ./omap2430 or cd /home/omap2430 or I enter to omap2430 directory, my variables should be exported automatically.
2. As soon as I leave that direcotry, all MY exported variables should be unset....

HINT: cd is a bash-builtin command
Did it in 33 minutes...........
Tags: , ,

An analogy
[info]rareisme
I love more and more computer program designing than coding as I know more and more. I was just going throug some design which was explaining that what *must* happen at kernel level and what *must not* and then how a user space can be written in a much much better way by clearly knowing that what kernel *provides* and what *not*

While I was thinking this one, I saw a beautiful analogy of the same.

There are 3 lifts to go to all floors here at L&T. You press one button either, one which indicates that you want to go to top or obviously the other one which tells that you want to go to down.

Now, an algorithm runs. The lift out of three which is nearest to you and !going in opposite direction will __serve__ your request.

Now, there are some special cases. During lunch time which is at 12:30 to 2. Now, everyone @ 12:30, from each floor, is going to ground floor. And at around 2, there is rush at ground floor and wants to go at their respective floor.

Let me explain an analogy now. I see the *core* algorithm as what something that kernel provides which is the best possible thing.
Now, how an user space application can make it better or worse. I see us who are using lift as user space application and thus,

1. Best case - When everyone is returning from lunch. There should be an understanding (and so algorithm in computer terms) among people (and thus among application or in application). Those who wants to go to first and second floor will take only lift-1, those who wants to go to 3rd and 4th will take only lift-2 and others will take lift-3. This will give each application less response time and utilisation would be better.

2. Worst case - It is what happens normally. No one cares. Take any lift that comes first in order to get best latency which apparently looks right but turns out to be wrong. Since now each lift is carrying people which is a combination of who want to go to first floor, 2nd, 3d, 4th, 5th and 6th. Now, lift will stop at each floor. And the time that it takes to open and again close the door at each floor (this is like serving I/O request) adds so much latency that at the end each one will take much time with compare to case wherein if they had developed understanding among themselves as explained above.

And this looks exactly true, and which says, there are few things which needs to be better handled at application in better way and there are core facilities which can be provided by kernel only.....

My just few cents and :-)

Mumbai Locals
[info]rareisme
You should be surprised that how can I take toooo long to write about Mumbai Locals since it has been already 3 months that I have settled here.

This one is the first interesting subject that any blogger will find and get attracted to write about.

The first time I had to use local trains is when I came from abad and had to reach at Vashi, home. I knew that during early morning time, there will be no rush but I dint knew which path to take. But, I also knew that everyone will be more than happy to help you.

But here are some interesting and common thumb rules that you should keep in mind irrespective of what area to area you are travelling.

1. You should have *map* of local trains. They are perfect and will give you each detain about station and stoppages and path and etc.

2. You should interestingly know that on which side your platform will come since you have to get down train within a minute. Thumb rules are 1. ask people. 2. If you have confusion, look at the people before station comes, turn into a direction where all other are facing.

3. If you know that you have to change the train. Follow simple steps, get down from first train, go straight towards stairs, climb the bridge, look right and left and know next train is coming where, get down there and catch the train.

4. Remember some symbols. Like, PL-Panvel, D-Dadar, and likewise.

5. Dont run like mad, there is always another train you can see coming.

My interview with *******
[info]rareisme
Few days back and to be specific 2 days back, we came to know that there is one client coming at L&T and as usual will take interview in order to select us for a new project.

My initial feeling was ohh what the heck one more interview and what he is gonna ask me. Screw him. I started initial screening. I looked at his profile on Linkedin. He was Vice President of Engineering, was a former IITian, had more than 18 patents on his name and was responsible for inventing more than one technology and had 18 years of experience.

Huhhhh, I understood then now the game is reverse this time. I am going to be screwed now. I just dint knew where to start though it was a matter of refreshing mind but still i dint knew anything.

And above that on the same day, Sachin hit 200*... Ohhh man now there was a choice for me. Whether I want to go and watch highlights or I want to refresh some fundamentals. Well, fundamentals never need to be refreshed. But, I believe there are two parts of it. Fundamentals consists of one part which should be by your heart and there is other part which you should not even remember and it should be revised all the time and exactly that part I wanted to refresh. Well, I decided to watch highlights but I started with refreshing something. I sat for few mminutes in front of my computer and then packed the bags and caught auto instead of free bus. I was at Hari's place and my old room. They had TV now and everything else also provided. The highlights were already started. Zee was showing Sachin's 50-100 and 10-150 and 150-200 and OMG all shots were just like perfection showering. I watched full highlights with mouth opened. We took dinner and went through few questions which were provided by our Sr manager.

Next day reached to company at 8AM. I had nt breakfast. He started calling people one by one. I was on top of the list and there was much expected from me and I dont know why. My manager told him that I have nt taken breakfast and so if he could let us know his plan then I can plan accordingly. He called me and offered some biscuits and asked if I want to take breakfast first and I said no "I am hungry for work, more". It was just a bullshit way to impress him even knowing the fact that what he is. But, I think I spoke rightly.

Then he started,
First question to which even I dont have and will not have any answer anytime.
1. Why dint you do your MTech?
Ans. Ohh man!! Dont put salt on wounded place (something called jale pe namak mat chhidak). Well, I had call from IIT G but I wanted to do MTech from top five IITs only. I also believed at that time that experience is more important than getting degrees.

[Him] You are wrong. The good way is you do your bachelor and then get to know about industry for 3-4 years and then do your masters.
Ok. lets start.
1. Can you give me an algorithm to Reverse a link list?
Ans. Yes, this is how on notepad...

2. Can you give me an algorithm to find out a cycle in linked list?
Ans. Yes, on notepad and then frankly, speaking I knew this question. My earlier employer had asked the same but I solved at that time also.

[Him]Ok, so do you know what this algorithm is called?
Ans. No, but I understand the fundamental property of it.

3. Can you give me an algorithm to delete a node from linked list without using any special cases?
Ans. I gave good answer but not the right one.

4. Can you remove duplicate eliments from an array in O(n)?
Ans. No, I know which removes in O(n logn). Explained how.
I can do it in O(n) if there are some special cases. I can also do if I use Hashing but I dont know how bad Hash function would be ?

5. Explain me how DHCP works? At kernel level and at app level and all about it.
Ans. Gave some details. All were right guesses.

Some technical discussions all over intersperesed.

6. Last question, at t=0 I send 30 bytes at t=1 20bytes and t=2 30bytes, now on the other end of a perfect cable I read them at t=5,6 and 7. Tell me the difference if proto at transport level is TCP and UDP?
Ans. I rightly explained for TCP and goofed up for UDP. He gave me answer and said now explainand then I was well right.

7. If I look for your name on LKML, will I find?
Ans. Of course, even on kernel.org

Thank you Viral. You did good and I will use you for kernel development.

Thanks, thanks a lot. I dint tell you but I was little nervous when I knew that you have filed half a dozen patent every year. But, yeah thanks.

Ohhh ok. No, but as I said you did well. Thanks!!!
Tags:

oh i cant believe this .... is this gonna create more mess
[info]rareisme
Android drivers are being removed from kernel.org or probable removed by this time... 2.6.33 will not have them...

I dont know how are they gonna be maintained now....

Have a look,
http://www.kroah.com/log/linux/android-kernel-problems.html

working behind *kin mi*rosoft proxy server
[info]rareisme
ohhhhhhhhh

I was struggling since a month..... Ppl in big companies are using Microsoft's ISA server which really works as CyberRoam but its far far better (in theory at least).....

But, as usual it supports just windows and just Internet Explorer... If you are using something like Linux and like firefox, they do not understand ISA headers and things like that....

So, working on Linux in windows-friendly-environment is like a nightmare. For the firstime, I felt so... I tried a lot... I was able to access from firefox but that keeps asking for username:passwd as and when and now and then.... mentally harassing me...

On top of that, you cant access ssh and git and eclipse and etc when they require to make internet connection... ha ha ha.......shit!!! I tried capturing packet through ethereal and what not !!! but no luck !!

At the end, found a superb doc...
http://www.faqs.org/docs/Linux-HOWTO/Web-Browsing-Behind-ISA-Server-HOWTO.html
and apparently it gave me relief from all pains......

I hope this link will not go away... cant copy here since he has some copyrights.... and i want ppl to look at his doc as well... :)

still computed goto
[info]rareisme
and this is what a generic way of making default case in my previous post

Viral, nice way of using default case.. i think u can make it more generic by using
#define DISPATCH() \
{goto *op_table[*s-'a'< sizeof(op_table)&& *s-'a'>= 0 ? *((s)++) - 'a' : (*s
- *((s)++)) + sizeof(op_table)]; }

computed goto
[info]rareisme
Well, I came across this when I was going through
"Internals of Dalvik Virtual Machine" presentation. This is available on YouTube and anyone should be able to find this. A very interesting one who have basic idea about Android.

Apart from that, this one is true for normal C program as well,

[root@viral temp_c_files]# cat goto.c
#include
[Error: Irreparable invalid markup ('<stdio.h>') in entry. Owner must fix manually. Raw contents below.]

Well, I came across this when I was going through
"Internals of Dalvik Virtual Machine" presentation. This is available on YouTube and anyone should be able to find this. A very interesting one who have basic idea about Android.

Apart from that, this one is true for normal C program as well,

[root@viral temp_c_files]# cat goto.c
#include <stdio.h>
#define DISPATCH() \
{goto *op_table[*((s)++) - 'a']; }

static void interp(const char* s) {
static void* op_table[] = {&&op_a, &&op_b, &&op_c, &&op_d, &&op_e};

DISPATCH();
op_a: printf("Hell"); DISPATCH();
op_b: printf("o"); DISPATCH();
op_c: printf(" w"); DISPATCH();
op_d: printf("rld"); DISPATCH();
op_e: return;

}

int main() {
interp("abcbde");
}
[root@viral temp_c_files]#


The code snippet is *optimised* version for normal *switch-case* statement. See for yourself if you can figure out how.... :D

cause of one bug
[info]rareisme
fpack-struct[=n]
Without a value specified, pack all structure members together without holes. When a value is specified (which must be a small power of two), pack structure members according to this value, representing the maximum alignment (that is, objects with default alignment requirements larger than this will be output potentially unaligned at the next fitting location.

Warning: the -fpack-struct switch causes GCC to generate code that is not binary compatible with code generated without that switch. Additionally, it makes the code suboptimal. Use it to conform to a non-default application binary interface.
Tags: , , ,

You are viewing [info]rareisme's journal