Posts

Showing posts from June, 2008

Off Topic - Iron Man Sucks (*** MAJOR SPOILERS ***)

Iron Man Movie Sucks (Note; there are major spoilers, if you don't want to know intimate details about the movie then don't continue reading) Ok, it doesn't suck, but it is not nearly as good as people say it is. Reviewers are raving over this comic book adaption. The American Idol populous is going nuts; "Iron Man is the best movie ev4r!!!!". I strongly disagree. There are certainly some good CGI moments and scenes of good comic book heroism, but at the end of the day, this is yet another "silly" comic book to movie translation. There are a couple of problems that I had with this film. Simplistic Plot - You can figure out the plot in the first 15-20 minutes. Even from the first 5 minutes I could kind of get an idea on what is going to happen. "Rich guy in the desert with army soldiers? Let me guess...he gets captured.", "Rich guy in the desert is detained and left alone with a bunch of electronics. Let me guess, he is going to

Is Java the new COBOL? Yes. What does that mean, exactly? (Part 1)

Image
"If you want to know the past, look at your present. If you want to know the future, look at your present." -- Gautama Buddha Java is the new COBOL, whaaaat?     If you are software developer that mainly writes applications for the web; even if you aren't a Java/J2EE developer, you have probably heard the new meme circulating the web and blogosphere. "Java is the new COBOL" . Most blogs and technical writers regurgitate that statement and follow-up by saying that EJBs suck, and some companies are considering Ruby on Rails. I didn't really think much of these posts. I get the impression that a lot of these "managers" don't write any Java or COBOL code. They are really not highlighting the seriousness of the problem. COBOL development has remained stagnant for decades. Java may see the same problem in the future. The Pentagon/DOD has a trillion dollar COBOL problem because it is so difficult to change their ancient infrastructure. Anyon

Euler Problem Number 1 in Scheme (Comparison with CL and Java)

I know the Euler project administrators try discourage to users from posting Euler solutions, but I hope there isn't any harm in posting an solution implementation for the first couple of problems. I plan on posting possible solutions in a variety of different programming languages. Here are three implementations in Scheme, Common Lisp and procedural Java. ;; ;; Euler problem, number 1 ;; Environment: mzscheme ;; ;; If we list all the natural numbers below 10 that ;; are multiples of 3 or 5, we get 3, 5, 6 and 9. ;; The sum of these multiples is 23. ;; ;; Find the sum of all the multiples of 3 or 5 below 1000. ;; ;; References: ;; [1] http://schemecookbook.org/Cookbook/TOC ;; ( define ( euler1 n) ( let ((x 0)) ( do ([i 0 (+ i 1)]) [(= i n)] ( if ( or (= 0 (modulo i 5)) (= 0 (modulo i 3))) ( begin (set! x (+ x i))))) x)) ( define ( main ) (display "Running\n" ) (display (euler1 999)) (display "\nDone\n

Simple Code Snippet: simple http client in common lisp (oriented for clisp)

Image
One of my early tasks for every language I have worked with has always been to write a http client. An simple http client will simply send a GET/POST request to a web server and interpret some of the results. Here is some common lisp code to do just that. Once again, this uses more of a "procedural" style of programming as opposed to a real "lispy" one. I suggest investigating drakma from Dr. Weitz; he has a much more robust implementation. [1] And don't worry, I expect Rainer to set me down the right path. References http://www.weitz.de/drakma/ ;; Author: Berlin Brown <berlin dot brown at gmail.com> ;; Date: 6/6/2008 ;; File: httpforum.lisp ;; ;; --------------------------- ;; Short Description: ;; --------------------------- ;; Simple HTTP client for communicating with web forums. ;; ;; Environment: Tested with GNU CLISP 2.44 (2008-02-02) Win32 ;; ;; Full Description: ;; ;; --------------------------- ;; Approaching for posting to the forum: ;; -----

Simple code snippet; with common lisp (sbcl) use html-template to generate html documents

As a compliment to my earlier post. Here is an example using html-template like any other server page like Active Server Pages or Java Server Pages. Pass variables to the template parser and the parser will output a full HTML document. ;; ;; Berlin Brown ;; Simple prototype example; using commmon lisp and html-template, ;; Read an input html document template file and use the ;; template parser to generate a new html document with the ;; populated variables. ;; ;; Filename: test_html_templ.lisp ;; Environment: (SBCL 1.0.14) common lisp with libraries. ;; ;; References: ;; [1] http://www.weitz.de/html-template/ ( require :html-template ) ( defun parse-template () ( let* ((rows ( loop for i below 49 by 7 collect (list :cols ( loop for j from i below (+ i 7) for string = (format nil "~R" j) collect (list :content string

Simple code snippet; with common lisp (sbcl) connect to database and query with CLSQL

;; Author: Berlin Brown ;; Short Description: Database Test - connect to the entity links database ;; and run a query ;; Environment: (SBCL 1.0.14) common lisp with libraries: ;; clsql-mysql, uffi ;; ;; Description: The following snippet contains common lisp code ;; connect to a simple URL database called botlist_development and returns ;; two records from a table called entity_links. ;; ;; References: ;; [1] http://clsql.b9.com/manual/with-database.html ( require :clsql ) ( require :clsql-mysql ) (clsql:locally-enable-sql-reader-syntax) (setf clsql:*default-caching* nil) ;; Data structure to store our links (clsql:def-view-class entity_links () ((main_url :reader main_url :initarg :main_url :type string) (url_title :reader url_title :initarg :url_title :type string) )) ;; Ensure that the references to the entity links table, uses ;; the correct tablename and case. (setf (clsql:view-table (find-class 'entity_links)) '|entity_links|) ( d

Better error reporting with Websphere 404/500 error .jsp page

It is always a pain to detect J2EE errors. Here is a code snippet for a 404/500 type JSP error file to give you a better look at generic errors. // <%@ page import="com.ibm.websphere.servlet.error.ServletErrorReport,java.io.*" %> // <% // Place in a 404/500 JSP error page file. if (pageContext.getAttribute( "ErrorReport" , PageContext .REQUEST_SCOPE) != null) { // Better error reporting in a J2EE/Websphere application. ServletErrorReport errReport = ( ServletErrorReport ) pageContext.getAttribute( "ErrorReport" , PageContext .REQUEST_SCOPE); errReport.printStackTrace(); out.println( "Error Code: " + errReport.getErrorCode()); if (errReport.getRootCause() != null) { StringWriter sw = new StringWriter (); PrintWriter pw = new PrintWriter (sw); if (errReport.getRootCause() instanceof ServletExcept