Sunday, November 13, 2011

Foodie Me!

Starting off the usual Sunday, with a mere let-me-call-it-a-breakfast at 3:30 PM, it was high time I had some respect for my stomach and fed it with some real good food. Indian food, vegetarian food, here I was at NH8 in Indiranagar today. It a total fucking kick-ass Rajasthani Cuisine. Frankly, this has been the longest ever menu on my dinner till date. It is priced at Rs.265, seems overpriced but sure you should give it a shot. You get to have those never-before-heard of food items. Genuine names and not the types of the KFC, McD misnomers for potato fries and same old burgers.

Going in to the restaurant at the 3rd floor, as the elevator door opens up, you feel right in the center of a Jodhpuri mela, with all petha-fied Rajasthani people walking around hurriedly talking a slightly unrefined Hindi in the midst of a Phalguni Patak score playing in the background aloud. The place seems colorful with 'red-yellow-green-blue, color you name it and you have it' pillows on wooden table-chair restaurant furniture with sort of a mini patio [ don't hyper glorify the patio in your imagination, its just average:)] in the middle of it. You could prefer sitting on cushion beds on the floor as well, never mind we didn't try it, we have our own problems of resting our potbellies you see.

Say go and your table is filled up with 10 little cups for all kinds of sabji and salad and what not.

Here goes the menu on the thaali. Read on.


Padhaaro Sa


  • Marwaari Chaach
  • Jaljeera
Farsaan

  • Mirchi Vada Chaat
  • Khaman Dhokla
  • Tandoori Chatpata Aloo
  • Achari Paneer
Arogosa
  • Jodhpuri Ghatta
  • Paneer Tikka Masala
  • Rajwadi Moong Masala
  • Rajasthani Ker Sangri
  • Panchmukhi Daal
  • Gujarathi Kadi
  • Rajasthani Kadi
Jeemo Sa

  • Phulka Roti
  • Makai Rotla
  • Rajasthani Batti
  • Tandoori Butter Naan
Rice

  • White Rice
  • Rajasthani Kichchdi
Vyanjan

  • Gulab Jamoon
  • Basundi
  • NH8 Special Churma
Rasna

  • Papad
  • Mix Kachumber Salad
  • Pudina ChutneyLasun Chutney
  • Imli Chutney 
  • Mix Achar

Obviously we didn't have the courage to stuff all this and inflate our bellies, So we chucked the Vyanjan and a lot of Arogasa and White Rice.

For a weekend dinner or lunch with a friend or family, this seems to be a pretty nice place. Go visit.

Bon Appetite
Ghanashyam

Monday, November 7, 2011

Thoughts

I was reading Steve Jobs' biography and one thing that can't leave my mind is that, to be able to think really different in life, to gain a real lot of expertise and to be able to create stuff one has to have inspiring people around very early in childhood.

You really have to have a good education, have to have a freedom to rebel, freedom to say no, say no to courses you don't like, say not to things you don't believe in. Freedom of thought.

I think the childhood experience listed here is almost analogous to that listed of Richard Feynman, another genius physicist of our times. He too speaks about how his father taught him to say why, how to things that he didn't believe in or things that he didn't understand. This quest doesn't come naturally..

Looking back in time, I think most of us did NOT have such exposure, most of us did NOT have such freedom.

I also read a 1995 interview of Steve Jobs where he talks very strongly about education. He says "The teachers can't teach and administrators run the place and nobody can be fired. It's terrible".

A lot of them ought to be fired.
I fear.

Sunday, October 23, 2011

Google Docs Presentation Revamp



Check out the new presentation editor rolled out on Google Docs. Really cool features on presentations.


To enable new editor, Open Google Docs, Use the Gear icon for Document setting and select the radio button for Create presentations with new editor...

I spent an hour trying out all the new features and these look awesome. A super cool revamp on Google Docs!

Quick Features
1. Insert Drawing ( free hand), shapes, ( even 3D blocks ), arcs, curves, lines
2. Animations on the objects
3. Transitions
4. Layouts (Title in the centre, at the top, only title, with subtitle .. )
5. Themes ( Though not that great )
6. Equations Symbols
7. Objects Fill mode, outline modes are awesome.
8. Align objects
9. Keyboard shortcuts

I tried to create a sample presentation checking out how easy these features are to use. Believe me they are amazingly easy!  For those who want to skip going through Google Docs help and try it out themselves, check out the presentation.



/G

Monday, October 17, 2011

Two Quick Emacs tips


Two quick Emacs tips: These are really awesome

1. Opening compressed files in Emacs

Add the following line to your .emacs and open a .gz file directly in Emacs. 

(auto-compression-mode t)

Saves you hell lot of a time!

2. Renaming buffers/files when they are open

This is "wow" for an emacs user :)

There is a file that you are editing on on emacs. [An open buffer]. And now you want to rename this file and not only the buffer.

One way was to close the buffer, rename the file on shell and re-open again.
Another way was to just write the existing buffer into an entirely new file and name it the way you want. Basically you end up making a new "copy"

Another good way is to use emacs dired more. Lets assume you have an open buffer.
Open dired mode ( C-x C-d )
Open the directory in emacs.
Traverse to the file and press R (rename)
Rename the file to what you want.

The buffer too gets renamed in Emacs automatically and so the file on the disk!

Go Free,
Go Emacs!
Ghanashyam

Saturday, October 8, 2011

Thank you Steve!


I woke up to this news about Steve Jobs' death on the morning of October 6th and all I could do was to hold myself back in intense grief, that the day had come. I had not expected his cancer to be this quick and brutal. I was only left with inexplicable sadness in my heart and a deep breath to say 'This is n't fair'.

Admiration for Jobs starts with the moment you hold Apple devices in your hand. Your jaw just drops and a "Wow" gets uttered from your mouth involuntarily. This rarely happens with other products. I felt it when I opened up the iPod shuffle case, when I felt sleeky iPod Nano, when I fell in love with the iPod Touch, when I experience beauty with a Mac. It is "Magical".

This artist was like never before never again. An artist who paid intense attention to detail be it his remarkable designs, logos, his talks, his words, anything he created were a work of a genius.

I have always wondered how it would have been to be in the times of legends like Einstein, Edison, Tesla, Visveswaraiah, Vivekananda, Subhash Chandra Bose or Gandhi.. I think I know now. I am in the times when Steve Jobs created Revolutionary, Incredible, Insanely Great and Magical products, in the times when Steve Jobs lived.

You redefined "Magical".
Thank you Steve. R.I.P

PS:
Bookmarks
Steve Jobs' thoughts / His message

Tuesday, May 31, 2011

understanding regular expressions to finite state machines

i recently came across a question on designing a state machine for detecting a binary string sequence. the solution to such a problem has two approaches. the very commonly followed approach is analyze the "given" sequence over and over again and try to scribble state transitions and test the patterns on it to check if breaks. i believe this is the way hardware engineers work this out, primarily because they spend some time which is considerably less than what they spend for other problems they analyze :) i say hi to "theory of relativity" here..

the second approach is to have rules to analyze such problems because they only consist of binary patterns (0s and 1s) and a rule based solution is like some kind of a program, so you don't necessarily have to do much testing or alter, adjust your state machine as you try to solve the problem. the theory that deals with such kind of problems of pattern matching and sequence detection is the famous regular expression or the re. regular expressions can be analyzed as finite automata, or what can be called as our commonly known finite state machine.

so the best way to deal with such problems is to represent the sequence as a regular expression and just try converting it to finite state machine based on rules.

So some notations wrt re:

a* : an a* would mean 0 or more matches of the letter "a" followed by successive letters. for instance a*b matches "ab", "aab", "aaab" or just "b".

a+ : an a+ would mean 1 or more matches of the letter "a" followed by successive letters. for instance a+b matches "ab", "aab", "aaaab" but will not match just b.

a? : an a? would mean 0 or 1 matches of the letter "a" followed by successive letters. for instance a?b matches "ab" or just "b" but will not match "aaab".

the problem statement mentioned the sequence detection for the string 101011, which also meant that the state machine should be able to sustain 101010111 or a 111101011 as a match since both these string involve the string 101011.

Looking more closely at the sequence, a few points to notice.

a. match as many 1s preceeding this sequence so that we end up matching  11101011, or 11111111010111 or 11111111111111101011. to put this in the basic atom terminology, we match (1+)01011. 

b. match as many 10s preceeding this sequence so that we end up matching 10101011 or 101010101011 ... so we can end up consuming any number of 10s once we get past the first occurrence of 10. to put this in the basic atom terminology, we match (1+)0(10)+11

so that is pretty much translating problem into a regex string. The following slideslow will try to illustrate a method to translate a regular expression into a statemachine. There might have been mistakes in my understanding and representation. Comment or e-mail me if you think there is something wrongly interpreted.


Thanks
Shyam

Sunday, May 22, 2011

gmail integration with emacs

I think it is fun to have Emacs act as your mail client. It's like when u are busy writing code, and you got to send in some snippets or a quick mail on the issue, you just don't leave the editor!. So here is how you integrate Emacs to access your Gmail compose. Note, your mails sent from Emacs are also stores in the "sent" label on your Gmail!

pre-requisites
  1. emacs 23.2
    Use the latest version of emacs, I used emacs23.2 while i made the customization.

    download emacs from http://ftp.gnu.org/gnu/emacs/

  2. gnutls
    gnutls is the gnu transport layer security library which ensures secure client/server communication over the transport layer.

    http://www.gnu.org/software/gnutls/gnutls.html for more info on gnutls

     
  3. Libgcrypt
    To build gnutls, this package may be required it is provided in the gnutls download link along with gnu tls. One might have to download it separately.

The .authifo File

  1. The authinfo file stores the login information for the mail account. Create the .authinfo file
     
  2. Insert the following line into the .authinfo file which u can create and place in the ~/. directory

    machine smtp.gmail.com login @gmail.com password

     
  3. Modify the permissions of the .authinfo file as follows

    chmod go-rwx .authinfo

    chmod u+rw .authinfo

Emacs Init Config (.emacs)

Add this section to your .emacs

;; email setting for my emac
(setq send-mail-function 'smtpmail-send-it
message-send-mail-function 'smtpmail-send-it
smtpmail-starttls-credentials
'(("smtp.gmail.com" 587 nil nil))
smtpmail-auth-credentials
(expand-file-name "~/.authinfo")
smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587
smtpmail-debug-info t)


Sending mail
The keybinding for emacs to send mail is
  1. C-x m to compose mail 
  2. C-c C-c to send mail when you are done composing the mails

Thanks
Shyam

Monday, May 16, 2011

timescale in verilog


The timescale directive in Verilog used to model hardware is quite confusing, most people I have interacted with most times do not understand or are just ignorant of the timescale directive. So I thought I should jot this one down so that next time I meet up with people ignorant of this, I can point them to this post!

The directive is used to model delays in signal assertions with specific precision. Unlike vhdl, which has specific time unit constructs [ns(nanosecond), ps(picosecond), ms(millisecond)] Verilog inherently does NOT support these data-types and hence there is no time unit. The unit and the precision is specified using the timescale directive.

Aan example Verilog codes would feature this directive as
`timescale 1ns/100ps
which is in the format `timescale time_units / time_precision

  A#100 in verilog is used to identify 100 units of time. For instance, with a `timescale of 1ns/100ps

  Avalue of #21.375 is indicated as

21.375 * 1 ns = 21.375 ns and the .375 is rounded off to the next 100ps ~ 400ps.

so #21.375 is taken as 21.4ns

If the timescale is set to 1ns / 10ps, the precision is higher and so the math is 21.375 * 1ns = 21.375 and then the .375 is rounded to the next 10th pico second which is 380 ps

So a #21.375 ~ 21.380 ps in this case.

--
shyam

counting squares contd...

As a continuation of the previous post on counting squares, here is the update. Only two of my friends commented their solutions to this simple problem and here are two approaches.

lets assume a board where n = 6. drawing a line would make the board look like this.

   +----+----+----+----+----+----+
   | \\ |    |    |    |    |    |
   +----+----+----+----+----+----+
   |    | \\ |    |    |    |    |
   +----+----+----+----+----+----+
   |    |    | \\ |    |    |    |
   +----+----+----+----+----+----+
   |    |    |    | \\ |    |    |
   +----+----+----+----+----+----+
   |    |    |    |    | \\ |    |
   +----+----+----+----+----+----+
   |    |    |    |    |    | \\ |
   +----+----+----+----+----+----+

what i think is the the "indian" geeky way of looking at it is to eliminate the  other half and visualize the same board as

   +----+
   | \\ | number of squares = 1
   +----+----+
   |    | \\ | number of squares = 2
   +----+----+----+
   |    |    | \\ | number of squares = 3
   +----+----+----+----+
   |    |    |    | \\ | number of squares = 4
   +----+----+----+----+----+
   |    |    |    |    | \\ | number of squares = 5
   +----+----+----+----+----+----+
   |    |    |    |    |    | \\ | number of squares = 6
   +----+----+----+----+----+----+

and so people arrive with the standard n(n+1)/2 which people remember, thanks to the caning by their high school math teacher for not remembering the sum of natural numbers series up to n :)

but there is a simple way of looking at it
1. the number of squares slashed by the diagonal is n.
2. total number of squares = n^2
3. so remaining squares = (n^2) - n which is equally divided between the two halves
4. so total squares not slashed = [(n^2) - n] / 2 = M
5. so if you want to include the number of squares slashed by the diagonal as
well, then its M + n

I took the first way to get the equation, but that is probably the harder way to do math. a thoughtful layman would come up with the second method first time and is backed by observation.
 

Cheers
Ghanashyam

Sunday, May 15, 2011

counting squares


While in the midst of trying to solve a problem, a question just struck to me. Suppose if there is a chess board of n checks [the normal chess board has 8x8 so n=8], and you draw a diagonal across the entire board from one edge to the other edge, what is the equation that can give us the number of squares in the chess board on one side of the diagonal? Squares include those across which the diagonal has been drawn. for instance if a diagonal is drawn across a board with n=4, then the number is 10.

I spent a couple of minutes of thought on how to fit an equation into this but I thought I should have got it faster. There is one approach I followed.. let me know what approach you guys follow!


Cheers
Ghanashyam

Monday, May 9, 2011

walk to remember...



what other place than an oceanside to experience serenity.

along the shores,
the waters in an endless effort,
to kiss away the sands at your feet,
the rhythmic sounds of waves,
in resonance with breezing winds,
sing adieu to a beautiful, smiling and dying sun.

it gives you the just-enough-silence,
it shows you how much you just don't matter,
it shows you its might,
it shows you its magnanimity,
it shows you how time is prolonged,
it shows you how enormously long a minute is.

it is a serene experience. i wait to find an experience more blissful than at the one at the sea. it is a walk to remember...


cheers
shyam

Sunday, May 8, 2011

quick .emacs access

when one talks about emacs customization, most of it is going to be editing the .emacs, which is the init file of emacs. emacs loads the init file, by default, stored at the $HOME or the ~/. location in your system. Some times one never knows which is the .emacs that our emacs is using typically when one has been updating his emacs through different versions. the easiest way to find out where your .emacs is to do a C-x C-f ~/.emacs RET  

for frequent .emacs users, typing C-x C-f ~/.emacs is also tiring, or basically you might say its redundant. once a .emacs is edited, one has to load it again to see the change effects. to make it a quick access, you could just create a function which opens a .emacs if not open and loads it if its already open. a keybinding proves very convenient and here is what you add in your .emacs.


(defun open-load-init-emacs ()
"function to open the .emacs in lisp mode and load it"
    (interactive);; function be called interactively
    (if (equal (buffer-name) ".emacs")
         (eval-buffer) ;; if open, evaluate buffer or load it
         (progn (find-file "~/.emacs") (eval-buffer))
    )
    ;; the progn creates a body of commandsfind .emacs, load it
    (lisp-mode) ;; enable lisp mode)
(global-set-key "\C-x." 'open-load-init-emacs) ;; set the key binding to C-x.
cheers
shyam

git quick start guide

I can almost certainly assert that Emacs has been the best piece of open source software, for that matter, the best software I have ever used. The reasons are simple. Emacs in itself is simple, it just does the jobs right, it isn't troublesome. Some one somewhere has foreseen things which you would want in an editor and when you look out for that one thing you miss badly, you find it and it works awesome. Alongside Emacs, I started using this piece of open source software git.

Git is a version control software tool and was implemented by Linus Torvalds. I must say git has been as wonderful as software as emacs. My tryst with version control starts from using a commercial  Clearcase to an open source CVS, to a seemingly meaningless SVN to an ideal tool git. Apparently, any piece of open source software is almost always written by geeks for geeks and there is a lot of "meaningful" documentation underneath. And for many of the "just-get-the-job-done" people, I  think, this is the crux of the problem. There is no "next-click-next-click" tool flow. We all grew up playing "space commander" on "windows" you see.

To make things easier, to get as many people use git instead of svn, I thought, I should list down a quick start guide to moving from svn to git. There are numerous amounts of git tutorials on the net which are far more detailed and far more interesting. So this is by no means undermining the effectiveness and the content of all such documentation. This is not a detailed user guide, it's just a quick start guide, which lets you start with changing things.


Cheers 
Ghanashyam

Saturday, May 7, 2011

a weekend sketch...


I found some good time to spend this weekend. while am not at work, one of the things I would normally "like" to do is sketching. I am not that good a creative artist, though, I am just amazed by how beautiful women are. They are perfect, physically and in human nature. One can just wonder in awe as to how beautiful a woman is. She's got those prettiest pair of eyes in the universe, she s got those curves which you always crave to feel, she s got those mellifluous voice you just can't stop imagining, she s got the tender slender gait which you cannot stop staring at... she is beautiful. If there exists a god, he must have had an incredibly awesome experience creating a woman. One way to get the experience is to sketch it out.. and here is the result of some good time I spent. The aim is to get it right by trying over and over again as the so called god got it first time...


cheers
Ghanashyam

time stamping with org-mode calendar

org mode in emacs has this wonderful feature of integrating the calendar in itself. A C-c . key binding in org mode invokes the calendar. you can move around dates with the S- ->(shift right arrow: forward day) and S-<-(shift left arrow: backward day). but this is only in an org-mode buffer, buffers which have a .org extension or buffers where you manually switch on org-mode by M-x org-mode RET.

one can enable this on all types of buffers globally. put this in to your .emacs

(global-set-key "\C-c." 'org-time-stamp)

so in any buffer, one can C-c . to get in a date time stamp.

cheers!
shyam