Friday, October 31, 2008

Republican Principles

I've steered clear of the current political mess, but this is just too good to pass up. I've never heard of salon.com and I came across this in my marumushi news map and it is an excellent read.

Republican Principles, from the GOP website:

I'm a Republican Because...

I BELIEVE the strength of our nation lies with the individual and that each person's dignity, freedom, ability and responsibility must be honored.

I BELIEVE in equal rights, equal justice and equal opportunity for all, regardless of race, creed, sex, age or disability.

I BELIEVE free enterprise and encouraging individual initiative have brought this nation opportunity, economic growth and prosperity.

I BELIEVE government must practice fiscal responsibility and allow individuals to keep more of the money they earn.

I BELIEVE the proper role of government is to provide for the people only those critical functions that cannot be performed by individuals or private organizations, and that the best government is that which governs least.

I BELIEVE the most effective, responsible and responsive government is government closest to the people.

I BELIEVE Americans must retain the principles that have made us strong while developing new and innovative ideas to meet the challenges of changing times.

I BELIEVE Americans value and should preserve our national strength and pride while working to extend peace, freedom and human rights throughout the world.

FINALLY, I believe the Republican Party is the best vehicle for translating these ideals into positive and successful principles of government.


Does the Republican Party really believe that? I think the evidence would point to a resounding "no". And now the funny part...
2008 Republican Principles (Chuck Lasker's perception)

I'm a Republican Because...

I BELIEVE the strength of our nation lies in military might and God's help, as long as we do His Will and make this a Christian nation while supporting Israel until the day Israel is destroyed and Jesus returns.

I BELIEVE that each person's dignity, freedom, ability and responsibility must be honored unless we can encroach on these in the name of safety or other short-term excuse that the idiot populace will accept.

I BELIEVE in special rights and justice for Republican politicians, Christian leaders, the extremely wealthy and lobbyists, regardless of cause as long as the money is right.

I BELIEVE in equal justice and equal opportunity for everyone else, regardless of race, creed, sex, age or disability, unless we're talking about lazy black people, illegal Mexican people, uneducated women, homosexuals, or, if justice and opportunity for disabled people costs businesses money.

I BELIEVE large corporate profits, stock market wealth and protection of monopolies will bring this nation opportunity, economic growth and increased prosperity for the upper one percent of incomes.

I BELIEVE government should talk about fiscal responsibility and allowing individuals to keep more of the money they earn, but should actually borrow and spend recklessly and place the full burden of taxes on those with lower and lower incomes and future generations for short term gain. Any taxes on the rich are socialism.

I BELIEVE the proper role of government is to advance Christian evangelical morals through tax code, control of education, judicial appointments, privatization and the proper Christian philosophies of wealth and warfare.

I BELIEVE the most effective, responsible and responsive government is government run by those who know best, and all means necessary must be used to work against poll access by the lowly, the lazy, the stupid and the poor.

I BELIEVE the Republican Party was founded by America's founding fathers to fight Roe vs. Wade, to protect "Under God" in the Pledge of Allegiance they wrote, to put "Under God" on our money, and to keep the Ten Commandments in our Courtrooms and government buildings.

I BELIEVE that we must never speak to our enemies, unless they're very big enemies with money and cheap labor agreements.

I BELIEVE in free trade with lower nations that provide cheap labor and higher profits and any attempt to induce labor or environmental equality on these nations is liberalism.

I BELIEVE you're either with us or you're with the terrorists. If you do not have the same beliefs we do, you are un-American and worthy of derision, abuse, vandalism, placement on no-fly lists and investigation.

I BELIEVE anyone labeled "liberal" is a socialist, which is actually communist, which is actually Marxist, which means evil.

I BELIEVE abortion must be made illegal, but stopping extramarital and teen sex is more important than reducing abortion rates, so I support abstinence-only education, blocking of access to birth control by teens, and punishing poor people for being lazy by blocking access to health care to those women who want to keep their babies.

I BELIEVE Americans must retain only those principles that we consider important while developing new and innovative ideas for bringing power to a Republican executive branch and reducing the power of the annoying Congress and the activist Courts.

I BELIEVE Americans value and should preserve our national strength and pride while working to extend peace, freedom and human rights to good Americans only, and to create international opportunities throughout the world to develop inexpensive manufacturing for American companies.

FINALLY, I believe the Republican Party is the best vehicle for translating these ideals into positive and successful principles of government, and I believe we must use any means necessary, including lies, smears, voter suppression, federal police, the Secret Service, warrantless spying, even the destruction of lives and reputations, to progress our God-endorsed agenda.


I don't know who Chuck Lasker is and I don't know the political leanings of salon.com. I think this is hysterical. The entire article is quite sobering, though. The Republican Party has shifted its ideals since Reagan started making changes, and now bears little resemblance to the party it was 30 years ago. Bush II's regime is almost diametrically opposite where the party started.

Thursday, October 23, 2008

New feature for my blog: translations

One of the suggestions at the blogging BOF at Lotusphere 2008 was to offer translations of your blog to encourage non-English speakers to read it. It's been on my list but never bothered to invest any time in it.

Ironically, I was reading a blog this evening and was a frustrated that it was only available in French. I looked around the page and noticed a block with language translations. When I clicked it I was surprised to see it was using a Google translator, which I didn't know about. I pulled apart the URL and very quickly had translated my blog into the most common languages spoken by my readers, then added them to a block on the left.

If you can spare a few minutes I'm sure your readers would appreciate it if you did the same thing. :-)

Tuesday, October 21, 2008

How to print full pages of records in Microsoft Access

Recently I was recreating a government form in Access that included some columns with background colors. Each row was a fixed height, and if a page was not completely filled there was a large blank space before the page footer printed. I needed a way to print extra records to fill the empty space. I did some digging and came across some sample reports from ACG Soft that included one for duplicating Detail rows. There wasn’t any documentation or comments in the code so I had to pull it apart and figure it out myself. It turns out it is surprisingly simple.
  1. Count how many records fit on a page. No programming involved in this and it should be a constant value.
  2. Count the number of records you will be printing.
  3. As records are printed compare how many have been printed with how many will fit on a page.
  4. When you run out of records to print, stop Access from advancing to the next record until you reach the number that will fit on a page.
Here is the code I ended up using.

Option Compare Database
Option Explicit

Dim RowCounter As Integer
Dim TotalRows As Integer

Const MAX_ROWS As Byte = 17
Const COLOR_WHITE = &HFFFFFF
Const COLOR_BLACK = &H0

Private Sub Report_Open(Cancel As Integer)
Dim ThisRecordset As DAO.Recordset

'Get the number of rows to be printed
Set ThisRecordset = CurrentDb.OpenRecordset("SELECT COUNT(*) FROM [qFuel Log Summary by State2]")

If Not ThisRecordset.EOF And Not ThisRecordset.BOF Then
TotalRows = ThisRecordset.Fields(0)
End If

Set ThisRecordset = Nothing
End Sub

Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)
'Reset the row counter for each page
RowCounter = 0

'When you hit a new page decrease the total rows to be printed by one page worth
If Report.Page > 1 Then
TotalRows = TotalRows - MAX_ROWS
End If

'Make sure the text is visible
Call SetForegroundColor(COLOR_BLACK)
End Sub

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'This event is called every time a record prints.

'Keep track of the number of rows printed
RowCounter = RowCounter + 1

If RowCounter < TotalRows Then
'There is still more to do
Exit Sub
Else
'Make sure you do not overfill a page
If RowCounter < MAX_ROWS Then
'This keeps Access from advancing to the EOF marker and printing the Page Footer
Me.NextRecord = False
End If
End If

'Since you are not advancing to a blank record you have to hide
' the text so it does not print.
If RowCounter > TotalRows Then
Call SetForegroundColor(COLOR_WHITE)
End If

End Sub

Private Sub SetForegroundColor(Color As Long)
Select Case Color
Case COLOR_BLACK
Me!St.ForeColor = Color
Me!Mileage.ForeColor = Color
Me!Mileage2.ForeColor = Color
Me![Taxable Gallons].ForeColor = Color
Me![Tax Pd Gal].ForeColor = Color
Me![Net Gal].ForeColor = Color
Me![Tax Rate].ForeColor = Color
Me![Tax].ForeColor = Color
Me![Surcharge Rate].ForeColor = Color
Me![Surcharge].ForeColor = Color
Me![Net Tax].ForeColor = Color
Me![NetTax2].ForeColor = Color
Case COLOR_WHITE
'Some of the columns use a colored background so I can't just set
' all the foreground text to white. Also, some of the textboxes
' have a transparent background and others have white, so I can't
' just set all the foreground text the same color as the background.
Me!St.ForeColor = Me!St.BackColor
Me!Mileage.ForeColor = Me!Mileage.BackColor
Me!Mileage2.ForeColor = Me!Mileage2.BackColor
Me![Taxable Gallons].ForeColor = Color
Me![Tax Pd Gal].ForeColor = Me![Tax Pd Gal].BackColor
Me![Net Gal].ForeColor = Color
Me![Tax Rate].ForeColor = Color
Me![Tax].ForeColor = Me![Tax].BackColor
Me![Surcharge Rate].ForeColor = Color
Me![Surcharge].ForeColor = Color
Me![Net Tax].ForeColor = Color
Me![NetTax2].ForeColor = Color
End Select
End Sub

This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.

Tuesday, October 14, 2008

Facebook fail chicken


I've never seen this before (unlike the Fail Whale)

Lotusphere 2009 housing is still good

Last year I ended up in a world of hurt trying to find a room for Lotusphere at the last minute. (Many thanks to Francie Whitlock and Jamie Magee for helping me with that.) This year I decided to be a little more ahead of the curve and went ahead and booked my room at the Dolphin.

Earlier tonight the Swan was waitlisted, and at various times in the last two weeks both the Swan and Dolphin have been waitlisted. You may want to book your room sooner rather than later.

SnTT: Merging web form data with a template PDF

The following was written by my friend Duston Suits. We discussed options and he was kind enough to share his solution and allow me to post it.

The problem


To apply on-line for insurance coverage from my organization, you have to: 1) Fill out the web form, and then 2) print it, sign it and mail it in. The problem is that creating an HTML form that is both useable and (more or less) universally printable is an exercise in futility. As an alternative, we have a PDF form with all the fields defined. If we could take the data from the web form, use it to populate the PDF form, then we can let the Adobe Reader handling printing, giving us a more consistent result with far less effort on our part. Merging a PDF form with an FDF file is a trivial task, the challenge was to get this to happen on a Lotus Domino server in the background.

The solution


The key part of the solution is an open-source (Windows-only) tool called PDFTK. PDFTK is a command-line tool with a number of capabilities, the key one for us was the ability to merge a PDF template file with an FDF data file and save the result in yet a third PDF file. My goal was to run a WebQuerySave agent to gather the data from the web form, write it to an FDF file, execute PDFTK in the background and then return a link to the PDF (or potentially a redirect to the PDF itself) back to the user. The next question was how to write the code to create an FDF file.
My colleague already had code to create an XFDF (FDF using XML) file from a Notes form, but alas, PDFTK couldn’t handle XFDF. Some research found the answer: http://www.tgreer.com/fdfServe.html. FDF files, as it turned out, were simple to create. Here’s the code for the WebQuerySave agent:

Sub Initialize()
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim docid As String

On Error Goto Errorhandler
Set db = s.CurrentDatabase
Set doc = s.DocumentContext
Call doc.save(True,False)
docid = doc.UniversalID
' Create the PDF File
PDFFileName = createFDF(doc)
Now send a link back to the user along with any other HTML you want.
Print {<a href="/} & PDFFileName & {">Click here to open your application</a><br><br>}
End sub


Function createFDF(doc As NotesDocument)
Dim docID As String
Dim fileName As String
Dim fdfFileName As String
Dim pdfFileName As String
Dim tempFDFPath As String
Dim destPDFPath As String
' Directory where we will write the FDF files that are created.
tempFDFPath = {C:\FDF-TEMP}
' Directory where the PDF files will be placed for the end user
destPDFPath = {C:\notes\data\domino\html}
On Error Goto createFDFError
' Use the docID as a file name to make sure it's unique.
docID = doc.UniversalID
hFile = Freefile()
createFDF = docID+ ".pdf"
' Create the full FDF and PDF file names
fdfFileName = tempFDFPath + {\} + docID + ".fdf"
pdfFileName = destPDFPath + {\} + docID + ".pdf"
Open fdfFileName For Output As #hFile
' Write the first part of the FDF file (the same for all of them)
Call writeFDFHeader(hFile)
' Now iterate through all of the fields on the form, find the ones we want and write the name/value to the FDF file.
Forall item In doc.Items
‘ In the case of our form, all the fields that we use in the PDF start with the letter S.
If Left(item.name, 1) = "S" Then
Print #hFile, {<< /T(} + item.name + {) /V(} + item.text + {) >>}
End If
End Forall
' Now write the FDF Trailer information (also the same for all of them.)
Call writeFDFTrailer(hFile)
Close hfile
' And now kick off a process to combine the FDF and the PDF. Of course hard code the paths at
‘ your own peril.
shellstring = {c:\pdf-template\pdftk c:\pdf-template\stdapp.pdf fill_form } + fdfFileName + { output } + pdfFileName
rc = Shell(shellString)
' and return the name of the file to the calling function.
Exit Function
End function

Sub writeFDFHeader(hFile)
Print #hFile, {%FDF-1.2}
Print #hFile, {%âãÏÓ}
Print #hFile, {1 0 obj}
Print #hFile, {<<}
Print #hFile, {/FDF}
Print #hFile, {<<}
Print #hFile, {/F (/formA.pdf)}
Print #hFile, {/ID [ <826851cbc19b7f5fba86369c981fe040> <159c51c6e0b4814ca2552f89ab9a1ed1> ]}
Print #hFile, {/Fields}
Print #hFile, {[}
End Sub

Sub writeFDFTrailer(hFile)
Print #hFile, {]}
Print #hFile, {>>}
Print #hFile, {>>}
Print #hFile, {endobj}
Print #hFile, {trailer}
Print #hFile, {<< /Root 1 0 R >>}
Print #hFile, {%%EOF}
End Sub

This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.

One special note, the WebQuerySave agent must be allowed to perform restricted operations (set on the security tab on the agent properties.) Needless to say error checking is also necessary, your mileage may vary.

Happy forming!

Duston Suits
duston_suits@chip.state.il.us

Monday, October 13, 2008

the reach of the Yellowverse is long

Many of the links here contain videos that automatically start. I'm just warning you so you don't get blown out of your chair after rocking out to Dream Theater, Rush or Dethkl0k.

The closing speaker at Lotusphere 2008 was Alton Brown. Alton is a chef and TV personality best known for his long-running Food Network series Good Eats. He also works on the series Iron Chef America, where contestants battle each other by preparing five dishes based on a secret theme ingredient.

After Alton finished his presentation to us TAOSRI's, he took questions from the audience. The Yellowverse's very own Devin Olson suggested beer as a secret ingredient for Iron Chef. And guess what happened last night?

Bobby Flay vs Daniel Angerer in BATTLE BEER!!

If you want to know who won, check the episode list on Wikipedia. And thanks, Devin, for the suggestion. You never know when some crazy idea might turn into reality.

Monday, October 06, 2008

Vacation Writeup Part 2 - Antigua and Montserrat

It's been forever since I got back from vacation but people are still bugging me so I'll finish my vacation writeup. If you recall from my last installment, we were leaving Anguilla and visiting Montserrat. So what's this Antigua business?

Antigua


The flight from Anguilla to Montserrat included a stopover in Antigua where we would switch planes. We thought there might be trouble when the plane that was to take us from Anguilla to Antigua was late arriving. We paced nervously and asked the gate agent what would happen in Antigua since that was the last flight to Montserrat for the day. She said she had called ahead and they were aware our plane was late and they would hold the plane to Montserrat. When we finally landed in Antigua with 15 minutes before our flight I saw a Carib Air plane with its props spinning, and I had a sinking feeling. I knew that was our plane, and I knew we were going to miss it. Myron was more upbeat and pointed out it was 15 minutes early. No flight in the Caribbean was ever early.

We finally made our way to the customs desk, told them our flight number, and the agent radioed the plane... which had already taken off. We were furious, but this was only the start of a very long and frustrating experience. The customs agent disappeared for nearly 45 minutes and the other agent at the desk very specifically ignored us, even when we asked her direct questions. When the other agent finally reappeared she said the airline would put us up at a hotel for the night and we would take the flight the next morning. We asked to take our luggage with us since 1) we didn't trust them not to steal us blind, 2) we pack our non-essential toiletries (i.e., toothpaste and deodorant) in our checked baggage and 3) we wanted to change clothes.

Three hours later we left the airport without our luggage, which they could not find. It was not on the ground in Antigua and they couldn't find it in Anguilla, either. We were assured it would be located, put on a ferry to St. Martin, and flown to Antigua to catch up with us the next morning. "Fat chance," we thought. They couldn't get our luggage from Anguilla to Antigua when we handed it to them, and now they were supposed to track it down, send it to another island, get it on a plane, and delivered to Antigua? And so we left by cab to our hotel, which was the City View in downtown St. John's. It was a horrible hotel that smelled like mold and cigarettes. The armed guard at the gate to the parking lot and another armed guard in the lobby didn't do much to make us feel safe.

The next day we went to the airport and I was stunned to see our luggage being put on the plane. We boarded the plane (a tiny prop plane with maybe 20 seats) and were rather amused when the pilot refused to start pre-flight checkoff until they got the passenger manifest straightened out. He had 13 people on the plane and only 8 names on the manifest. The flight to Montserrat was uneventful. Myron and I sat in the front seats behind the cockpit and could watch the instrumentation. It was a neat experience.

Montserrat


Our original plan was to spend four days in Montserrat. We were going to land in the evening of Day 1 and spend it getting our bearings, then spend Days 2 and 3 visiting properties and tracking down various people Myron had met online. That got compressed and we hit the ground running a day late. Sun, our gracious hostess at the Bunkum Beach Guest House, picked us up at the airport and took us to a grocery store then on to our villa. We spent a while chatting, then called a realtor and started the house hunting.

We saw a total of ELEVEN houses that day between about 11:00 AM and 5:30 PM, with a break for lunch. It was hectic and dizzying. I ended up taking a picture of the listing that had the property name before we entered just so I could keep the pictures separate. Most of the homes we saw were built in the 1970's through early 90's. The majority were built as vacation homes and the intent was only to be there a few weeks a year. With the volcano becoming active many had not been stayed in for several years, and nearly all were in dire need of repair and updating.

We paused at around 1:30 to have lunch at The Gourmet Garden, and funky shack of a restaurant run by Marete, a Dutch lady who had been on Montserrat for a few decades. Later that day while riding around we came upon Marete walking from her house back to the restaurant, and offered her a ride. Myron commented "We already had friends in Montserrat!"

That first night we had dinner with our realtor and a few of her friends at The Royal Palms. It was a Chinese buffet prepared by the only Chinese restaurant on the island and served by Sri Lankans who had paid for passage to the Bahamas but were thrown overboard off the coast of Montserrat. It was a fun night and the food was surprisingly good. Joining us at dinner were two more Americans, one from Phoenix and the other from Maine. It was interesting to get their take on things and both were extremely nice.

The second day we had three more properties to look at, bringing the total up to fourteen. We visited the first two, then took a break to go back to Bunkum to call Myron's online friends Bill and Tina, a couple from Texas who moved to Montserrat about two years ago with their teenaged daughter. They invited us over and we spent a long time talking to them before we had to go see the last house.

That night we went to Tina's, a popular local restaurant in Brades. Myron tried the ginger wine, which was better than either of us expected. While there a middle aged white woman and an elderly black man sat down for dinner. She was very loud in a New York or New Jersey sort of way, he was barely audible. After we finished dinner and were waiting for our check she called to us to join them. What followed was an extremely uncomfortable experience. We told her where we were looking for properties and she insisted we were stupid. Her friend said we had to follow our dreams, and our dream couldn't be anyone else's. The banshee was just getting wound up and didn't hear a word of this. We finally extricated ourselves and bid her a good evening as congenially as we could, when we actually wanted to kindly request that she sacrifice herself to the volcano.

Our final day in Montserrat we had arranged for a snorkeling trip with Scuba Montserrat. Another guest arrived at Bunkum the night before and we offered to let her tag along. She did, and we had a delightful day. Our snorkeling trip wasn't until noon so we called Bill and Tina, who offered to take us to the top Garibaldi Hill where we could look down into Plymouth and over Fox's Bay. It was spectacular and very interesting to hear Bill talk about what had happened just since they had been there.

The snorkeling trip was fun, but it was overcast and the seas had been rough so visibility wasn't that good. At least the overcast skies kept it from being too hot. We stopped at Rendezvous Bay for lunch and we were all excited to see the tracks from sea turtles, who had come ashore to lay their eggs.

We asked our guides where to go for dinner and they recommended Jumpin' Jack's, a restaurant which was run out of a couple's house (their restaurant was destroyed by the volcano). What we didn't know was we were supposed to call ahead, so when we arrived they were settled in for the evening. They very kindly offered to prepare dinner for us, which consisted of a tasty sauteed wahoo (a type of fish), fried plantains, and pigeon peas and rice. It was all good (if a little underseasoned) and very traditional local fare.

That night there was a tremendous thunderstorm that woke Myron up a few times. The next morning we woke to a thin layer of mud covering everything. The rainwater had run into fissures in the volcano and caused an explosion of ash. The ash continued after the rain finshed so it stuck to everything, leaving ashen mud everywhere. It was interesting to experience this and Myron was like a four year old with a new puppy. I was a little less enthusiastic.

Conclusion


The island vibe was very laid back and friendly, with an undercurrent of mild irritation. Everything takes a while on Montserrat, some things aren't available with any regularity, and the local politicians are corrupt in a way expected for any banana republic. Before we make any decision to move we would definitely spend more time there. And we didn't find any properties that thrilled both of us. Myron had one favorite, I had another, but either would have been a tremendous compromise. It's going to take something truly special to make us give up what we have in Charleston.