3 Simple Steps to fix ipython notebook error on MAC OS X

ipython notebook debuggingI thought I did something stupid to my installation of python on mac and python notebook stopped working. ipython works but ipython notebook went haywire.

Tried reinstalling python but the problem remained. Everytime got this error when ipython notebook was invoked.

return _parse_localename(localename)
File "/Users/millerc/anaconda/lib/python2.7/locale.py", line 435, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

Today, the lazy me corrected the problem with help from this post. It turns out the error occurs after installing the latest Mac OSX 64-bit python.

Fortunately the solution is simple. Follow the 3 simple solution steps

Step 1
open your .bash_profile

Step 2
Add these lines to your .bash_profile:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Step 3
Reloaded the profile:

source ~/.bash_profile

Now run ipython notebook

ipython notebook

Done.

Knight in Fortran

Knight Move Game in Fortran 90
This is a brain game that you might enjoy. In the chess board you can move the knight as if you’re playing a regular game of chess, but you need to cover the whole board with the least possible moves, a good score would be 65 moves or less. This is a very good training for strategy games.

Written in fortran. Just for fun!! As always work in progress..

Continue reading

Few examples of Matlab to Python conversions

Matlab to PythonA few days back, was converting a matlab code to python. Out of habit , I kept going back to matlab syntax. I logged all places that I made these errors.

So here are the notes. Hope its of some use.

1. () to []

nd=topo(j,i)
X(j,i)=coords(nd,1)
Y(j,i)=coords(nd,2) 

SyntaxError: can’t assign to function call

nd=topo[j,i]
X[j,i]=coords[nd,1]
Y[j,i]=coords[nd,2] 

2. 1 to 0

X(j,i)=coords(nd,1)
Y(j,i)=coords(nd,2) 

IndexError: index (2) out of range (0<=index<2) in dimension 1

X[j,i]=coords[nd,0]
Y[j,i]=coords[nd,1] 

3. zeros to zeros

B=zeros(2,edof)

the correct form

B=np.zeros((2,edof))

4. array to array

D=G*[1 0; 0 1];    

in python

D_ps=G* np.array([[1.0,0.0],[0.0,1.0]])

5. % to #

% is comments in matlab
# is comments inpython

6. For to for

for i=1:nnel
node(i)=nodes(iel,i);
end

python

for i in range(nnel): 
        node[i]=nodes[iel,i]

7. Matlab find to python find

L1 = find(coordinates(:,2)==min(coordinates(:,2))) 

in python

l1 = np.where(coords[:,1]==np.min(coords[:,1])

Gas turbine technology

Found this excellent but old material on Rolls-Royce’s website. Ideal for anyone interested in brief text on introduction to jet engine…

A Semi Functional VTK ICP App – Demo

Experiments with VTK continues. My motivation got a booster when I learnt about the open source implementation of iterative closest point algorithm present in VTK.  So here’s the labor of love of playing with ICP in VTK.

A semi functional VTK ICP App. Watch the demo, code coming soon.  

Side note: The raptor used in the demo is a fav of my two year old son these days!!

As always, still a work in progress, will refine as and when I get some free time, which is becoming a luxury now a days. 

For the uninitiated, ICP stands for iterative closest point and is used ……. well read this wikipedia article for a complete explanation.

Be a learning machine

via this

What are the traits for thriving in the knowledge economy? The trait is to – Be a learning machine. Charlie Munger in a speech to USC Law School Commencement – May 13, 2007 tells

I constantly see people rise in life who are not the smartest, sometimes not even the most diligent, but they are learning machines. They go to bed every night a little wiser than they were when they got up and boy does that help, particularly when you have a long run ahead of you.

 

 

Investing in yourself

You can never go wrong with investing in yourself.

A couple of days back while browsing, stumbled upon these lines.

They resonate with what I believe in, so here you go.

“You can never go wrong with investing in yourself – that way, everything that you learn and have can go with you.

You can invest in three ways – your health, your network, and your knowledge, and all three are necessary to be successful”

While studying or training or in your job, investing in yourself is the best thing you can do!!

And the best thing is that this investment only needs your commitment and an hour a day.

So are you giving yourself that one hour?

Follow

Get every new post delivered to your Inbox.

Join 927 other followers

%d bloggers like this: