« [News] Election day in Sardinia, Italy—powered by Servoy | Main | [News] FileMaker Pro 8 in the pipeline? »
May 17, 2005
[Challenge] Week 5/16/05: Gotcha!
by David Workman
Data Mosaic, Inc
With all of its simplicity, there are times when Servoy can be a bit of a challenge. Unfortunately, sometimes in our brilliance we devise our own challenges without any help from Servoy. Certain challenges happen frequently enough that I like to call them "gotchas." As in: "I GOTCHA AGAIN you stupid idiot."
Here's where I gratuitously plug a service that I offer called Servoy Help-on-demand. Pay me lots of money and I will tell you how stupid you are in MINUTES as opposed to the hours (or days) it can take for you to figure it out all on your own. Ain't that a deal? Your only consolation at getting humbled by me is that I've made all the same mistakes many more times than you.
With that lead in, for this week's challenge I present to you my top five list of "gotchas" from my own experience and that of helping many other Servoy developers. These are so common that it's automatic for me to check them first when someone has a problem (sort of like checking that the power cable is plugged in when someone can't turn on their computer).
Do you know what the problem is with each of these "gotchas?" If you don't, be prepared to waste time on challenges of your own making!
[P.S. Contribute your own gotchas in the comment section and in the wrap up article we can jointly answer them all.]
Gotcha #1: For loop
var loopTimes = 10;
var someArray = new Array;
for ( var i = 1 ; i = loopTimes ; i++ )
{
someArray[i] = i;
}
Gotcha #2: Logical
var someArray = new Array(1,2,3,4,5,6,7,8,9,10);
if (someArray[0] = 1)
{
var newsFlash = "Gotcha!";
}
else
{
var newsFlash = "Servoy meltdown to commence in 10...9...8....";
}
Gotcha #3: showFormInDialog
var myRecord = forms.method_convert.foundset.getRecord(forms.contacts.controller.getSelectedIndex());
application.showFormInDialog( forms.categories );
globals.name_first = myRecord.name_first;
Gotcha #4: Variable scope
loopTimes = 10;
someArray = new Array;
for ( i = 0 ; i < loopTimes ; i++ )
{
someArray[i] = i;
}
Gotcha #5: Covering all conditions
forms.orders.controller.showRecords(forms.customers.customers_to_orders);
Bonus Gotcha: The most misunderstood Servoy concept
Where does Servoy save all of its solution files?
| Posted by David Workman on May 17, 2005 at 03:13 PM in Challenge | Permalink
TrackBack
TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c8d8153ef00d8347f769c69e2
Listed below are links to weblogs that reference [Challenge] Week 5/16/05: Gotcha!:
Comments
I've been bitten countless times by most if not all. Number two gets me on a daily basis.
But still... isn't it grand to turn on the debugger and have it bring you to the right place. I miss it when i have to go back and support the old FMP stuff.
1. needs < before = before loopTimes
2. = needs to be == (this is my personal fave)
3. not sure but perhaps that code after form opens doesn't run till formcloses.
4. have to put var before someArray
5. check to see if records exist?
6 In the repository
Posted by: Jim C | May 18, 2005 12:32:14 PM