Everything goes topsy-turvy

Working with the parser, while converting the file format from xcad to ecad gave me hell lot of errors. Spent one day on understanding and solving the errors and finally the one sided conversion from xcad to exad was done.

I have added all the functions in .y file which looks untidy indeed messy. Worked on code clean up according to the coding standards.

Besides this, I noted certain differences between the dxf file that is converted from felt and one normal dxf file. Seeing the dxf file, when I tried to add or compare the properties to felt converted dxf file again it gave me many differences.

Also, I faced an error giving message “Parser parse error before header”. When I saw the qcad dxf file it showed 999 but not felt converted dxf, I thought only that was the thing.

Feeling that I am following a wrong approach. It can’t take too long :(
But I can read a dxf file I know the meaning of almost every point I guess. So will take benefit of that and accomplish the things ASAP.

File Write Done!

The problem that I was facing yesterday is solved know. Now the output
is getting stored and gets copied into the file. The problem was that
I was unable to use the fput() in correct way.

So, I took an overview of file handling to solve this issue and now my
problem is solved.

Till now, I am making use of simple functions fput(), fclose() and
nothing much complicated.

And I am done with one sided file conversion from xcad to ecad. :)

Read Done Write Pending!

From last few days I am trying make the parser without using the
functions of C but using the inbuilt functions of Flex and Bison. I
learnt about how to define tokens by go through the .l and .y files. I
want use the inbuilt functions and don’t wanna go for hard-coding.

The read operation of the file is almost done. But I am struggling
with the write operation. It uses the fput() function. The problem
that I am facing is that it is getting compiled, but changes are not
viewed inside the file.

I think I don’t know to make use of the fput() as I am not much
familair with file handling. Will the catch the things very soon :)

Learning new stuff

I just make a try to install openSUSE on my system, just to experience how it works and how it looks like but unfortunately I was unaware that i’m digging my own grave by doing this. Actually I have two OS on my system which are running under Legacy mode. While installing openSUSE I accidentally changed setting to UEFI mode and installed under that mode. Due to this grub crashed and both my pre-installed OS dead. After spending an hour or two somehow I changed their mode from UEFI to legacy both still facing some glitches in it. So I planned to re-install any one OS, by that way I’m able to secure my other OS too. I will take 30 minutes or less to get install and within few more minutes I recover my second OS too by installing grub. Now it’s time to install KDE and time to upgrade my OS which will take about 4-5 hours. So I set my OS for upgrade. Meanwhile I learned so many things like vim, tmux, mathematics on terminal, name-mangling etc. I use to work on sublime and vim but prefer sublime more. This time I planned to work on vim I never customize vim, so finally this time I did it. After customizing I can proudly say that “Nothing Like Vim”, “Vim Is Used Only By Real Developers”. How to work using tmux : tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal

$ sudo apt-get install tmux

It has it’s own bindings but I changed them according to my comfort level. For doing this goto your home directory and in .tmux.conf file ( if not present then create it ) add these few lines

# set prefix key to ctrl+a until I have time to adapt
unbind C-b
set -g prefix C-z

# send the prefix to client inside window (ala nested sessions)
bind-key z send-prefix

# toggle last window like screen
bind-key C-z last-window

# navigate through windows like screen
bind-key C-z-x next
bind-key C-z-c prev

# window splitting
unbind %
bind | split-window -h
unbind '"'
bind ? split-window -v

# Mouse mode
set mouse-utf8 off
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'

# Vim-style copy/paste
unbind [
bind y copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -t vi-copy Escape cancel

Run $ tmux on terminal and perform required action to perform particular action. Maths on terminal : We normally use calculator for doing addition, subtraction and other actions. Stop using them use terminal for doing this ;)

$ sudo apt-get install apcalc
For performing actions like addition and all do this

For addition 
$ calc <value1> + <value2> eg: calc 1+2+3+3
Similarly we can use for multiplication, subtraction and for division.

Factor of any number can be find by using factor command eg:

$ factor <value>

Name-Mangling :

The C++ provides a feature called function overloading. This enables
you to write many functions with same name, provided each function
takes parameters of different types. The lower level languages (C or
assembly) and tools (linker) do not have capability of understanding
function overloading. For these languages, each function name must be
unique so that functions can be differentiated from each other by its
name only.

C++ differentiates functions with name and parameter both. It
generates a new name for each function. The new name depends on the
original C++ function name and parameters. Given a function name of a
set of parameters, it will always generate a unique name. If
parameters (number of params, type of params or order of params)
change then it will generate another name even if the original C++
function name is same. This process of encoding the function name is
known as name mangling.
Name mangling in done is C++ compiler to support polymorphism.

Here are few examples of mangled name for g++ compiler:-
 Original name:   void myFun();      Mangled name:  _Z5myFunv
 Original name:  void myFun(int a, char c);      Mangled name:  _Z5myFunic
 For this:
 class MyClass {
    void MyFunction(int a) {}
 mangled name of MyClass:MyFunction will become _ZN7MyClass10MyFunctionEi.

Sorting in my mind

After experiencing the interview, I came back on 10th oct. But during my journey I kept thinking about data structures. I saw there lot of people discussing about data structures, although I had studied them but it didn’t remember the algorithms and work process they talked about. So I thought to have a look at them too.
After coming home I took 8-9 hours sound sleep. After that data structures and the interviewee’s most famous question that I heard i.e shell short and bubble sort were playing something in my mind till now.
Didn’t wait much googled out and started learning the concepts. I read about shell sort.
The idea of Shell-sort is the following:
arrange the data sequence in a two-dimensional array
sort the columns of the array
The effect is that the data sequence is partially sorted. The process above is repeated, but each time with a narrower array, i.e. with a smaller number of columns. In the last step, the array consists of only one column. In each step, the sortedness of the sequence is increased, until in the last step it is completely sorted. However, the number of sorting operations necessary in each step is limited, due to the pre-sortedness of the sequence obtained in the preceding steps.
We can find lot of examples for this sort.
Anyhow, the following algorithm explains the procedure for it.

void shell-sort (int[] a, int n)
     int i, j, k, h, v;
     int[] cols = {1391376, 463792, 198768, 86961, 33936, 13776, 4592,
                     1968, 861, 336, 112, 48, 21, 7, 3, 1}
     for (k=0; k<16; k++)
         for (i=h; i<n; i++)
             while (j>=h && a[j-h]>v)

Hp Drive – Day 3 and 4

Finally my interview day came, thanks :P Surely I had to wait I knew
that :( The tragic thing that happened with me was my registrations
forms were misplaced by them. Disgusting! At one moment I seriously
wanted to kill them:P
After pressurizing them, they found and it was lying in the stack of
reject list :( I didn’t have an interview and my name in reject list.

Finally they gave a call for technical interview. Surprisingly except
the question what is OOPs, he asked nothing technical:P. Asked me
about my family and my interests. It was over within 20 mins. I
cleared the round, got a call for next but again my form lost. Again
in reject list! I didn’t knew what they people were doing.
Whatever, next was MR round, and went for about 40 minutes:P He asked
me about my family background and so many Why(s). Why non medical, why
IT, Why…?

Finally last round left HR round but I was waiting for the result of
my previous round. I was feeling bit nervous as only 150 students were
left out of 500 and didn’t knew where will my destiny take me to.
Ah! sigh of relief, called for the next round. Seemed little different
but the HR interviewer asked me to write a code, did that. Asked
certain questions why computer is my passion, talked about my
interests and over.
I had a good experience and felt little good too as I was among 150’s
from the 12000s. But I struggled with my hunger a lot. I ate only only
2 times in the span of three days and was very much tired.

Hp Drive – Day 2

Today was the interview day. It was full of nervousness and
excitement. My reporting time was 12 but when I reached there I go to
know the things poorly managed and till now out of 500 had given the
I took my laptop along with me, so in the free time I could work a
bit. I couldn’t concentrate fully but still went little with my
training work and even exploring the newer things that could me help
in the interview.
I interacted with the other students. All seemed to be energetic and
excited. I was excited but not energetic and I hadn’t eaten anything
since last night :(.
The time passed on and on, and the worst part was my interview shifted
to the next day. I was frustrated don’t know where to go now. I called
up my classmate who stay in Chandigarh and slept there for a night :(.

Hp Drive – Day 1

So, today I planned to go through the Placement process of HP(Hewlett
Packard). It was decided the bus facility would be the college
faculty, about 300 students of the college went there. After reaching
there we saw a long queue of students waiting for the registration
and verification purpose. It took about two hours to enter the college
gate even.
There were approximately 12000 students! I was just shocked to see and
surprisingly found Piyush Parkash there too :)
My registration number was in 6000 series and we were assigned to give
the aptitude test at about 6 P.M. Mean time we were free just had
little fun in combination with the studies.
Finally our turn came, firstly we people were invited for the
Pre-Placement talk and then for the test.
The paper pattern I found was too good atleast for me :P It had a very
good taste of C along with little verbal and quant part. The questions
of C carried the most of the weight-age dealing mostly with pointers,
left and right shift operators and little concept of destructor.
After giving the test we were informed to leave. At about 12 at
midnight I got a call informing that I have been selected for the
interview as I have passed the test. 500 students were selected out
12000, one was me :)

One more task IN

I was previously assigned a task to work with Flex and Bison to allow
the conversion of different formats. But unfortunately we both
(Kamalpreet and me) were unable to complete it.
Don’t know the reasons but we couldn’t make the proper understanding
of the code and certain concepts. Had a discussion with Sir, as
suggested by Sir was to convince Alisha again for the presentation.
Sir’s motive was not to quit the task but learn something.
Contributingto it and making the efforts to complete it soon.
Even I was told to study little about BRL-CAD too. Hope to complete
the tasks soon :)

It’s my Birthday

Yesterday I went home after a long time and Yeah! today is my birthday :)

After coming back today from my home, had a great day ahead with my
friends at my place. I did no work at all. Whole day my friends were
with me and it was a celebration time :)