Tuesday, July 8, 2008

Teaching programming: two approaches

Hi!

Just as there are two types of programmers (career and geek programmers), there are two approaches to teaching programming:
  1. The first approach (I call it career teaching) dominates the teaching industry. It concentrates on programming languages, technology, frameworks and development tools. It will teach you the difference between Struts and JSF and how to use them in a Sun Java System Web Server or something like that. It is usually a boring, vendor-specific and narrow-thinking study; it is what most practitioners want and pay for.
  2. The second approach teaches you formal thinking instead of adopting a technology. This approach is often based on problem solving, because as long as you are faced a formal problem, the programming languages and technology do not matter. There is no common framework to find an optimal placement of rooks on a chessboard so that the sum of numbers in squares are minimized.
To be a true engineer, one must go through both types of learning. Although there is a lot of material, books and courses for the career learning, there is only few books that will teach you formal thinking. One of them is the book Information Theory, Inference, and Learning Algorithms by David MacKay, which is available both as hard copy and for download. Another resource is the Book of Programming Problems by me, not as splendid as the former, but its a start!

Honestly, it is not a book at all, and it does not match David MacKay's masterpiece even distantly, but it is rather a collection of programming problems with different level of complexity, all with solutions. You are welcome to propose your problems and discuss solutions (you can leave comments under each problem).

Microsoft Word plotting utility

Hi all!

There is my free function plotting macros for MS Word 2007. Take a look. It is capable of building function graphs and other curves right in the Word document. The plot itself is just a Word object, so that you can move the document from one computer to another, format or change the plot lines, change everything using MS Word tools.

Sunday, November 11, 2007

Recover a lost password from your web browser

If you forgot your web site password, you can restore it from your web browser, provided that the web browser is configured to store passwords, which is normally true. There are plenty of commercial password-recovery-tools out there promising to obtain and decrypt any password from any browser. Before purchasing one, I whant you to know that recovering a web browser password can be done easily and for free. In Mozilla Firefox, simply select Tools -> Options -> Security -> Show passwords.
The following is a brief instruction for browsers which do not show passwords (like IE I suppose). I personally used this approach to recover a password for my online banking service:

  • Install Java Runtime Envioronvent. You can download it here: http://java.sun.com/j2se/downloads.html
  • Download a Burp proxy, which is a free proxy software with an ability to capture and display http(s) traffic: http://www.portswigger.net/suite/download.html
  • Unpack and run the .bat file there. If you have a firewall on your desktop, allow the java application to access the network in the firewall popup window.
  • In Burp, switch the 'intercept on' button on the proxy -> intercept tab.
  • In your web browser, set proxy to localhost, port 8080. In Mozilla Firefox, for example, this setting is available somewhere in Tools -> Settings -> Other -> Network -> Settings. Check the radio box "manual proxy settings" and enter hostname 'localhost' and port '8080' for both HTTP and SSL connecctions.
  • Goto the login page in you browser and log in. The login form should be captured by Burp proxy.
  • In Burp Proxy window you will see the HTTP request list, from which the one marked with 'POST' is most likely the login request itself. Double-click it. You will see the raw HTTP request, starting with word 'POST' and blah-blah-blah. At the end of the request text there should be the login form data, containing your lost password, like the following:
ltmpl=default&ltmplcache=2&continue=http%3A%2F%2Fmail.google.com%2Fmail%3F&service=mail&rm=false&ltmpl=default&...
...hl=ru&GALX=b0&Email=D-----a&Passwd=12345&PersistentCookie=yes&rmShown=1&signIn=%D0%
  • Find the password field there. It should have the name Passwd= or password= or something like that. Whatever follows the '=' up to the '&' is you lost password (in this case, the password in 12345, which is, of course, a faked one :)).
  • Do not forget to restore you proxy settings in your browser :)
Apart of its low cost, the approach has an advantage that it will work with any web browser, as it tries to solve the problem on a network side and does not deal with passwords stored in browsers.