tag:blogger.com,1999:blog-44821622625661688542024-02-18T20:57:42.160-08:00>> Unscripted|Just keep learning...Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-4482162262566168854.post-5009407106259074762013-02-10T21:49:00.001-08:002013-02-13T08:27:12.047-08:00MVC in MatlabSome time ago I started to make use of Matlab's object oriented capabilities. (In true Matlab style, inheritance is notated with a 'less than' sign: dog < animal) The application I refactored has a GUIDE front end. I had used GUIDE to make user interfaces before; and forged ahead using what I had learned from the user's guide. While I have been really pleased with the benefits of OO, I was struggling to figure out how to apply patterns to my program, specifically MVC. Well, last weekend I cracked that nut; and moreover, while watching the Grammys I made a little demo app to share.<br />
<br />
Model View Controller (MVC) is a compound pattern whose goal is to separate responsibilities into modular pieces that can be interchanged relatively easily. If you didn't need a user interface, all you'd have to worry about is the model. Why should you have to burden the model with user interface code? Obviously you shouldn't, thus the model view separation. Introduction of a controller loosens the coupling between the model and the view and, if done well, allows the behavior of the system to be modified by replacing the controller with a different one. After the jump, I'll show you how to apply the pattern to a traditional Matlab GUI.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlylMBy-1wnFCTidwjrD3FX4ypPrpDQ4amtsobm2bKpwoZJCe2U8kcrW_ciY_IAvX8WGMomzwIxc24x3tPMYr80e0W4viB0a9jc-Ze3nCULMkw51uZR37u6_rwq3zMXy3POYtV0y8Xu38W/s1600/mvc.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlylMBy-1wnFCTidwjrD3FX4ypPrpDQ4amtsobm2bKpwoZJCe2U8kcrW_ciY_IAvX8WGMomzwIxc24x3tPMYr80e0W4viB0a9jc-Ze3nCULMkw51uZR37u6_rwq3zMXy3POYtV0y8Xu38W/s1600/mvc.png" height="225" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Model View Controller</td></tr>
</tbody></table>
<br />
<a name='more'></a><br />
I'm following the MVC example laid out in the excellent book <a href="http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124" target="_blank">Head First Design Patterns</a>. My starting point is the quick start GUIDE 'GUI with Uicontrols'. If you choose this GUIDE template and view the m file, you can see how it started and compare it to the MVC version I am presenting. Of course there are a few idiosyncrasies that the Matlab scripting language imposes. The main one is that the user interface is not a class; rather, it is a handle graphics object. The good news is that it's not hard to work around.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoNZEQGWl9JPw_-zR6i5VdlB0gKqobUnKgP8mNenh3gJIwVSI89Z9ybDtmsqgMUXPL8OBg6dL6-MJSVG9Q5a79RK3eOmSJGsbXld-xD0frcyHtJPqan1O7oY8-94wMTlG-F-1c-n4SRBCM/s1600/guide.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoNZEQGWl9JPw_-zR6i5VdlB0gKqobUnKgP8mNenh3gJIwVSI89Z9ybDtmsqgMUXPL8OBg6dL6-MJSVG9Q5a79RK3eOmSJGsbXld-xD0frcyHtJPqan1O7oY8-94wMTlG-F-1c-n4SRBCM/s1600/guide.png" height="273" width="400" /></a></div>
<br />
We start with a top-level main function that instantiates the model class as well as the controller class and passes the model into the controller.<br />
<br />
<div style="height: 80px; overflow: auto; width: 550px;">
<pre>function main()
mymodel = model();
mycontroller = controller(mymodel);</pre>
</div>
We want to extract the meat of the template GUIDE into a separate model class. Here's what it looks like. I'm using all handle classes throughout because I don't care about instantiating multiple copies of any of them, and I want to be able to pass around references to my classes. In Matlab, that means handle classes. The model's only responsibility in the MVC pattern is to make its properties available for other classes to monitor through the observer pattern. More good news ... Matlab provides events and listeners and even has special property listeners. All you have to do is use the SetObservable attribute on the properties you want to monitor.<br />
<br />
<div style="height: 200px; overflow: auto; width: 550px;">
<pre>classdef model < handle </pre>
<pre> properties (SetObservable)
density
volume
units
mass
end
methods
function obj = model()
obj.reset();
end
function reset(obj)
obj.density = 0;
obj.volume = 0;
obj.units = 'english';
obj.mass = 0;
end
function setDensity(obj,density)
obj.density = density;
end
function setVolume(obj,volume)
obj.volume = volume;
end
function setUnits(obj,units)
obj.units = units;
end
function calculate(obj)
obj.mass = obj.density * obj.volume;
end
end
end
</pre>
</div>
<br />
How do we deal with this handle graphics user interface? Simple, we wrap it in a class. The view class is passed a reference to the controller object when it is created. It also instantiates the GUIDE graphics object, which is called <span style="font-family: Courier New, Courier, monospace;">measures </span>here. Notice that we also pass the controller into the GUI. Then we register listeners to the model properties and specify a method to handle the triggered events. This method has access to the visual elements of the GUI and modifies them appropriately in response to events. The <span style="font-family: Courier New, Courier, monospace;">addlistener </span>call has been modified here with an anonymous function definition that adds the self object, <span style="font-family: Courier New, Courier, monospace;">obj</span>. The event handler needs <span style="font-family: Courier New, Courier, monospace;">obj </span>to get the GUI handles structure.<br />
<br />
<div style="height: 200px; overflow: auto; width: 550px;">
<pre>classdef view < handle
properties
gui
model
controller
end
methods
function obj = view(controller)
obj.controller = controller;
obj.model = controller.model;
obj.gui = measures('controller',obj.controller);
addlistener(obj.model,'density','PostSet', ...
@(src,evnt)view.handlePropEvents(obj,src,evnt));
addlistener(obj.model,'volume','PostSet', ...
@(src,evnt)view.handlePropEvents(obj,src,evnt));
addlistener(obj.model,'units','PostSet', ...
@(src,evnt)view.handlePropEvents(obj,src,evnt));
addlistener(obj.model,'mass','PostSet', ...
@(src,evnt)view.handlePropEvents(obj,src,evnt));
end
end
methods (Static)
function handlePropEvents(obj,src,evnt)
evntobj = evnt.AffectedObject;
handles = guidata(obj.gui);
switch src.Name
case 'density'
set(handles.density, 'String', evntobj.density);
case 'volume'
set(handles.volume, 'String', evntobj.volume);
case 'units'
switch evntobj.units
case 'english'
set(handles.text4, 'String', 'lb/cu.in');
set(handles.text5, 'String', 'cu.in');
set(handles.text6, 'String', 'lb');
case 'si'
set(handles.text4, 'String', 'kg/cu.m');
set(handles.text5, 'String', 'cu.m');
set(handles.text6, 'String', 'kg');
otherwise
error('unknown units')
end
case 'mass'
set(handles.mass,'String',evntobj.mass);
end
end
end
end
</pre>
</div>
<br />
The controller knows about the model and the view; but it's only function in this demo is call model methods as requested by the GUI. In more realistic applications, it may interact with the view and the model in more complicated ways.<br />
<br />
<div style="height: 200px; overflow: auto; width: 550px;">
<pre>classdef controller < handle
properties
model
view
end
methods
function obj = controller(model)
obj.model = model;
obj.view = view(obj);
end
function setDensity(obj,density)
obj.model.setDensity(density)
end
function setVolume(obj,volume)
obj.model.setVolume(volume)
end
function setUnits(obj,units)
obj.model.setUnits(units)
end
function calculate(obj)
obj.model.calculate()
end
function reset(obj)
obj.model.reset()
end
end
end
</pre>
</div>
<br />
Finally, you can compare the m file created by the template GUIDE to the one in the listing below. You would see that the model was originally held in the handles structure of the GUI. The handles structure is one of the ways to store user data within a GUI. Now there is a separate model class that stands on its own. You may also notice that function listed below doesn't have the responsibility of modifying the graphics elements directly. Rather, it bumps that responsibility to the wrapping view class, which can respond to events from the model. Nor does it modify the model, but passes that responsibility to the controller.<br />
<br />
<div style="height: 600px; overflow: auto; width: 670px;">
<pre>function varargout = measures(varargin)
% MEASURES M-file for measures.fig
% MEASURES, by itself, creates a new MEASURES or raises the existing
% singleton*.
%
% H = MEASURES returns the handle to a new MEASURES or the handle to
% the existing singleton*.
%
% MEASURES('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MEASURES.M with the given input arguments.
%
% MEASURES('Property','Value',...) creates a new MEASURES or raises
% the existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before measures_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to measures_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help measures
% Last Modified by GUIDE v2.5 10-Feb-2013 20:14:47
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @measures_OpeningFcn, ...
'gui_OutputFcn', @measures_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before measures is made visible.
function measures_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to measures (see VARARGIN)
% Choose default command line output for measures
handles.output = hObject;
% get handle to the controller
for i = 1:2:length(varargin)
switch varargin{i}
case 'controller'
handles.controller = varargin{i+1};
otherwise
error('unknown input')
end
end
handles.metricdata.density = 0;
handles.metricdata.volume = 0;
set(handles.density, 'String', 0);
set(handles.volume, 'String', 0);
set(handles.mass, 'String', 0);
set(handles.unitgroup, 'SelectedObject', handles.english);
set(handles.text4, 'String', 'lb/cu.in');
set(handles.text5, 'String', 'cu.in');
set(handles.text6, 'String', 'lb');
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes measures wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = measures_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes during object creation, after setting all properties.
function density_CreateFcn(hObject, eventdata, handles)
% hObject handle to density (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function density_Callback(hObject, eventdata, handles)
% hObject handle to density (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of density as text
% str2double(get(hObject,'String')) returns contents of density as a double
density = str2double(get(hObject, 'String'));
if isnan(density)
density = 0;
errordlg('Input must be a number','Error');
end
handles.controller.setDensity(density)
% --- Executes during object creation, after setting all properties.
function volume_CreateFcn(hObject, eventdata, handles)
% hObject handle to volume (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function volume_Callback(hObject, eventdata, handles)
% hObject handle to volume (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of volume as text
% str2double(get(hObject,'String')) returns contents of volume as a double
volume = str2double(get(hObject, 'String'));
if isnan(volume)
volume = 0;
errordlg('Input must be a number','Error');
end
handles.controller.setVolume(volume)
% --- Executes on button press in calculate.
function calculate_Callback(hObject, eventdata, handles)
% hObject handle to calculate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.controller.calculate()
% --- Executes on button press in reset.
function reset_Callback(hObject, eventdata, handles)
% hObject handle to reset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.controller.reset()
% --- Executes when selected object changed in unitgroup.
function unitgroup_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in unitgroup
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if (hObject == handles.english)
units = 'english';
else
units = 'si';
end
handles.controller.setUnits(units)
</pre>
</div>
<div>
<br />
So, the model notifies the view when its properties change. the view updates the GUI as appropriate. The GUI sends requests to the controller in response to user interaction. The controller instructs the model to update. You would not want to use such a heavy solution for this simple model; but it doesn't take much more complexity for the benefits of MVC to shine through.<br />
<br />
The complete source code for this demo is available at <a href="http://www.mathworks.com/matlabcentral/fileexchange/" target="_blank">Matlab Central File Exchange</a>.<br />
<br />
Have fun with OO and MVC in Matlab!</div>
Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com7tag:blogger.com,1999:blog-4482162262566168854.post-61519800402724001462012-09-27T18:19:00.001-07:002012-09-27T18:19:07.494-07:00Udacity CS373: A ReviewWhew, it's been a looong haul. I finally finished up CS373 on Udacity, Sebastian Thrun's class on programming a robotic car. I think I started in the second session; and they removed all time limits on the class shortly thereafter. Udacity realized that they had a lot of busy people, a lot of professionals, people already in the workforce, people like me taking their courses; and they wanted to make it easier for us to progress at a sustainable pace. Good thing too because real life has a way of intruding when you least expect it. So, kudos for that. I finished and got this spiffy certificate for my efforts!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-0FyrUcZFL7OEYLvVboK6xO3-Si87TEJCqbJF7S31wHJmoLHPA7DTCWUtZw94MuMTo-YC2X5POY5iEGiAWHB3uKSMgpx2fUDYd3oM_90fMoHqSCJsyBptoGiSIOoy5xkqYAmxlsJBffn4/s1600/certificate.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="308" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-0FyrUcZFL7OEYLvVboK6xO3-Si87TEJCqbJF7S31wHJmoLHPA7DTCWUtZw94MuMTo-YC2X5POY5iEGiAWHB3uKSMgpx2fUDYd3oM_90fMoHqSCJsyBptoGiSIOoy5xkqYAmxlsJBffn4/s400/certificate.jpg" width="400" /></a></div>
<br />
CS373 is different than the Stanford AI course mainly in that it introduces programming assignments in Python. So, in addition to the videos and the interactive quizzes, they put up an interactive Python session with partial programs. Once you complete the program you can run it, view the results, and submit it for grading. It's really pretty slick. Later on, when the programs got more complex, I preferred to copy it into my own editor, then copy the final code back into the webpage; and that worked out fine.<br />
<br />
The course starts with localization and tracking using histogram filters, particle filters, and Kalman filters. This section of the course is just a beautiful overview of the different filtering methods. You really come away with a nice perspective on the benefits and tradeoffs of each approach. Normally Sebastian presents topics with great intuition and a clear approach; and this course is no exception. Kalman filters can be particularly tricky to understand, but by focusing on the one dimensional case he was able to explain the intuition behind them too. The much more complicated equations of the two dimensional case were presented without really much justification and the programming assignment only tested that we were able to use them. It may have struck some folks as curious that he said we had just done the hardest bit of the whole course; and by doing so he kind of betrayed the underlying, hidden complexities of the subject. As presented, it definitely wasn't the hardest part of the course.<br />
<br />
The session on search covered A* and dynamic programming with value policies and optimal policies. I thought the A* programming assignments were some of the hardest in the course, because of a trick that I won't reveal here. I will say that sometimes I felt like you had to be a mind reader to figure out what you were supposed to do. More than once I had to resort to advancing to the answer, then going back and submitting a program after seeing his solution. If you find that you have to do the same, don't feel bad. You won't be penalized for it.<br />
<br />
The overall goal of the course was to teach all the main aspects of programming a robotic car. I think the course actually delivers on this promise by teaching on topics in localization, tracking, search, PID control, and SLAM. Of course there are many areas that were not covered, like vision, classification, LIDAR, and many other potential topics. The thing is, the devil is always in the details. I hope everyone realizes that you don't take a course like this and then go build the Google Car. But the core concepts are there!<br />
<br />
The last section on SLAM is actually bonus material, and offers some of the most challenging programming assignments of the whole course. In teaching us graph SLAM, Thrun takes us beyond the scope of anything he taught in a single course at Stanford. I really enjoyed the course. Even though most people who take it won't actually be building robotic cars, there are lots of way to use these algorithms. Go and play, learn, and create.<br />
<br />Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com0tag:blogger.com,1999:blog-4482162262566168854.post-29146212352971348022012-06-30T19:46:00.002-07:002012-06-30T19:46:38.170-07:00Just Keep LearningI've gotten through the first two units in my <a href="http://www.udacity.com/" target="_blank">Udacity </a>AI class. Unit 1 was on localization using Histogram filters; and unit 2 was on tracking using Kalman filters. It's an amazing class to me in much the same way that the Stanford AI class was. It just cuts through all the BS and presents the core ideas, not dumbing them down, rather approaching the material using intuition first; and leaving mathematical formalism for later (another class perhaps), after the core ideas are absorbed. I think I'll blog more about those methods in the future; but I wanted to go in a different direction today.<br />
<br />
I thought I would take this opportunity to acknowledge two teachers who have contributed in no small part to my recent renaissance of learning. I've always been a lifelong learner; but I would say I was getting a little down about not being able to keep up with the areas I'm interested in. A great teacher can be such an inspiration in your life; but they also back it up by giving you the knowledge and tools to act on your dreams and ambitions.<br />
<br />
So, click on my friends; and let me know about your favorite teachers.<br />
<br />
<a name='more'></a><br />
<br />
When I got my iPad, I quickly discovered iTunes U. Soon after, I discovered MIT's online courses, and <a href="http://ocw.mit.edu/about/ocw-stories/gilbert-strang/" target="_blank">Gilbert Strang</a>. Professor Strang has been teaching Math for over 50 years now I guess; and I gather he's had a huge impact on how linear algebra is taught around the world. Not enough though because I was not taught in such a clear and concise fashion when I took it. <br />
<br />
His computational science and engineering <a href="http://ocw.mit.edu/courses/mathematics/18-085-computational-science-and-engineering-i-fall-2008/video-lectures/" target="_blank">lectures </a>absolutely blew my mind. His lectures on four special matrices and their applications should be required viewing for all engineering students. Their magic is the simple presentation of a common framework, using matrices of course, that is very quickly applied to very different applications, and that show you how to solve problems in the area. The range of applications he covers are greater than many students even get exposed to within a single major. Least squares, finite differences, electrical networks, trusses, finite elements, and on. <br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www-math.mit.edu/~gs/PIX/cupcakematrixtxt.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="264" src="http://www-math.mit.edu/~gs/PIX/cupcakematrixtxt.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://www-math.mit.edu/~gs/PIX/cupcakematrixtxt.jpg" target="_blank">Professor Gilbert Strang</a></td></tr>
</tbody></table>
<br />
After going through professor Strang's classes, I looked into Stanford's courses; and watched several of the programming lectures. Then an announcement caught my attention. Stanford was going to be offering a free, online course in artificial intelligence. I was hooked at that point. My assumption was that it would be the same type of recorded lectures that I was used to; but I was completely mistaken. Instead, this excitable and passionate German fellow started zipping through ideas and giving me simple quizzes. By the end of the first couple of classes, I felt like I had been through a month of lectures in a normal classroom. Thank you <a href="http://robots.stanford.edu/" target="_blank">Sebastian Thrun</a>. You helped me learn material that I thought would require much longer and slogging through many papers and books. Your vision for free and open education might actually change the world.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/bp9KBrH8H04?feature=player_embedded' frameborder='0'></iframe></div>
<br />
My alma mater is the University of Illinois at Urbana-Champaign. At the time, it was the third-ranked school in my field behind Stanford and MIT. I actually remember 4 or 5 excellent professors who were also gifted teachers. None of them conveyed the material with as much clarity and sheer joy as these two gentlemen have done though. Unfortunately, in hindsight I realize that some of that was due to my own immaturity at the time. I was not ready to receive a lot of what those professors were trying to pass on; nor did I have the scope of knowledge to assimilate what I was learning and connect the dots. <br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Alma_Mater_-_UIUC_-_DSC09095.JPG/450px-Alma_Mater_-_UIUC_-_DSC09095.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Alma_Mater_-_UIUC_-_DSC09095.JPG/450px-Alma_Mater_-_UIUC_-_DSC09095.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Alma_Mater_-_UIUC_-_DSC09095.JPG/450px-Alma_Mater_-_UIUC_-_DSC09095.JPG" target="_blank">Alma Mater</a></td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
How cool would it be to go back and be able to hear some of those lectures again with the benefit of a little more experience? Very. Ah well, that is the great trade-off between youth and experience I guess; but that is also a problem that things like Udacity, MIT OpenCourseWare, Kahn Academy, etc are solving. Been a couple of years since you took the class and want to go back and hear something explained again? Just watch it again!<br />
<br class="Apple-interchange-newline" />What teachers have inspired and equipped you?<br />
<br />Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com0tag:blogger.com,1999:blog-4482162262566168854.post-76991557972534933212012-06-12T10:54:00.002-07:002012-06-12T11:22:39.705-07:00The Uncanny ValleyThe first authorized translation of this article is now available <a href="http://spectrum.ieee.org/automaton/robotics/humanoids/the-uncanny-valley" target="_blank">here</a>, along with an interview with Masahiro Mori <a href="http://spectrum.ieee.org/automaton/robotics/humanoids/an-uncanny-mind-masahiro-mori-on-the-uncanny-valley" target="_blank">here</a>. It's fascinating how some ideas don't catch on for many years, then take off when the time is right.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://spectrum.ieee.org/img/Figure%201%20Uncanny%20Valley-1338912955829.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="272" src="http://spectrum.ieee.org/img/Figure%201%20Uncanny%20Valley-1338912955829.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://spectrum.ieee.org/img/Figure%201%20Uncanny%20Valley-1338912955829.png" target="_blank">The Uncanny Valley</a><span id="goog_1404688019"></span><span id="goog_1404688020"></span><a href="http://www.blogger.com/"></a></td></tr>
</tbody></table>
<br />Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com0tag:blogger.com,1999:blog-4482162262566168854.post-43429185750581737882012-06-10T09:06:00.001-07:002012-06-11T13:02:34.821-07:00The Hackers, The Dreamers, and MeThe always <a href="http://www.hanselman.com/blog/" target="_blank">informative </a>and <a href="http://www.thisdeveloperslife.com/" target="_blank">entertaining </a>Scott Hanselman put out the <a href="http://www.hanselman.com/blog/SheLetMeTakeTheComputerHomeHowDidYouGetStartedInComputersAndProgramming.aspx" target="_blank">call</a> for stories on how we got started in computers and programming. Well, I've never tried writing mine down, so I thought I'd try capturing some of the magic of my youth. Click past the break if you'd like to join me on a stroll down memory lane.<br />
<br />
<a name='more'></a><br />
<br />
<h3>
The Early Years</h3>
<div>
<br />
My earliest computer-related memory was of an Atari gaming console at my cousin's house. They showed me how to play Adventure, showed me the easter egg (didn't know what an easter egg was, but it was very cool to see secret information the programmers had hid in their game), and I was <i>obsessed</i>. This probably lit the spark that inspired my parents to get me my first computer.<br />
<br /></div>
It all began with the Commodore Vic-20, as with so many other folks around my age (ex: Linus Torvalds). It was of course used as a gaming machine for my sister and I, but I was fascinated by the tantalizing possibilities hinted at by the sparse startup screen. Bytes free <i>for what</i>? What in the world could I do with all those bytes? I had hours of fun playing around with BASIC and trying to figure out ASCII characters, colors, etc. Simple stuff, I never was much of a hacker.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/en/thumb/8/83/Commodore_VIC_20_box.jpg/639px-Commodore_VIC_20_box.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="150" src="http://upload.wikimedia.org/wikipedia/en/thumb/8/83/Commodore_VIC_20_box.jpg/639px-Commodore_VIC_20_box.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Commodore Vic-20</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/en/f/ff/VIC-20_Boot_Screen.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="112" src="http://upload.wikimedia.org/wikipedia/en/f/ff/VIC-20_Boot_Screen.gif" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Vic-20 startup screen</td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
I spent more hours typing in programs from magazines in machine language. Not basic, not assembly, but rows and rows of 0's and 1's. They were kind enough to include checksums so one could be reasonable certain that one did not add or remove any 1's. I also started creating some programs in BASIC for my own entertainment. I started creating a platformer (I didn't know what the genre was called at the time). I made a little guy with some walking animation, 2 or 3 levels, and some screen scrolling, the ability to jump up and down levels...and then I ran out of memory. Argh!<br />
<div>
<br /></div>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/commons/8/86/Commodore_1530_Datasette_VIC-20.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="200" src="http://upload.wikimedia.org/wikipedia/commons/8/86/Commodore_1530_Datasette_VIC-20.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Datasette</td></tr>
</tbody></table>
<div>
I got a datasette recorder to load and save programs. Boy was I living large then! True, it took several minutes to load or save, and sometimes it didn't work, but I didn't know any better. The scientist in my was curious about how the bits and bytes of the program sounded on the tapes; and I would play them in my boom box. A lot of static and tones of various pitch and length. Once in a while, I would hear that sound on the radio and wonder who was sending computer data back and forth over the radio waves? Russian spies perhaps? Yes, I did try recording from the radio and loading into the computer. No, it didn't work. I think I knew it wouldn't back then; but I was always a dreamer.</div>
<div>
<br />
<h3>
High School</h3>
</div>
<div>
<br /></div>
<div>
Well, I eventually got upgraded to the new cool kid on the block, the C-64. I knew I would never run out of memory again. I think I got my first floppy drive around that time, 2 joysticks, more cool games. I learned the word 'sprites' for the first time.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Commodore-64-Computer.png/640px-Commodore-64-Computer.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="158" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Commodore-64-Computer.png/640px-Commodore-64-Computer.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Commodore 64</td></tr>
</tbody></table>
I loved the text adventure games (Zork), and worked on writing my own. I had one that I based loosely on The Goonies. My friends and I held ping pong tournaments in our basement and calculated all the requisite stats on the trusty C-64. I still had that computer after college; and in a brief period of living at home, I was playing The Bard's Tale on it until it fried a chip somewhere. RIP mi amigo.<br />
<br />
In high school, we had Apple IIe's in the library and in math class. They were not as easy to use as the Commodores, but I enjoyed playing with them as well. I wish I could remember what all I used them for. I did not dive headfirst into the manuals and program on them. I was aware of a neat curiousity...a one line program for an ASCII skiing game. <i>One line</i>! Then there was this nosy psychologist program, Eliza, with whom I would converse on occasion.<br />
<br />
My love of computers was apparent to my math teacher; and he recommended that I attend computer camp. Can you imagine? A camp for other computer geeks like me? I could not, but I went anyway. Where <i>was </i>that camp? Down by Chillicothe, IL I believe. I made some cool friends, swam, computed, played chess, crushed silently on a girl, and generally was in heaven. I remember borrowing a book on programming adventure games. By the end of the week, I turned in a tattered and dog-eared thing and the counselor let me get away with only a scowl.<br />
<br />
You see, I was never a hacker. I was not really a tinkerer. I was a dreamer. I loved the idea of creating a program, a whole world of my own that I could organize any way I saw fit.<br />
<br />
<h3>
Post-High School</h3>
<br />
I was convinced that I would major in computer science in college. My dad though was worried that it was too narrow of a field and talked me into electrical engineering instead. That's OK. I learned FORTRAN and assembly. Learned C on my own. Learned computer architecture and the beginnings of switching theory. Later on took a class on C++, got into Matlab.<br />
<br />
Sometimes I think that I made the wrong choice, but I know a lot now that I would not have had I stayed within CS. Who knows. I just attended a conference where a couple of guys from <a href="http://www.havok.com/products/vision-engine" target="_blank">Havok </a>exhibited their Vision Engine and presented a paper. I admit that I was a bit of a fanboy. From all I heard and saw, it seems like they have an incredibly clean, beautiful, and optimized codebase; and I would have dearly loved to have contributed to it.<br />
<br />
In the end, I have to stick by my new motto...<br />
<br />
just keep learning.<br />
<br /></div>Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com1tag:blogger.com,1999:blog-4482162262566168854.post-84656166857509472222012-05-27T21:58:00.001-07:002012-05-27T21:58:19.811-07:00Powers of Ten<br />
I've completed the first version of my first Python application, one that was started for me by my high school intern. It's purpose is to read in data from a binary file into memory, and then promptly save it out to a Matlab mat file. The data was recorded in real-time, frame-by-frame, and thus is read in the same way. The interesting thing about this little application is that I have versions of it written in C++ (not by me) and Matlab (me).<br />
<br />
So I thought I would share some timing information.<br />
<br />
If this is the sort of thing that floats your boat, by all means click through the jump and share in the geekery.<br />
<br />
<a name='more'></a>Did you ever see the <a href="http://vimeo.com/819138">Powers of Ten</a> video by Charles and Ray Eames? It's a fascinating glimpse into different scales of matter in our universe. Dudes made some groovy <a href="http://en.wikipedia.org/wiki/Eames_Lounge_Chair">chairs </a>in their day too.<div>
<br /></div>
<div>
Anyway, the timing data I obtained brought it to mind. Although I can't claim to offer any insight into the universe in which we live, I can perhaps reinforce some stereotypes about the relative performance of Python and C++. I don't know if there are any big surprises here, but let's get to it.</div>
<div>
<br /></div>
<div>
I tested each of the three implementations on six different files ranging in size from 15.65 Mb to 556.7 Mb. This spans the typical range that we see in the sizes of these files. Process run times were obtained for the C++ application using <a href="http://www.softpedia.com/get/System/System-Miscellaneous/GS-TIMER.shtml">GSTimer</a>. For Python, the timeit function was used, while in Matlab old reliable tic/toc served its purpose. The resulting times are plotted in Figure 1 below.<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmvgY0kMBqRFddoD50XfKM1x2tK_hAzbZ2La2ha1B42bUMyzUXM-s4aEcnhevXqK-HRtWnDSYU_AbRZGuVxjdQ2kr46mKot0qHluFPRrU0AWHq2ecm_hyphenhyphennr-yBMjkuPXfhW4EADqlJPqDK/s1600/runtimes.tif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmvgY0kMBqRFddoD50XfKM1x2tK_hAzbZ2La2ha1B42bUMyzUXM-s4aEcnhevXqK-HRtWnDSYU_AbRZGuVxjdQ2kr46mKot0qHluFPRrU0AWHq2ecm_hyphenhyphennr-yBMjkuPXfhW4EADqlJPqDK/s400/runtimes.tif" width="400" /></a></div>
<div style="text-align: center;">
<b>Figure 1. Run times for three implementations performed on six data files</b></div>
<br />
The performance is linear in file size for all three versions. If you're not used to looking at semilog plots, just know that if it were a straight line in this figure, it would show up as an exponential (actually 10^x) in a normal plot. I lose an order of magnitude in performance moving from one version to the next. Actually it's kind of amazing how regular it is.<br />
<br />
<h3>
C++</h3>
<div>
The performance of this one may have surprised me the most out of all three. Not because I wasn't aware of the speed benefits of this choice. It's just that for several years I used a modified version of this, compiled into a mex file and accessed directly from the Matlab command prompt, to open all my files. While it could be very fast, it could also run quite slow at times. So I found the mex file performance to vary quite a bit for whatever reason.</div>
<div>
<br /></div>
<div>
While the mex implementation was convenient, I had to get in and recompile when we upgraded our Matlab version after they required compiled mex files to use the extensions mex32 and mex64 instead of just dll. Then there were some annoying bugs that limited the size or the number of variables that could be read. Then some customers installed 64 bit versions of Matlab and I had to recompile for them. Then I spent a couple of hours futzing with it on my laptop for this post and couldn't even get it to work. Grrrrr. We have some history between us, this mex app and I; and I guess it biased me against the C++ implementation in general.</div>
<div>
<br /></div>
<div>
Putting up numbers like this though makes it all so much water under the bridge. I forgive you. I will just use you to convert files into Matlab format really really fast.</div>
<div>
<br /></div>
<h3>
Python</h3>
</div>
<div>
It seems a pretty common assumption that Python can lose up to an order of magnitude in performance from a C or C++ implementation, though sometimes it's less. Projects like <a href="http://pypy.org/">PyPy </a>hope to demolish this margin completely; however, it was definitely the case here. I found it to be nice and easy to program, having many similarities to Matlab scripting. I haven't gotten the hang of debugging Python yet; but I can see how I'll eventually approach the ease of interactive debugging that I currently enjoy in Matlab.</div>
<div>
<br /></div>
<div>
My solution was to read each frame's worth of data and store each variable in a dictionary entry of nested lists, appending as I go. Then, at the end I convert the dictionary entries to numpy arrays and use scipy's savemat function to complete the job. There is a missing point on the Python curve because the heap ran out of memory when loading the largest file. I would have to compile a 64bit version of Python to get around this. As I don't think it will seriously affect me, I probably won't go through the hassle.</div>
<div>
<br /></div>
<div>
I experimented with using arrays the whole way through and using vstack to enlarge them. Don't ever do this. It was slower than Matlab. Do Numpy arrays require preallocation to avoid performance hits like Matlab matrices do? I didn't think so, but it seems a likely explanation.</div>
<div>
<br /></div>
<div>
<h3>
Matlab</h3>
</div>
<div>
Due to my, ahhh, <i>history </i>with mex functions, I decided to just write a script in Matlab. It works. It's slow. It's what I've been using for a while, though I'm going to switch now to using either the C++ or Python version.</div>
<div>
<br /></div>
<h3>
Conclusion</h3>
<div>
My first foray into Python has been a success. I'm having fun with it. Along the way I've played with unit testing, timing, and profiling, finding each to be easy to get into. I'm also enjoying the Spyder IDE using IPython, though it has some idiosyncrasies if you choose to run your program in the default instance instead of opening up a dedicated one. I'd recommend the latter.</div>
<div>
<br /></div>
<div>
So, jump in, the water is fine, and the discoveries are cosmic.</div>
<div>
<br /></div>Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com3tag:blogger.com,1999:blog-4482162262566168854.post-73324560906914256502012-05-20T22:07:00.001-07:002012-05-20T22:07:52.947-07:00Living in the CrunchI've had reason to think about crunch lately. A week of late nights capped off by a 4am bedtime does make one think about such things. The effects of crunch are many and varied. You quickly dispense with the trappings of normal life: dinner with family, doing the laundry, your favorite TV show, etc. You start to feel <i>disconnected</i>, lose track of days.<br />
<br />
Your work starts to take on a more frenzied pace. Things you normally do to dot the i's and cross the t's get abandoned in order to achieve your goal. You start to lose a healthy sense of perspective. The thoughts that run through your mind at 2 am when you're amped up on caffeine and/or sugar are probably not well reasoned nuggets of analytical thought. Speaking of which your productivity takes a dive and you have to make up for it with even more hours of staring blankly at a mocking screen.<br />
<br />
So, maybe this is not how you have experienced crunch. It comes in various forms, differing levels of severity. A recent <a href="http://gamasutra.com/view/feature/170258/the_devils_workshop_an_interview_.php">Gamasutra piece</a> featured an interview with Blizzard's Jay Wilson, game director of Diablo III. He said about crunch<br />
<br />
<blockquote class="tr_bq">
"...while game development cycles have a tendency to crunch towards the end, usually for a few reasons, at Blizzard, it's actually driven by quality. But most companies you work for, it's not actually quality that makes you crunch. It's usually bad planning, and a lack of focus."</blockquote>
while defining it as working 50 to 60 hours per week, or more than 40 for an extended period of time. Now, game development crunches are some of the most well publicized (google "EA spouse"), but by no means the only examples. Others that I can think of include defense contractors, research organizations, small businesses. Almost no organization with a salaried workforce is immune.<br />
<br />
My experience with crunch has not been driven by quality unfortunately. How noble that sounds! Mine falls squarely in the second camp. I will grant that it is difficult to forecast projects when they are all so different. It is downright <i>hard </i>to juggle a limited number of people's participation in a number of projects, ramping in and out, overlapping just enough to balance out the month. The bottom line is that when you've signed a contract to deliver X to a sponsor at the end of Y months, you have to do your best to deliver if you hope to build a reputable name and win repeat business.<br />
<br />
Nevertheless, it sometimes makes me want to go herd goats for a living.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrs9E-glmIqMFrzv9ob3MqDot0hSEKtovWa1TEN8gMEyhUD-xh3sIm49OEh_HbvsFRgMqHWeu0aePp5JFHgNdOxpz6oNf7cu8UyI7PFIYp1HOr1Acmr82slLAkeovczIrw6029O12PPDWZ/s1600/goat-eating-in-a-forest_w725_h499.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrs9E-glmIqMFrzv9ob3MqDot0hSEKtovWa1TEN8gMEyhUD-xh3sIm49OEh_HbvsFRgMqHWeu0aePp5JFHgNdOxpz6oNf7cu8UyI7PFIYp1HOr1Acmr82slLAkeovczIrw6029O12PPDWZ/s320/goat-eating-in-a-forest_w725_h499.jpg" width="320" /></a></div>
<br />
<div style="text-align: center;">
<a href="http://www.public-domain-image.com/fauna-animals-public-domain-images-pictures/goats-public-domain-images-pictures/goat-eating-in-a-forest.jpg.html">Goat eating in a forest by Scott Bauer, U.S. Dept of Agriculture</a></div>
<br />
Is there any industry, any company, where the grass truly is greener? I suspect it depends more on the good fortune to work with an experienced project manager who knows how to estimate cost and calculate burndown rates.<br />
<br />
In the meantime, I'll dutifully keep doing my crunches. My abs should really be harder than this by now.<br />
<br />
For more information about crunch, check out <a href="http://www-cs-faculty.stanford.edu/~eroberts/cs181/projects/2004-05/crunchmode/ea-spouse.html">Crunch Mode: programming to the extreme</a>.<br />
<br />Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com0tag:blogger.com,1999:blog-4482162262566168854.post-45146134216228990252012-05-16T21:27:00.005-07:002012-05-16T21:27:50.005-07:00Big Rocks<span style="text-align: left;">This blog is not for you.</span><br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Hear that world? This blog is for me. It's my own record of things I'm learning and topics I'm interested in. It's a professional diary of sorts. What's that you say? Why even write a blog then? Hmmm, got me there. Well, accountability for one. I figure if it put it 'out there', I'll be more motivated to follow my personal development plan. I also admit that I'm looking for a creative outlet for my creative ramblings. But really, I hope that someday this blog could be for you, that I might someday be able to turn the corner in my mind from learning to teaching, absorbing to sharing, taking to giving. It's probably as much an question of self esteem as anything, but there you go. For now, this blog is for me.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
It's so easy to settle into your daily grind that you can wake up one day and months or years have gone by. I'd like to say that I'm being proactive to avoid that, but I have to admit that it's happened to me too. It's pretty easy to get lazy. Lately though, I've been picking up steam in the self help department. I used to be very much into self help books, you know, 7 Habits and all that. Great stuff but that's not what I'm referring to now. I'm speaking more about professional development. What new programming language should I learn, what new technologies do I need to come up to speed on? What hobby projects have been languishing in he recesses of my mind for too long?</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYZgHfwMfe_vDoRdUitQrWNYSFrPoXmHxUuovO6JOD-IUKzkCM2brN1VMxUC8uXWp7RHHcsT6duAgWVtpSp_i_5F90lYBWe6Gp2Uttjic1Pu_00neye0mktGumswQfMFAUQjjyROa06VKs/s1600/phn+432.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYZgHfwMfe_vDoRdUitQrWNYSFrPoXmHxUuovO6JOD-IUKzkCM2brN1VMxUC8uXWp7RHHcsT6duAgWVtpSp_i_5F90lYBWe6Gp2Uttjic1Pu_00neye0mktGumswQfMFAUQjjyROa06VKs/s320/phn+432.jpg" width="319" /></a></div>
<div style="text-align: center;">
<b>lazy (adjective): <span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px;">disinclined to activity </span></b></div>
<div style="text-align: center;">
<b><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px;">or exertion </span><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px;">:</span><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px;"> not energetic or vigorous</span></b></div>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;"><br /></span></span><br />
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">I've made a list. I like lists. They appeal to my analytic mind and organizational gene. It's not comprehensive by any means, but it's some big rocks. (you know about big rocks all you self-helpers). So, I'll spend the rest of this post working on my list. Enjoy!</span></span><br />
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;"></span></span><br />
<a name='more'></a><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;"><br /></span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://0.gvt0.com/vi/PtshodDf_pw/0.jpg" height="266" width="320"><param name="movie" value="http://www.youtube.com/v/PtshodDf_pw&fs=1&source=uds" />
<param name="bgcolor" value="#FFFFFF" />
<embed width="320" height="266" src="http://www.youtube.com/v/PtshodDf_pw&fs=1&source=uds" type="application/x-shockwave-flash"></embed></object></div>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;"><br /></span></span><br />
<h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Start a blog</span></span></h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">check.</span></span><br />
<br />
<h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Be a better programmer</span></span></h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">This is painful to admit, but I've really stagnated as a programmer. True, it's not my primary field, but there are all kinds of engineers and scientists who become virtuoso programmers in the course of their careers. Meanwhile I have just kept plunking away at my procedural code and scripts, sprinkling in a class here and there. See, I'm a sucker for <i>beautiful</i>, <i>elegant </i>solutions, be they equations, electronics, or software. I have not seen much beautiful code in my life, but I now know that it exists; and there's a better way than what I'm doing. I've discovered patterns, unit testing, and the proper use of inheritance. The scales have fallen from my eyes and I can see the light. </span></span><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px;">Ah, sometimes ignorance is bliss though. Now I've got to think about how to work with all the legacy code I'm in charge of in such as way as not drive me (any more) crazy. The difference is: I was getting the the point of wanting to get away from programming, Now I see how it can save me and my zeal is renewed.</span><br />
<br />
<h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Learn Python</span></span></h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">I've got a start on this one. I've read through </span></span><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;"><i>Beginning Python: From Novice to Professional</i>, Second Edition, by </span></span><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px;">Magnus Lie Hetland. I've installed Python(x,y), the bundled distribution that includes numpy, scipy, matplotlib, the spyder IDE, the iPython console. I've been scripting in Matlab for almost 20 years; and I'm hoping to implement a lot of that with free tools. I've read several posts about Matlab versus Python lately that compare the two. There's a lot of hate towards Matlab, but I really do like it, warts and all. It does break down after a certain point. Yes, there's a path to do what you want to do, but it get's thornier and thornier the more complex you try to get. </span><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px;">And there's this - I've trained myself to avoid loops the Matlab way: vectorization. I'm going to have to get used to doing it the Python way: list comprehensions.</span><br />
<h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Study artificial intelligence and machine learning</span></span></h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">I don't know why I'm drawn to these fields...but I am fascinated by the Google car, all kinds of game AI, big data, and on and on. I've started down this road some months ago when Stanford started it's online AI course. I immediately dropped all other plans and joined up. I found it to be an extremely interesting course; and Sebastian Thrun was a particularly passionate and inspiring teacher (Peter Norvig was good too). I loved it so much that I signed up for Thrun's course on programming robotic cars through his new venture <a href="http://www.udacity.com/">Udacity</a>. Unfortunately, I've quickly fallen behind due to work demands, but fortunately, they've removed all time constraints from the course. Yeah!</span></span><br />
<h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Enter a Kaggle competition</span></span></h3>
<div>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">If you don't know about Kaggle, check it out <a href="http://www.kaggle.com/">here</a>. Companies who have a data analysis problem publish a dataset with Kaggle's help and have a competition with rewards for the best-performing solutions to the problem. Anything from the $3 million dollar Heritage Healthcare prize to a weekend hackathon for bragging rights, there is a competition for your level of commitment and ambition. I'm a big fan of making science and technology into sport, a 21st century sport. I've been a mentor and coach for FIRST robotics and Lego League; and Kaggle is doing something similar for the adult crowd. Do I have what it takes to compete against other really smart people? Well, I won't know until I try.</span></span></div>
<h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Publish a mobile app</span></span></h3>
<div>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">OK, so I upgraded to an Android smartphone partly so I could play with mobile app development. Been reading Java books for a while, a few Android development books. I had an idea for a mod of the cube puzzle demo, but quickly got in over my head with OpenGL...so I bought a book on OpenGL ES. Have you picked up on my obsession with books? When it comes to sitting down and learn by coding, I have a much harder time. I think that's going to be my biggest challenge. My wife has cut me off of buying books for a while, so that might help me shift my focus. Thanks honey! I have some other app ideas too, so I'll get back to Android one of these days.</span></span></div>
<h3>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Write a game</span></span></h3>
<div>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Yeah I know, me and everybody else. And their brother. But I would love to use some cool concepts in AI to achieve a convincing level of emergence. Games today don't use the full power of AI because it's too unpredictable. They can't adequately control the gameplay if it's too complex. The danger of giving up that degree of control is that you get rid of the fun. Your game becomes just a simulation. I believe however that there's a nut to crack here. Maybe I'll end up with a simulation; but that's OK. Those are useful too.</span></span><br />
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;"><br /></span></span><br />
<span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: 12px; line-height: 20px;">Well, that's my list for now. If you stopped by out of curiosity, send some encouraging thoughts my way and check back sometime. Maybe I'll be able to say that this blog's for us.</span></span></div>Chris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com0tag:blogger.com,1999:blog-4482162262566168854.post-50012643495494545322012-05-11T14:43:00.000-07:002012-05-11T14:46:19.598-07:00Hello worldChris Schwarzhttp://www.blogger.com/profile/09382212401926432856noreply@blogger.com0