jquery dialog height and width

February 10, 2009

Recently I was given the task of adding a modal dialog to certain pages in our application, and I was happy to find that jQuery already had a nice solution. While it worked well and wasn’t too hard to implement, there was no obvious way to change the default height and width. I found where they were set in the CSS, overrode them in my own CSS file that gets loaded last, but still no change.

Then I decided to make the dialog non-modal and make it stick around a little longer, so I could examine the style properties in Firefox. It became apparent that the height and width were getting set in javascript, overriding whatever the CSS told it.

A little more online searching turned up this simple solution: just pass in the _undocumented_ parameters ‘height’ and ‘width’. So the final call to show the dialog looks like this:

$("#busy_submitting").dialog({
modal : true,
width : 450,
height : 150,
draggable : false,
resizable : false,
close : function(){ }
}).show();

Notice that I also passed in an empty function for the close button, to prevent the user from closing it. The main purpose of this particular dialog is to ask the user not to click the “Submit” button more than once, and make it impossible for them to do so anyway. Hope this helps someone.


When google search gets carried away correcting grammar

February 5, 2009

Ok, I just tried this search on Google, and was very annoyed by the results, if not entirely surprised: http://www.google.com/search?hl=en&q=shoulda+merb&btnG=Google+Search&aq=f&oq=

See, I was looking for people talking about using the Shoulda testing framework with merb, a ruby web framework. I was *not* looking for people saying “I should have done that instead.”

Yahoo did a much better job in this instance: http://search.yahoo.com/search?p=shoulda+merb&fr=yfp-t-125&toggle=1&cop=mss&ei=UTF-8


Fed won’t say where the money’s going

December 12, 2008

The Federal Reserve is loaning billions, make that trillions of dollars to our nation’s banks, but it refuses to tell Congress or the public who it’s lending to or what collateral is being offered in return.

This looks like bankers trying to bail out bankers and line their own nests, with no accountability or transparency. And since most people’s eyes glaze over when you start talking about trillions of dollars, there doesn’t seem to be much of a national outcry at this scandal. Maybe because everyone wants to try to stay on good terms with their bank, who knows why, but this thievery is a major part of our current problem, and is only going to make things worse.


US Treasury giveaways

December 3, 2008

Looks like Congress wound up doing little more than enabling the US Treasury to give away money to banks. With no oversight, and no direct action to help U.S. homeowners, there seems to be scant evidence of any goal beyond helping bankers and bank investors.


Using jquery on a prototype based site

November 19, 2008

I’m working on a large rails app that’s used prototype from the beginning, but lately I’ve started wondering how hard it would be to start moving towards jquery. In small steps, because there’s too much existing code to do it easily all at once.

Jquery has clearly thought of this already, and provides an easy way to leave the $() function to prototype. Then you just have to use JQuery() instead of $() to get JQuery’s version of that shortcut function.

The next question, naturally, is what if I want to use a jquery plugin, that internally uses $()? I think I found the answer in Giaco’s comment on this thread:

jQuery(function($){
/* yourcodehere */
})

That runs the function after the document has loaded the DOM, and passes in the $ so it can be used jQuery style. This isn’t’ tested yet (by me), but I wanted to post it here so I don’t lose what looks like a good easy answer.


Why consumers aren’t confident

June 25, 2008

Several news reports lately have reported sinking consumer confidence numbers. What’s less widely reported is why. Here are some refreshingly frank reasons for low consumer confidence, even if they are a bit depressing: http://dissentmag.wordpress.com/2008/06/20/why-the-economy-is-gloomier-than-we-are/.

Disclaimer: the author doesn’t provide much direct footnotes, and I haven’t verified all the stats listed, but I think on the whole he isn’t that far off the mark in reporting that things are getting worse economically for most people, and people are noticing that. So the lower consumer confidence numbers really just show that people can tell things are getting worse for them, overall. Watch out for real declines in spending, when people realize they *can’t* borrow enough to continue their overspending, even if they wanted to.


CSS design resources

June 16, 2008

There was a recent thread on the Rails Studio alumni mailing list where Greg asked for help learning better web user interface design. The response was fantastic set of design resources, mainly books and links, which Greg was kind enough to summarize on this wiki page.

The resources are fantastic. Of course I was already familiar with several of them, but some were new; I’m sure most designers would say the same.


Humana sucks

June 10, 2008

Over the last several months, I’ve gotten the impression that Humana’s policy is something along the lines of “deny first, let them ask questions later.” Inaccurate information about a claim or coverage always seems to work in their favor. And when they do respond to a question or appeal of a claim, they can’t be bothered to include the claim number or anything else that matches their response to the original claim.

So far, I’ve gotten them to pay what they should, but only after a lot of letters and phone calls, and in one case asking my state’s Office of Insurance to find out why something was denied. (Their letter cracked me up; it was along the lines of “rather than explain why they denied your claim, they [Humana] have chosen to approve the claim voluntarily.”)

I recently learned from my doctor’s office that Humana’s web site has some wrong information about my coverage and deductible. Naturally, it would have worked out that I would have had to pay more. This isn’t just a case of some customer service rep getting the information wrong (which they do more often than not), this is electronically published information that’s flat out wrong.

Today I decided to look around and see who else has had problems with Humana. Here are some of the links I found.

The BBB gives Humana a “satisfactory” rating, and says that all complaints it received have been resolved. If you dig deeper on that page into the ways complaints were resolved, you’ll see that in many cases, Humana said it was resolved, but the customer making the complaint disagreed. So I guess everything was resolved to Humana’s satisfaction. I hope this doesn’t have anything to do with the fact that consumers pay the BBB nothing, but businesses pay to be members. Conflict of interest, anyone?

What do the rest of you think of Humana?


Why fault tolerance requires distributed, concurrent software

June 3, 2008

The other day I followed a link to this wonderful five year old email from Joe Armstrong, in which he explains Erlang’s approach to error handling and fault tolerance. Here’s my attempt at a brief summary.

Most developers try to write software that’s bug free, but history tells us we never do. So Joe figures a more reasonable goal is to write software that can recover from bugs and crashes. Coding defensively, trying to avoid or trap error conditions in our code isn’t enough, because our software might manage to lock up the whole computer. Or our program might fail because of a hardware failure that takes down the whole machine. This isn’t an extreme or paranoid assumption, it’s just realistic based on what’s been observed.

So to write software that can recover from both software, OS and hardware crashes, we need at least two computers, so that if the software on one crashes, the other one can deal with it. Now we’re doing distributed computing. This also means that the code that does the main task and the error recovery code have to be decoupled, since they’re going to run on different machines. And of course they’ll have to be in separate processes. Now we’re also writing concurrent software, where the processes are loosely coupled.

A lot has been said lately about concurrency being necessary to take advantage of multicore computers, especially as hardware makers keep adding more and more CPU cores. We also need to remember that it’s also just a basic baseline requirement if we want our software to survive crashes. That’s why Erlang was written this way long before multicore computers came along, and why it does this so well.


How Microsoft avoids financial risk

May 29, 2008

Steve Ballmer and Bill Gates divulged in a recent interview a key part of how Microsft has avoided financial risk over the years:

“Income always stayed ahead of hiring,” said Gates “I never had to say to Steve you have to stop.” Gates added, “we are one of the few companies to this day that keeps enough cash on hand to pay payroll if we didn’t get paid for a year.”

Ballmer added: “We take all our risks technologically; why take a lick of financial risk?”

Just how big is its cash cushion? “Microsoft had $21 billion in cash and short-term investments as of Dec. 31 — significantly less than in the past, after a series of share buybacks and other moves that have reduced its cash holdings.” (http://seattlepi.nwsource.com/business/350005_msft05.html) Indeed, I remember reading a while ago that it used to have well over $30 billion in cash.

It seems obvious enough, but it’s a lesson that a lot of individuals and companies alike could learn from. Having a good sized cash cushion avoids the risk of not being able to make payroll, or some other planned expense. It avoids the risk of being forced to borrow when an unexpected expense comes up. And it also allows a person or business to take advantage of opportunities when they come up unexpectedly, also without the expense and possible uncertainty of borrowing.

It’s a strategy that’s clearly worked well for Microsoft.