TexasSwede
texasswede@gmail.com
  • About this blog
  • My Website
  • My Resume
  • XML Export Tool
  • Photos

Monthly Archives: April 2013

My recipes – All in one place

Posted on April 29, 2013 by Karl-Henry Martinsson Posted in Baking, Cooking, Food 2 Comments

For many years, I have enjoyed cooking and baking. One reason could be because I like good food. But it is also logical, similar to programming. You have instructions you follow, but you can still modify them, as long as you know how different ingredients react with each other and with heat, liquids, etc. Cooking is a combination of programming, chemistry and physics. Perfect for a geek!

I often get questions about how I made a particular dish. Many of the recipes have been published on my blog, but I thought it would be easier if I simply collected them all in one place on my website. I have tried to convert all measurements to US imperial, most of them are originally using the metric system.

I plan to add more dishes here soon, so keep checking back!

 

 

Useful utility to rename files in bulk

Posted on April 23, 2013 by Karl-Henry Martinsson Posted in Software, Utilities 2 Comments

Earlier today I had to rename about 400 image files, and I was looking for a convenient tool that would help me out. I had to remove part of the filename, in the middle of the filename, which was a bit tricky.

I found a very useful tool, called Bulk Rename Utility. It does not have the most user-friendly interface, but it is very powerful. And the best thing is that it is free. You can download it here.

This is teh somewhat messy but very powerful user interface...

This is the somewhat messy but very powerful user interface…

The Enemy’s Gate is Down

Posted on April 16, 2013 by Karl-Henry Martinsson Posted in Movies 2 Comments

Enders Game - Teaser Poster

Here you can see the teaser poster for the upcoming movie adaptation of Orson Scott Card’s book Ender’s Game. Click on the image for full resolution version.

I really enjoyed the book (as well as the parallel story in Ender’s Shadow), and hope the movie will stay at least somewhat close to the story in the books. According to the author, the movie will use elements from both books.

If you haven’t read the books, I can highly recommend them.

How to set doctype on Notes forms

Posted on April 11, 2013 by Karl-Henry Martinsson Posted in Frameworks, IBM/Lotus, Notes/Domino, Web Development 2 Comments

When redesigning my website to use Bootstrap, I ran into a problem. The navbar (meny) did not render correctly in Internet Explorer 9, despite looking perfect in Firefox and Internet Explorer 10. There are several discussions about this problem on StackOverflow and other forums, and the solution is simply to add <!DOCTYPE HTML> on the first line of the HTML code.

However, IBM Domino automatically adds a different doctype string, and there is no database or form property to change/set the correct value. But there is actually a way, and it is not very complicated.

Simply create a computed for display field called $$HTMLFrontMatter. Make it hidden from web browsers, and in it you enter a formula that will give you the desired doctype. I simply put “<!DOCTYPE HTML>” in there, and it worked perfectly. Also make sure “Use Javascript when generating pages” is turned off.

This way to modify the HTML generated is documented in the online help. It was added in Domino 8.

New LEGO Lord of The Rings sets this summer

Posted on April 5, 2013 by Karl-Henry Martinsson Posted in LEGO Leave a comment

As the regular reader of this blog may have noticed, I am a huge Lord of the Rings fan, and I also enjoy building LEGO. There are four new LEGO sets in the Lord of The Rings series to be released this summer (in June, according to TheBrickBlogger.com). They are:

79005 – The Wizard Battle, 113 pieces, $12.99
79006 – The Council of Elrond, 243 pieces, $29.99
79007 – Battle at the Black Gate , 656 pieces, $59.99
79008 – Pirate Ship Ambush, 756 pieces, $99.99

Pictures below from TheBrickBlogger.com. Go there for more pictures and info.
There are also a large number of pictures from the 2013 New York Toy Fair at figures.com.

79007 – LEGO Lord of the Rings: Battle at the Black Gate

 

79006 – LEGO Lord of the Rings: The Council of Elrond

Export Notes view to Excel – with multi-value fields

Posted on April 5, 2013 by Karl-Henry Martinsson Posted in Lotusscript, Notes/Domino, Programming 36 Comments

A few days ago, a question was asked on StackOverflow about how to export the content of a Notes view to Excel. The caveat was that some columns contained multiple values, but not on all documents.

To solve this, I wrote a Lotusscript class that will export view data as either CSV or as an HTML table, both can then be saved to a file and opened in Excel. I am posting the code below. Enjoy!

 

%REM
    Agent View Export
    Created Mar 27, 2013 by Karl-Henry Martinsson
    Description: Code to export a specified view as CSV.
    Copyright (c) 2013 by Karl-Henry Martinsson
    This code is distributed under the terms of 
    the Apache Licence Version 2. 
    See http://www.apache.org/licenses/LICENSE-2.0.txt
%END REM

Option Public
Option Declare

Class RowData
    Public column List As String

    Public Sub New()
    End Sub

    Public Sub SetColumnHeader(view As NotesView)
        Dim viewcolumn As NotesViewColumn
        Dim cnt As Integer
        ForAll vc In view.Columns
            Set viewcolumn = vc
            column(CStr(cnt)) = viewcolumn.Title 
            cnt = cnt + 1
        End Forall  
    End Sub

    Public Sub SetColumnValues(values As Variant)
        Dim cnt As Integer
        Dim tmp As String 
        ForAll v In values
            If IsArray(v) Then
                ForAll c In v
                    tmp = tmp + c + Chr$(13)
                End ForAll
                column(CStr(cnt)) = Left$(tmp,Len(tmp)-1)
            Else
                column(CStr(cnt)) = v 
            End If
            cnt = cnt + 1
        End ForAll          
    End Sub
End Class

Class CSVData
    Private row List As RowData
    Private rowcnt As Long

    %REM
        Function New
        Description: Open the view and read view data 
        into a list of RowData objects.
    %END REM    
    Public Sub New(server As String, database As String, viewname As String)
        Dim db As NotesDatabase
        Dim view As NotesView
        Dim col As NotesViewEntryCollection
        Dim entry As NotesViewEntry
        Dim colcnt As Integer

        Set db = New NotesDatabase(server, database)
        If db Is Nothing Then
            MsgBox "Could not open " + database + " on " + server,16,"Error" 
            Exit Sub
        End If
        Set view = db.GetView(viewname)
        If view Is Nothing Then
            MsgBox "Could not access view " + viewname + ".",16,"Error" 
            Exit Sub
        End If
        Set col = view.AllEntries()
        rowcnt = 0
        Set entry = col.GetFirstEntry()
        Set row("Header") = New RowData()
        Call row("Header").SetColumnHeader(view)
        Do Until entry Is Nothing
            rowcnt = rowcnt + 1
            Set row(CStr(rowcnt)) = New RowData()
            Call row(CStr(rowcnt)).SetColumnValues(entry.ColumnValues)
            Set entry = col.GetNextEntry(entry) 
        Loop
    End Sub

    %REM
        Function CSVArray
        Description: Returns a string array of CSV data by row
    %END REM
    Public Function CSVArray() As Variant
        Dim rowarray() As String 
        Dim textrow As String
        Dim cnt As Long
        ReDim rowarray(rowcnt) As String

        ForAll r In row
            textrow = ""
            ForAll h In r.column 
                textrow = textrow + |"| + Replace(h,Chr$(13),"\n") + |",|
            End ForAll
            rowarray(cnt) = Left$(textrow,Len(textrow)-1)
            cnt = cnt + 1
        End ForAll  
        CSVArray = rowarray
    End Function

    %REM
        Function HTMLArray
        Description: Returns a string array of HTML data by row
    %END REM
Public Function HTMLArray() As Variant
        Dim rowarray() As String 
        Dim textrow As String
        Dim cnt As Long
        ReDim rowarray(rowcnt) As String

        ForAll r In row
            textrow = ""
            ForAll h In r.column 
                textrow = textrow + |<td>| + Replace(h,Chr$(13),"<br>") + |</td>|
            End ForAll
            rowarray(cnt) = "<tr>" + textrow + "</tr>"
            cnt = cnt + 1
        End ForAll  
        HTMLArray = rowarray
    End Function

End Class

Here is an example of how to use the class:

Sub Initialize
    Dim csv As CSVData
    Dim outfile As String

    Set csv = New CSVData("DominoServer/YourDomain", "names.nsf", "People\By Last Name")
    '*** Create CSV file from view
    outfile = "c:\ExcelExportTest.csv"
    Open outfile For Output As #1
    ForAll row In csv.CSVArray()
        Print #1, row
    End ForAll
    Close #1
    '*** Create HTML table and save as .xls to open in Excel
    outfile = "c:\ExcelExportTest.xls"
    Open outfile For Output As #2
    Print #2, "<table>"
    ForAll row In csv.HTMLArray()
        Print #2, row
    End ForAll
    Print #2, "</table>"
    Close #2
End Sub

Should everyone be a programmer?

Posted on April 2, 2013 by Karl-Henry Martinsson Posted in Generic, Programming 5 Comments

For years, there has been a debate if anyone can (or should) learn programming or not. While reading the Notes and Javascript groups on LinkedIn, as well as the Notes forums on IBM developerWorks, I have read more than one post where someone wants to learn Javascript or Notes programming, but don’t have any programming experience/knowledge.

Can anyone learn to program? No. I would say half the population could learn at least the basics and mechanics of programming.  So should everyone of those learn to program? In my opinion, absolutely no. Remember, it is widely considered that it takes about 10 years or 10,000 hours to be good at skills like  programming or playing an instrument. A majority will not invest that time in practicing unless they really have the passion.

I think you also need to have a special mindset to become a good programmer. If you learn to program just because you think it is a good career, or something that will pay you a decent salary, but you don’t have the deep interest or the right aptitude, then you will most probably not be a good programmer.

I’m still wondering: why do people who can’t write a simple program even entertain the idea they can get jobs as working programmers? Clearly, some of them must be succeeding. Which means our industry-wide interviewing standards for programmers are woefully inadequate, and that’s a disgrace. It’s degrading to every working programmer.

At least bad programmers can be educated; non-programming programmers are not only hopeless but also cheapen the careers of everyone around them.

Jeff Atwood, Coding Horror

 

Passion

A sign of a good or great programmer is passion. You must be really interested in it to be good at it. Anyone can learn to drive a car, but you need passion and dedication to become a Nascar or F1 driver. This is what drove me to spend hours every day after school in the computer room, until the school closed for the night and I was kicked out. I did not have a computer at home, so this (together with the breaks between classes) was my only chance to practice programming. I wanted to learn, to be good at it, to get the computer to do what I wanted it to do. I wanted to find a problem and solve it, and then find a better way to solve the same problem, until I was satisfied I had the best solution I was able to create.

 

Problem Solving Skills

When you are a programmer, no matter what level, you need to be able to solve problems. If you are a junior programmer, you might get a task assigned to you by a more senior developer, but you still need to break down that task into smaller parts and solve the problem.

After a fair bit of trial and error I’ve discovered that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.

So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call “FizzBuzz Questions” named after a game children often play (or are made to play) in schools in the UK. An example of a Fizz-Buzz question is the following:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes. Want to know something scary? The majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

Imran Ghory, Imran on Tech

 

Logical and Abstract Thinking

This skill goes hand-in-hand with problem solving. You must be able to think though a problem and look at the logic behind it. What tasks/steps are being done in what order? What holes are there in the process? Where could things go wrong? You must be able to anticipate where errors might happen and put in preventive code for that.

 

Technical Knowledge and Interest

You need to understand the platform you are working with. For Notes and Domino this means understanding about views, forms, documents, as well as the Domino Object Model. For Javascript it means understanding the browser Document Object Model.

You also need to understand the limitations of the platform, and how code is handled internally. A typical example is how new Notes developers still often use GetNthDocument(), because they don’t understand how it works. In most cases, GetFirstDocument/GetNextDocument() is the preferred way to loop through a collection. Yes, there are some cases where GetNthDocument() can be used without any degradation in performance (I believe in a ordered collection, i.e. the result of FTSearch), but to avoid confusion, I alway recommend new Notes programmers to avoid using that specific function altogether.

But you also need to know about related technologies. If you only know Lotusscript or Formula language, you will have a much harder way to integrate with other systems. In the case of Notes, you need to know about XML, COM, HTML, CSS, Javascript and JSON, and understand what Ajax and REST are and how to use them. Knowing — or at least understanding — Java is also a plus. For Javascript, you need to know HTML and CSS well, in addition to the browser DOM. Each language and platform has its own set of skills you need to have some knowledge about.

Finally you need some basic match skills, as well as knowing your language. If you don’t know about the Modulo operator (available in all programming languages I know), you will struggle with your Fizz-Buzz code…

 

Aptitude

This is really a combination of everything listed above. Either you have it, or you don’t. You can’t teach aptitude.

Despite the enormous changes which have taken place since electronic computing was invented in the 1950s, some things remain stubbornly the same. In particular, most people can’t learn to program: between 30% and 60% of every university computer science department’s intake fail the first programming course. Experienced teachers are weary but never oblivious of this fact; brighteyed beginners who believe that the old ones must have been doing it wrong learn the truth from bitter experience; and so it has been for almost two generations, ever since the subject began in the 1960s.

Saeed Dehnadi and Richard Bornat, School of Computing, Middlesex University

 

So if you don’t have passion and aptitude for programming, perhaps you should consider some other type of work? The world don’t need more programmers who can’t program. But we need to find the ones that have the aptitude and passion and help them become better programmers, or at least give them the chance to learn.

Luxor ABC 80 computer

The year I started 7th grade, a computer club was founded in my school. I had never programmed before, but I liked technology and had a cousin who worked as an engineer at Hewlett-Packard in Sweden, so I joined the club from the beginning.
In order to get an access card to the computer room, we had to take a couple of evening classes in Basic programming and general computer knowledge. While I was waiting for the classes to begin, I went to the library and borrowed a book on programming, read it and wrote programs in a notebook, just to understand the principle. When the classes started, I already had a good idea about how it worked, and soon I was spending all my free time after school in the computer room.

Atlas – My graduation project in High School

Over the next 6 years, I spent probably an average of 3 hours per day writing code, understanding how the computers worked, testing and learning different programs, and exchanging ideas with other and older students. I even choose programming (combined with geography, another favorite subject of mine) to be the subject of my graduation project. Together with my best friend, we calculated that we spent about 800 hours on the project. It even involved me writing a graphics program first, to allow us to draw the maps to use in the program…

We need to give the students of today, starting already in Middle School, the opportunity to learn programming. They need teachers with real work experience as programmers, not just theoretic experince. I know that for example Bruce Elgort (well known in the Lotus/IBM community) is teaching programming at Clark College in Vancouver, WA. But I think we need to find the students with aptitude for programming much earlier and help them become successful.

Perhaps with better education in the US, there would be less of a need to import foreign workers on H-1B visa. Or at least the companies would have a harder case to argue for importing less costly workers from India and China if there were enough good programmers already living in the United States to hire.

 

HCL Ambassador 2020

HCL Ambassador 2020

IBM Champion 2014-2020

Stack Exchange

profile for Karl-Henry Martinsson on Stack Exchange, a network of free, community-driven Q&A sites

Notes/Domino Links

  • Planet Lotus Planet Lotus
  • IBM dW Forums IBM dW Forums
  • StackOverflow StackOverflow

Recent Posts

  • Notes and Domino v12 is here!
  • NTF Needs Your Help
  • Helpful Tools – Ytria EZ Suite (part 2)
  • Busy, busy – But wait: There is help!
  • Semantic UI – An alternative to Bootstrap?

Recent Comments

  • Lotus Script Multi-thread Message Box [SOLVED] – Wanted Solution on ProgressBar class for Lotusscript
  • Viet Nguyen on Keep up with COVID-19 though Domino!
  • Viet Nguyen on Keep up with COVID-19 though Domino!
  • Mark Sullivan on Looking for a HP calculator? Look no further!
  • Lynn He on About This Blog

My Pages

  • How to write better code in Notes

Archives

  • June 2021 (1)
  • April 2021 (2)
  • March 2021 (1)
  • August 2020 (3)
  • July 2020 (2)
  • April 2020 (2)
  • March 2020 (1)
  • December 2019 (2)
  • September 2019 (1)
  • August 2019 (2)
  • July 2019 (2)
  • June 2019 (3)
  • April 2019 (2)
  • December 2018 (1)
  • November 2018 (1)
  • October 2018 (5)
  • August 2018 (2)
  • July 2018 (3)
  • June 2018 (2)
  • May 2018 (1)
  • April 2018 (2)
  • March 2018 (1)
  • February 2018 (2)
  • January 2018 (4)
  • December 2017 (3)
  • November 2017 (2)
  • October 2017 (2)
  • September 2017 (1)
  • August 2017 (2)
  • July 2017 (6)
  • May 2017 (4)
  • February 2017 (1)
  • January 2017 (2)
  • December 2016 (2)
  • October 2016 (3)
  • September 2016 (4)
  • August 2016 (1)
  • July 2016 (2)
  • June 2016 (2)
  • May 2016 (3)
  • April 2016 (1)
  • March 2016 (4)
  • February 2016 (2)
  • January 2016 (4)
  • December 2015 (3)
  • November 2015 (2)
  • October 2015 (1)
  • September 2015 (2)
  • August 2015 (1)
  • July 2015 (5)
  • June 2015 (2)
  • April 2015 (2)
  • March 2015 (3)
  • February 2015 (2)
  • January 2015 (10)
  • December 2014 (1)
  • November 2014 (3)
  • October 2014 (3)
  • September 2014 (13)
  • August 2014 (6)
  • July 2014 (5)
  • May 2014 (3)
  • March 2014 (2)
  • January 2014 (10)
  • December 2013 (5)
  • November 2013 (2)
  • October 2013 (5)
  • September 2013 (4)
  • August 2013 (7)
  • July 2013 (3)
  • June 2013 (1)
  • May 2013 (4)
  • April 2013 (7)
  • March 2013 (8)
  • February 2013 (9)
  • January 2013 (5)
  • December 2012 (7)
  • November 2012 (13)
  • October 2012 (10)
  • September 2012 (2)
  • August 2012 (1)
  • July 2012 (1)
  • June 2012 (3)
  • May 2012 (11)
  • April 2012 (3)
  • March 2012 (2)
  • February 2012 (5)
  • January 2012 (14)
  • December 2011 (4)
  • November 2011 (7)
  • October 2011 (8)
  • August 2011 (4)
  • July 2011 (1)
  • June 2011 (2)
  • May 2011 (4)
  • April 2011 (4)
  • March 2011 (7)
  • February 2011 (5)
  • January 2011 (17)
  • December 2010 (9)
  • November 2010 (21)
  • October 2010 (4)
  • September 2010 (2)
  • July 2010 (3)
  • June 2010 (2)
  • May 2010 (3)
  • April 2010 (8)
  • March 2010 (3)
  • January 2010 (5)
  • November 2009 (4)
  • October 2009 (7)
  • September 2009 (1)
  • August 2009 (7)
  • July 2009 (1)
  • June 2009 (4)
  • May 2009 (1)
  • April 2009 (1)
  • February 2009 (1)
  • January 2009 (3)
  • December 2008 (1)
  • November 2008 (1)
  • October 2008 (7)
  • September 2008 (7)
  • August 2008 (6)
  • July 2008 (5)
  • June 2008 (2)
  • May 2008 (5)
  • April 2008 (4)
  • March 2008 (11)
  • February 2008 (10)
  • January 2008 (8)

Categories

  • AppDev (9)
  • Blogging (11)
    • WordPress (5)
  • Design (5)
    • Graphics (1)
    • UI/UX (2)
  • Featured (5)
  • Financial (2)
  • Food (5)
    • Baking (3)
    • Cooking (3)
  • Generic (11)
  • History (5)
  • Hobbies (10)
    • LEGO (4)
    • Photography (4)
  • Humor (1)
  • IBM/Lotus (175)
    • #Domino2025 (14)
    • #DominoForever (8)
    • #IBMChampion (46)
    • Administration (7)
    • Cloud (7)
    • CollabSphere (8)
    • Community (47)
    • Connect (33)
    • ConnectED (12)
    • Connections (3)
    • HCL (12)
    • HCL Master (1)
    • IBM Think (1)
    • Lotusphere (46)
    • MWLUG (25)
    • Notes/Domino (97)
      • Domino 11 (7)
    • Sametime (8)
    • Verse (14)
    • Volt (2)
    • Watson (6)
  • Life (8)
  • Microsoft (7)
    • .NET (2)
    • C# (1)
    • Visual Studio (1)
  • Movies (3)
  • Old Blog Post (259)
  • Personal (23)
  • Programming (83)
    • App Modernization (11)
    • Formula (4)
    • Lotusscript (46)
    • NetSuite (4)
      • SuiteScript (3)
    • node.js (4)
    • XPages (4)
  • Reviews (9)
  • Sci-Fi (4)
  • Software (24)
    • Flight Simulator (2)
    • Games (4)
    • Open Source (2)
    • Utilities (6)
  • Technology (37)
    • Aviation (3)
    • Calculators (2)
    • Computers (6)
    • Gadgets (7)
    • Mobile Phones (7)
    • Science (3)
    • Tablets (2)
  • Travel (6)
    • Texas (2)
    • United States (1)
  • Uncategorized (15)
  • Web Development (50)
    • Frameworks (23)
      • Bootstrap (14)
    • HTML/CSS (12)
    • Javascript (32)
      • jQuery (23)

Administration

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Tracking

Creeper
MediaCreeper
  • Family Pictures
© TexasSwede 2008-2014