Friday, December 22, 2006

I am in Las Vegas to see the Vegas Bowl. BYU vs Oregon. The first quarter was ok. Neither team scored. Both made offensive errors. BYU dropped several easy passes, and Beck had some bad passes. After that it was all BYU. Oregon just didn't play well tonight. They finally scored in the 4th quarter on a long TD pass. They really didn't do anything all night.

The highlight was at the beginning when volunteers from Nellis Air Force base rolled out a football field size American Flag. Then the during the National Anthem, 2 air force jets flew over and hit the afterburners right above us. COOL! Definately the highlight of the evening. I want to take my boys next year so they can experience this.

Wednesday, December 13, 2006

My users have been requesting a seemingly simple feature for a while now and I could not get it to work.
 
When they enter a value, they are prompted with a javascript confirm (Ok/Cancel) box if the value is over $1,000,000.  If the choose "OK", no problem.  But when they choose cancel, they wanted to be put back in that same field.  I should just be able to do the following:
 

function checkValue(){

if (document.getElementById('valuation ').value >= 1000000){

if (confirm("This value is over $1,000,000. Are you sure you meant to enter such a large value?")){

}

else {

document.getElementById('valuation').focus();

}

return false;

}

}

I was able to set focus to any field, except the one I just came from.  The only hack I was able to find was to set focus first to another field, then the field I came from and then use the follwing in my <input> statement.  

onFocus="this.select()"

Here is the javascript function I had to use:

function checkValuation(){

if (document.getElementById('valuation').value >= 1000000){

if (confirm("This value is over $1,000,000. Are you sure you meant to enter such a large value?")){

}

else {

document.getElementById('otherfield').focus();

document.getElementById('valuation').focus();

}

return false;

}

}

 
-------------------------------
David Mineer

Tuesday, December 12, 2006

I just found out that I can have the contacts on my cell phone backed up automatically. Not only that, it provides a web interface for adding, updating and deleting the contacts on my phone. I have a verizon phone and you can find out about it at:

http://www.verizonwireless.com/backupassistant

It does const $1.99 a month. But as often as I drop phones in a glass of milk, it is worth it to me.

Several of my users have been complaining that iGoldmine was not working for them. I am not sure when it quit because iGoldmine sometimes doesn't get used for weeks at a time. But I was pretty sure it was working until sometime in November maybe even towards the end of November.

Anyway, I started researching this and came to find out that I could not run the goldmine executable which is on a network share, from the machine running my iGoldmine server. The iGoldmine server is W2K 2003 server and is just a member server of my domain. The error I was getting when trying to run the goldmine executable was:

"windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item."

I decided to try and run some other .exe files on different network drives and sure enough, same error on all of them.

Goldmine tech support is usually awesome, but this time they just pooped out on me and had me so mad I had to go get a Dr Pepper to settle down. They didn't want to help at all.

Turns out the issue was with the Internet Explorer Enhanced Security Configuration. You can get to this in Control Panel-Add/Remove Programs/Windows Components/. After that you can check or uncheck the two options: "For administrator Groups" and "For all other user groups". Both were checked, so I unchecked them and then I was able to access files over the network.

I didn't have the same problem logged in as myself. I was able to run those files, other users, however could not and hence the problem. There must have been a windows update that changed the IE config and hence caused this problem. I would have thought the Goldmine folks would have encountered this already, cause it has probably been a month or so.

Friday, November 03, 2006

I was changing around some javascript on one of my pages and came to a piece where I wanted to access a variable several times. I remembered using a "with" statement when doing some programming Visual Basic for Access. I looked up the with statement and found out that it is not recommended to use.


alert(document.title);
alert(document.body.tagName);
alert(document.location);


Here is the with Statement:


with (document) {
alert(title);
alert(body.tagname);
alert(location);
}



"It is another scope. When you use the with statement, you are forcing the interpreter to not only look up the scope tree for local variables, but you are also forcing it to test each variable against the object specified to see if it's a property" - "Professional Javascript for Web Developers, Nicholas C Zakas, p 581

Monday, October 30, 2006

I have a dynamic region and I wanted blank lines to not show. I have owners listed with companies, but sometimes there isn't an owner name, just the company name. I use the /br/ to go to the next line to get a "Mailing Label" type layout, if there was no owner then there would be a blank line.

The solution would normally be to use a /cfif len(fieldname) = 0/ Since this is a dynamic spry region, that doesn't work. I found the solution in the forums:

spry:if examples

My version of the code is:

-span spry:if="'{FIRSTNAME}' != '';"-

Friday, October 27, 2006

Trying to a seemingly simple thing before going live with the AJAX code I have been working on. I don't want pressing the enter key to submit the form when a field is in a particular field. This turned out to be harder than I thought. But here is the code that does it:

Include the following element into the head part of your document:

/script type="text/javascript"/
function noenter() {
return !(window.event && window.event.keyCode == 13); }
/script/

Add the following attribute into each input type="text" tag(s) in your form:
onkeypress="return noenter()"

The function has to go in the header on the page. It didn't work for me putting it in an included .js file.
Still struggling with the grouping thing. The interim sort-of workaround was to just flatten the whole thing out. Like this.

here is what I want

company1
contact1
contact2
company2
contact3
company3
contact4
contact6
contact7
company4

This is what I have to do for now.

company1 contact1
company1 contact2
company2 contact3
company3 contact4
company3 contact6
company3 contact7
company4

Redundancy and not what I want but it does allow me to go live with the ajax portions of the code and not break the app. We will see what the users think.
Spry and grouping. I have a spry dynamic region that returns a list of companies that my user searches for. Well, each one of these companies can have 1 or more contacts attached to them. Currently, when they search, a popup page is presented with a list of companies that match their search value. As I Output the query, I use a contact object that gets all contacts for that company. (contact.getContact(companyid)). This is easy in Cold Fusion.

In spry however, I cannot figure out how to do it. I can output the list of companies, and I can write an onclick so that when I click on their name, the associated contacts are listed, but I can't list those contacts below the name of the company, I can only create the dynamic region for the contacts outside the company dynamic div.

I am still researching this and hoping to find a workaround. I did notice that there are some posts about grouping the spry forums, but all that is said is that it will be added to the list for future upgrades. This was back in the beginning of August. Maybe there is something available now.

Thursday, October 26, 2006

This was a post I found on the labs forums site at adobe, but I can't find it for the life of me right now. Before the IE caching problem neither firefox or ie were loading the new data after I updated the database and it turned out to be an internal spry caching problem. The following comes for the posting in the forum. The key for me was the useCache:false part that you stick at the end of the Spry.Data.XMLDataSet call.

If you're going to be updating the data set by re-loading the same URL, make sure you turn caching off:



After that, you'll want to define a function callback that will be triggered *after* your server request to update the record:


function UpdateRecordCallback(req)
{
// We just finished updating a record, force myDataSet to
// reload the data from the server so our regions auto update.

myDataSet.loadData();
}


Then use the loadURL() utility function to send your request. You'll have to pass your callback function to loadURL so that it gets called when the request succeeds:

function UpdateMyRecord(recordID)
{
Spry.Utils.loadURL("GET", "closetesrecord.php?id=" + recordID, true, UpdateRecordCallback);
}

...

While I was having the problem with caching, I was also in a not so bad problem. IE was giving me errors when Firefox was not. I was getting two different errors on an href onclick event.

When you call dynamic fields in a spry dynamic region you format them like this: {FIELDNAME}. So I had an href like this:



Firefox had no problem with this. IE, however, was having a problem and I couldn't figure it out. Finally figured out that I had to have single quotes around the spry dynamic vars like this:



That was only needed inside the onclick event, not outside. Small thing and the error didn't seem to effect the functionality, but you hate for users to get the little error each time the page loads. Makes everything seem just not right.
Building an AJAX interface for my data entry app. Was stuck trying to get a dynamic region to refresh. Turns out IE has some caching issues. I found the following page that, if you read the comments gives a pretty thorough explanation of the problem that I was having.

http://ajaxian.com/archives/ajax-ie-caching-issue

Of course I am using cold fusion and the answer was to put the following line at the top of my xml page.



I spent several hours trying different things. I had just upgraded to ie 7 and thought that could have been part of the problem. It was working just great in firefox. Glad it was an easy fix, wish I would have figured it out quicker.

I am using the adobe spry framework for AJAX. It is still in prerelease but I have really enjoyed it as it is my first serious foray into AJAX.