The Emotional Bank Account describes the amount of trust that has been built up in a relationship. Interdependent relationships depend on the status of this bank account.
Habit 4: Think win/win
Win/win sees life as cooperative, not competitive. It is a way to reach decisions that are better than compromises.
There are other paradigms for making decisions (e.g. win/lose). Sometimes we are scripted with these paradigms, but we can change these scripts. (See habits 1-3)
Habit 5: Seek first to understand, then to be understood
We tend to listen autobiographically. We try to relate what the person is saying to our own experience. We should listen to their story before trying to clearly communicate our own story.
Listen to both content and feeling of what the other person is saying.
Habit 6: Synergize
Value the differences. Your motive for valuing the differences is that they will lead to creative win/win solutions.
One example of a difference: logical vs. creative thinking (right-brain vs. left brain)
Habit 7: Sharpen the saw
Sharpening the saw increases your personal PC (your ability to produce results)
Four dimensions of renewal: physical, spiritual, mental (these relate to habits 1-3, your ability to be independent); relational (this relates to habits 4-6, your ability to be interdependent)
The 7 Habits of Highly Effective People: Powerful Lessons in Personal Change
Stephen R. Covey
2004, Free Press
Introduction: The 7 habits are based on the following principles
P/PC Balance: P is production (the results of your work), PC is production capacity (your ability to produce results). If you neglect PC, you will never get P.
Maturity continuum: People grow from dependence to independence to interdependence. Interdependence is the idea that independent people come together to cooperate and create something greater.
The first three habits will bring growth in independence, and the second three habits will bring growth in interdependence.
Habit 1: Be proactive
You can choose how you respond to situations around you.
You may respond based on a script, that is, how you responded in the past, e.g. based on child hood experiences of pain. However, you can rewrite that script.
People who aren’t proactive complain about their circle of concern. Proactive people intentionally expand their circle of influence.
Habit 1 is personal vision. The vision is that you can proactively write a new script, no longer reacting to your past or other people.
Habit 2: Begin with the end in mind
Write a personal mission statement that governs your day to day decisions.
Leadership vs. management: Leadership is doing the right things (things that correspond with a goal or vision). Management is doing things efficiently. It is possible to be doing the wrong thing very efficiently. e.g. hacking your way through the jungle, but you find out you have been going the wrong direction.
Habit 2 is personal leadership. Your mission statement ensures you are doing the right things.
When writing your mission statement, ask: what is my life centered on.
Habit 3: Put first things first
Urgent vs. important. Many people live their life doing the urgent things, assuming that they will do the important things. This leads to burn out, and you will miss important things that are not urgent (e.g. relationships with people, spiritual growth)
Planning your schedule on a weekly basis will help fit in important things that aren’t urgent. Does your time management tool allow you to test agenda items against your mission statement?
Delegation is important in managing your own schedule. Gofer delegation gives the person a lot of instructions, but doesn’t build their PC. Stewardship delegation allows them the freedom to choose how they will complete the task.
Habit 3 is personal management. That is, effectively doing the things that, in habit 2, you determined are the right things to do.
Some personal examples
It’s easy to see the principle of P/PC Balance at work. One example is getting enough rest. When I rest, I am working on my production capability. If I am always producing and never resting, eventually I will be forced to rest. Another example is purchasing a new tool. When I bought a new laptop, it increased my production capability for working on school projects.
Personal leadership is the idea of making sure you spend your time doing the right things. You write a mission statement and choose a set of principles to live by. I wrote the role of a computer scientist when thinking about principles to live by.
When I was writing my evolutionary computing program in Python, I often wondered what would have been different if I had used C++ instead. Execution time would be faster, but development time would be slower. In this post, I’ll compare the performance of the two languages in a program I wrote that simulates 100 million coin flips.
I wrote the first version of the program using Python. Python is a good programming language to use for statistical simulation because it has a built-in random library which implements the Mersenne Twister. I executed this version of the program in both Python 2.7.2 and PyPy 1.7. PyPy is an alternative Python interpreter with improved performance. The Python code can be executed using the different interpreters without modification.
I wrote the second version of the program using C++. C++ has a simple random number generator, rand(), which should not be used for any serious statistical simulation. I used two libraries that implemented the Mersenne Twister. My first C++ version uses the GNU Scientific Library (GSL). I was helped by the GSL documentation and by the GSL example in this post. My second C++ version uses the new random number capabilities in C++11. I was helped by this example of uniform_real_distribution. The C++ code can be executed using the two different libraries by changing a few declarations and function calls.
Here are the results of running the code on my desktop computer:
Version
Time
Python
23.9 s
PyPy
6.3 s
C++ using GSL
1.8 s
C++11
21.7 s
So assuming I’m not using C++11 incorrectly, it seems that it has really poor performance. There is a decent performance boost when using PyPy over native Python interpreter. But GSL does the best of all.
I just received a Samsung Series 7 Chronos NP700Z3A. In short, it is a really nice piece of hardware, though the software is a bit of a pain to work with Ubuntu. I’ll write more about that later.
What I like best so far is the high resolution screen. It is a 14″ 1600×900, which is about 132 pixels per inch (PPI) according to the PPI calculator. This is higher than the typical computer screen, at 90 PPI. However, it is much lower than, for example, the screen resolution of the new iPad, which has about 260 PPI.
It came with Windows 7 Home Premium SP1. I ordered it from the Microsoft Store, so it has Microsoft Signature, which means it isn’t loaded with bloatware or other nonsense. It is quite nice to receive a new machine and not have to de-install a lot of “helpful” software. I did a little price comparison and the Microsoft Store was $50 cheaper, plus it had free shipping, and I received a $200 credit for the store. So overall I feel like it was a good deal.
Of course, the first thing I did when I booted it up is install some useful programs. These include some utility programs:
Mozilla Firefox
Dropbox, to sync my documents from my other machine.
When you upload an image to WordPress, it is stored in its original size on the web server. WordPress allows you to specify an image size. WordPress will create an additional copy of the image at that size and insert that in the page instead.
Here is an example:
Original size: 1858×1233 (652 kB)
Wordpress copy: 1024×679 (336 kB)
This means that when people view your page, they have to download 0.5 times the original file size. This is a smaller file download, and it will help your page load faster.
Point to remember: If you choose a size when you insert an image, it tells WordPress to create a smaller file download. This will help your page load faster.
Resizing images
After inserting an image and viewing the page in a web browser, usually you’ll find that your image is too large. So then you go in the Edit Image window and set a smaller size, e.g. 70%:
This presents a problem: If you use the Edit Image window, WordPress will not automatically resize your image file a second time. It will only display the image smaller. This means that the web browser is still downloading the full size file, but it is just viewing it smaller.
I tried resizing the cabbage image above to 70%. Here is what happened:
WordPress size: 1024×679 (336 kB) — Recall that this is due to our choice of size in the Insert Image box. New size at 70%: 717×475 (336 kB) — But this image could be 186 kB if I resized the actual file.
See the difference? If you resize an image with the Insert Image box, it will actually save space, but if you resize an image with the Edit Image box, it will not actually save space.
Conclusion
Correctly scaling your images before inserting them into a post will solve this problem. If you are going to be inserting a lot of images, use a test image. Insert a single image and use the Edit Image box to find out what size looks right. Then on your computer, resize all your images to this size before inserting them into the post.
Misc notes
Another thing you have to take into account when viewing images is the maximum width of the content in your theme. For example, this blog (bobbyratliff.wordpress.com) uses the Twenty Eleven theme, where the maximum width is 585. Even if I choose the 1024×769 option, the image width is limited to 585. In other words, it will show the cabbage image as 570×377.
Another solution is to add image sizes to the insert image dialog. If you have hosted WordPress, you can use the Additional image sizes plugin to do it.
Google Page Speed is a great tool for troubleshooting slow sites. It has a list of rules that it evaluates your website against. When your page breaks a rule, it will tell you why and give some clues on how to fix it. The information in this post applies to the suggestion “Serve scaled images.”
One of the fun results from my computer graphics class last semester was our computer animation project. The assignment was to model the firing of a cannon, including the cannon recoil and the projectile’s parabolic trajectory. The end goal was to use this model to drive a 3D animation.
I worked with 2 other group members, and in all I spent 54 hours in group meetings and coding individually. The project resulted in about 4000 lines of code in 34 Java files.[1]
Physics modeling
For each frame of our animation, we make slight changes to the position of each object on screen. These small changes are based on simple physics calculations.
For example, for a wheel to roll to the left, it needs to both rotate counter-clockwise and move to the left. The angle of rotation is related to the shift to the left by the following equation:
where is the radius of the wheel.
Firing the projectile gives the projectile some initial velocity. This velocity can be used to compute a change in position for the projectile. The velocity changes over time due to acceleration due to gravity.
2D animation
First, we produced a 2D animation of this model. This involved several steps:
Read in 3 objects : the projectile, and the wheel and the barrel which make up the cannon. These objects can be drawn on-screen in a certain order so the layering appears correct
Move them to their initial position.
For each screen refresh, update the positions of the objects based on the equations.
Initially, the projectile has 0 velocity, so item #3 above really means that nothing will change in each screen refresh. As soon as the user presses the fire key, the projectile is given a fixed amount of velocity (and the wheel is given an amount of recoil velocity).
3D animation
Making the 3D animation was the more challenging part of the project. While the 2D animation was written in about 10 hours, the 3D animation took 44 hours to write, including a 13 hour rabbit trail. I spent about 13 hours working on a version that ended up not working.
The 3D animation extends the work of the 2D animation. Instead of a 2D wheel, barrel, and projectile, we now have 3D objects. These objects are first generated and then stored in .dat files. There are now 6 objects: the ground, 2 wheels, the axle, the barrel, and the projectile.
Based on the source code from our textbook, the 3D objects are put into a scene which can be viewed from different perspectives. We added code to rotate and move individual objects based on the amounts specified by our physics model.
Here is a demonstration:
The video demonstrates two methods of rendering that our 3D cannon animation supports. The first is z-buffering, and the second is hidden line elimination. These two methods are described in my first post about computer graphics class.
[1] This is a raw count, produced by doing wc -l *.java. Not all 4000 lines are original code for this project. Some of this code was first implemented in our textbook, Computer Graphics for Java Programmers, 2nd ed., by Ammeraal and Zhang. There are also 6 Java programs for generating the data files for the various on-screen objects. These Java programs have a lot of code duplication.
Besides my course in evolutionary computing, which I learned a lot from, last semester I took a class in computer graphics. In this class, I learned about different aspects of computer graphics, including modeling and rendering objects to a screen.
I definitely appreciated how computer graphics class built upon knowledge that I had already gained in previous subject areas:
Geometry
Linear algebra
Java programming
Modeling 3D objects
We modeled 3D objects as collections of points in a 3D space. Each object has a number of faces, where a face is a collection of points (a polygon) that make up a face of that object. Each face must be flat. So, for example, a cylinder would be made up of a finite number of long thin faces.
Rendering 3D objects
A simple rendering is to draw a line around the edges of each face in the object. This would be called wire-frame rendering. A slightly more complex rendering is to ensure that lines are hidden if a face falls in front of that line. This is called hidden-line elimination. A cylinder is displayed here as rendered with hidden line elimination:
A more realistic rendering gives a color to each face and fills it in. The face’s color can be shaded according to the direction the face makes with a light source. One simple method of rendering these shaded faces is called z-buffering. Here’s a screenshot of a z-buffer rendering of the same cylinder:
When I meet people, I often end up telling them that I am a college student, and my major is computer science. “So what are you going to do with that?” they ask. “Programming” is my usual answer. There are many possible careers for computer science majors, but in this post I’d like to write about the role of a computer scientist. What is a main, overarching goal to our work?
Frederick P. Brooks gave a speech in 1994 in which he addressed the goal of computer science. The transcript is entitled “The Computer Scientist as Toolsmith II.” In it, he argues that when computer scientists write programs, their primary goal is to satisfy the needs of the user. Users will use our tools to get their job done. In short, we are toolsmiths. Brooks writes, “We make things that do not themselves directly satisfy human needs, but which others use in making things that enrich human living.” In other words, an engineer can use a computer drawing program as a tool to design a bridge. Or a parent will use a social networking program as a tool to communicate with friends.
In making our tools, we should make them well. It goes without saying that the tool should not break when you are trying to use it. The tool should not be too complex or hard to maintain. When we work as toolsmiths, we should do good work.
Merely talking about how we make our tools does not fully address the question. We also need to address this question: What types of tools should we make? To discern this requires some sense of morality. Wolterstorff writes,
There is something deficient about the person who does good work for its own sake without ever asking whether it’s a good thing that this work be done. The estimable craftsman asks two questions concerning the good. He asks whether what he is doing or making for its own sake is a good example of its kind: a good violin, a good arpeggio, and so forth. But he also asks whether doing or making a good example of this kind is a good thing to do. (quoted in Think, by John Piper, page 120)
In other words, we should ask two questions:
Is this a good tool?
Is making a tool of this type a good thing to do?
The second question is a challenging question to ask. It is a question that transcends individual preference. At the very least it requires people to think ahead of possible uses of their tool. I do not wish to analyze every tool that has ever been made and fit it in this grid. I do wish, however, to provide two examples of tools where this question should have been asked.
The first is the recent flu virus that was genetically modified to travel via airborne particles. Basically, a deadly flu virus was made even deadlier. The US government asked the researchers to limit the amount of information is published in academic journals, for fear that the findings would be turned into a flu pandemic. The New York Times has an article on the deadly flu virus. One researcher went so far as to say, “This research should not have been done.” In other words, it was not a good thing to even do this kind of research, even if it was done well.
The second example is the trend of personalization in internet websites. This results in “a bubble” around you that only includes news that you want to hear. For example, search engines change their first page of results depending on who is searching. Facebook internally sorts your friends into who you want to hear from and who you do not. This has been explained at dontbubble.us and in a recent TED talk, “Beware online ‘filter bubbles’.” When a computer filters our results based on what we like, we miss out on things we need to hear. A human newspaper editor can create a balance of different articles on a front page, but a computer filter will only put things that we want to hear. The filtering technology is very good at what it does, but it is not a good tool, as it dulls our thinking and takes away our exposure to ideas we disagree with.
In conclusion, the computer scientist has two roles: to make tools well, and to determine which tools should be made. This requires both technical expertise and a moral compass. It is my desire to see more and more programmers have a moral compass to guide them in their work.
875 lines of code and 55 hours. Evolutionary Computing was one of the most challenging courses I have taken at SCSU. These statistics come from our final project, which was a month-long research project. Our assignment was to build on previous projects and produce a 5-page paper suitable for publication at a conference.
I learned a lot while completing this project. My project studied spanning trees on complete graphs, and how to evolve them using a genetic algorithm. Maybe in a follow-up post I’ll introduce these concepts. For now, I want to show what I learned while writing those 875 lines of Python code.
Write a testing function for non-trivial tests. I was checking something by hand, and thought my program wasn’t working. Then I ended up spending several hours debugging something that was not in fact a bug.
Dropbox is an automated version control. Several times I used it to retrieve an old version of a file that I had not committed. This came in very handy.
In vim, you can do :edit! to reload a file from disk. (documentation here)
Time estimating is important when running your jobs on other people’s machines.
I learned how to profile code using cProfile. On Ubuntu, cProfile can be found in package python-profiler.
Git
In git, you can choose to commit only certain changes in a file. It can be done by using git gui. The GUI basically shows you the output of git diff for the changed files in your repo, and you can right click on a line in the diff and choose “Stage Line For Commit.”
I only used this a few times, but it is a lot better than doing the following:
$ cp dandelion.tex dandelion.tex.bak
$ git checkout -- dandelion.tex
$ #manually copy over the changes that you do want to commit
$ git add dandelion.tex
$ git commit -m "This is the hard way"
LaTeX
When writing tables in LaTeX, you must put the label in the caption in order for it to refer to a specific table number. If you don’t, your ref will only refer to the number of the section. Here is a working code snippet:
The times can be seen in Table ref{wallclock}.
begin{table}
caption{Wall clock times in seconds for a single
run of the genetic algorithm using the PyPy interpreter.
label{wallclock}
}
begin{tabular}{l r}
...
end{tabular}
end{table}
I have often described to people the difference between computer science and information services (IS) majors. Both are offered at St. Cloud State University (SCSU), but they have much different purposes.
Computer science is a technical major, focused on data structures and algorithms. Computer science students take several math classes, as well as some science electives. IS is a business major, and it focuses on computer programming’s usefulness to business. IS majors do not have many math courses to take.
These different majors present different career options.
Computer scientist
First, there is a computer scientist. These workers “are the designers, creators, and inventors of new technology,” in other words, they do research. Most of them have a Ph.D. (In computer science, of course.)
Majoring in computer science at SCSU, I get a taste of some different topics that computer scientists study. For our undergraduate degree, we are required to take 5 upper-level electives. This semester, I am studying evolutionary computing and computer graphics. These classes present material that is fascinating to me, and we only scratch the surface of what a computer scientist would study. (For an example, see a description of evolutionary computing.)
Computer systems analysts
This summer I had an internship at a financial company. The work I did there would fall under the career of computer systems analysts. I would say a computer systems analyst could be anyone with problem solving skills, including both computer science and IS majors.
“Computer systems analysts use IT tools to help enterprises of all sizes achieve their goals. They may design and develop new computer systems by choosing and configuring hardware and software, or they may devise ways to apply existing systems’ resources to additional tasks.”
An example of a project a computer systems analyst would work on is to determine a good tool for doing version control on application software that the company maintains. The programming of the application itself falls to the computer programmers, but the configuration of the version control, as well as the build environment falls to the computer systems analysts.
Computer programmers
Then there are computer programmers. Programmers apply problem solving skills to the creation and improvement of software. Their work can be further divided into systems programming and applications programming. To be a computer programmer, you need sufficient programming experience, and a good way to get this experience is in the computer science or IS major.
Computer programmers can work in many different industries. Some industries are more technical than others. An obvious way to tell the difference is by the interview requirements. One of my fellow interns from the summer wrote this article about his interview experiences.
The financial company I worked for this summer has a very business-focused interview. Jon describes it well: “They want to know that you think logically enough to work things out so they can train you to do things their way.”
Other firms, like developer firms, have more technical interviews. These focus on coding ability. For example, they will have an interactive editing session with you and say, “write a stack.” This allows them to screen applicants who do not have sufficiently deep knowledge of programming.