Is there a way to test for the first calling of a function?

Hi,
I created a function (using other functions I created) to
build a dynamic hierarchy tree menu based on parentID and itemID
etc etc - I'm sure you're familiar with this concept. It works
great, and there's no problem there.
However, I do this all by building it into a string, then
dumping it on the page. Yet again, this all works fine. However,
because the function gets called recursively, my class,
class="tree" gets repeat accross every occurance of the opening UL
tag.
I only want this class to be applied to the first UL, but
because this is recursive, I'm not sure of a way to detect if the
function is being called for the first time or 5th time, etc. I
want to say something like:
<cfif myFunction is being called the first time>
add the class
<cfelse>
don't add the class
</cfif>
Please see my code attached. It is fully working. Please
don't worry about what all the other functions do etc, they are
working fine, but I need a way or variable to test against.
Any ideas?
Many thanks,
Michael.

> a dynamic
> hierarchy tree menu based on parentID and itemID etc etc
Is it too late to revise the way you are implementing your
hierarchy? This
approach is very resource intensive (because you need all
that recursion),
and very slow for most operations.
When dealing with hierarchies, I use the nested set model
http://en.wikipedia.org/wiki/Nested_set_model).
Can I recommend you have
a look, if you have the chance?
The code is more complicated, but it is really very quick for
fetches.
It's slightly slower for create/update/delete operations, but
for web
sites, the vast majority of operations are reads.
Adam

Similar Messages

  • Is there a way to test for network connectivity (and a way to simulate it)

    Is there a way to test for network connectivity, which API to look into? Also, is there a way to test that code in the simulator, that is, to turn off the network in the simulator.
    Thanks

    A peek in the docs would help- there is a TON of information there.
    You might also try the Reachability sample app for ideas:
    http://developer.apple.com/iphone/library/samplecode/Reachability/index.html

  • Running 10.6.8. Trying to open and view contents of a CD (of an MRI) and getting message 'This program cannot be run in DOS mode' Is there a way? Thanks for the help.

    Running 10.6.8. Trying to open and view contents of a CD (of an MRI) and getting message 'This program cannot be run in DOS mode' Is there a way? Thanks for the help.

    Go to the support site for the provider of the MRI software.
    Sounds like it windows/PC. I have ran across that for the CDs that veterinarians provide for digital x-rays.
    I would try on a PC or on yuur Mac with Windows via BootCamp or a virtual machine like VirtualBox

  • I have a 27" IMac.  I want to add additional monitors to it.  There is a vga slot for the first monitor.  I would like to add a second monitor but there is not another via slot.  Is there an adapter I can get for via to usb?

    I have a 27" IMac.  I want to add additional monitors to it.  There is a vga slot for the first monitor.  I would like to add a second monitor but there is not another vga slot.  Is there an adapter I can get for vga to usb?

    Here's the problem I am trying to research for you...
    There does exist a way to add a second monitor via USB:
    USB 2.0 to HDMI Audio Video 1080P Adapter for Windows and Macbook
    It's the only device I know of that can do that.  The problem is that it wants a HDMI connection.  So that means a HDMI-to-VGA adapter or converter needs to be found (not VGA-to-HDMI, those are easier to find).
    Interesting article realted to this:
    Hdmi to vga adapter
    Maybe somthing like this converter will work. 

  • Skype Windows client hangs for the first call - co...

    Hi,
    Skype on my Windows 8.1 (depending on its mood) hangs for the first call. It will keep ringing and ringing till it times out, during that time I am not able to hang up the call as well, the red hang up button doesnt work and we have to let the call go on till it drops on its own. Then on the second try it connects perfectly fine. This happens most of the times, there are only a few days where it connects on the first try otherwise its always the 2nd time. 
    Please let me know what could be the possible solution for this one?
    Thanks

    Hi Marcin,
    This forum is mainly for talk about the product use related issue and not the best place to talk about the develop issue, for the develop issue we can post in MSDN forum for
    the further help and your issue may need capture a dump then for the further analysis it is not an efficient way to work in this community since we may need more resources which is not appropriate to handle in the community. I‘d like to suggest that you submit
    a service request to MS Professional tech support service so that a dedicated Support Professional can further assist with this request.
    MSDN forum
    https://social.msdn.microsoft.com/Forums/en-US/home
    Please visit the below link to see the various paid support options that are available to better meet your needs.
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
    Thanks for your understanding and support.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • CoCreateInstance returns 0x8007007e (Module could not be found) for the first call only at system startup on Windows 2008 Enterprise SP2

    Hi Guys,
    I'm experiencing a problem with CoCreateInstance, where it returns error 0x8007007e.
    The code is something like this:
    HRESULT hRes = S_OK;
    CComPtr<IMyInterface> spObj;
    if(FAILED(CoInitialize(NULL))) { /* quit */ }while(FAILED(hRes = spObj.CoCreateInstance(CLDIS_MyClass, NULL, CLSCTX_LOCAL_SERVER)))
    // LogFailure(hRes);
    Sleep(10);
    The problems occurs only on a single machine having Windows 2008 Enterprise SP2 installed (it works fine on other machines / OS versions). It happens only during the system startup (this is a Windows Service) and only for the first call of the CoCreateInstance.
    The second call always succeeds.
    The problem does not occurr when starting the service manually from Services.
    I did some investigation using Process Monitor and found that the HKCR\CLSID\[CLSID of MyClass]\LocalServer32!LocalServer32 registry value is accessed before the failure. The registry value exists - it is added by the Windows Installer during
    installation.
    If I remove the registry value then the CoCreateInstance always succeeds.
    I've been trying to lookup for some documentation on HKCR\CLSID\...\LocalServer32!LocalServer32 but haven't found anything useful other than it's a "Windows Installer Entrypoint". I assume that the Windows Installer does some integrity checks when
    calling CoCreateInstance for such class and this fails for some reason but currently I fail to find the reason.
    Can anyone help finding out what's the root cause of the 0x8007007e error here, please? Any help or tip is much appreciated.
    Many thanks!
    Marcin.

    Hi Marcin,
    This forum is mainly for talk about the product use related issue and not the best place to talk about the develop issue, for the develop issue we can post in MSDN forum for
    the further help and your issue may need capture a dump then for the further analysis it is not an efficient way to work in this community since we may need more resources which is not appropriate to handle in the community. I‘d like to suggest that you submit
    a service request to MS Professional tech support service so that a dedicated Support Professional can further assist with this request.
    MSDN forum
    https://social.msdn.microsoft.com/Forums/en-US/home
    Please visit the below link to see the various paid support options that are available to better meet your needs.
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
    Thanks for your understanding and support.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Is there a way to capitalize just the first word on a sentence on Pages v5.2?

    I'm sort of new to iwork, but i've been working with word for a long time and i know it very well.
    In word there is a tool in which you select a paragraph and you can capitalize the first word of each sentence.
    Is there a way i can do the same with pages v5.2? Pages would only let me capitalize each word of the selected paragraph.
    Thanks

    The previous major version of Pages (Pages '09 version 4.3) could automatically capitalize the first word of each sentence as you typed. That capability and a number of others was lost with the release of Pages v 5. You may still have the older version available in your Applications folder. You may also want to switch to Word or Open Office (free), both of which will likely be more familiar if you have worked with Word before.

  • HT4743 Bought 2 series only to find there are now series bundles for the first 4, but it doesn't offer to complete my series I don't mind paying just don't want to waste cloud storage for  2 whole series

    In the past I have bought 2 series of entourage, I went to buy series 3 only to spot a bundle of series 1-4 this works out cheaper but there isn't a complete my series option.
    I don't really want to pay for the first 2 series again but also I don't want to waste storage space by duplicating 2 series
    Any clues on how to sort this out

    iTunes can only put up what the studios supply them. You can contact iTunes directly if you want an official answer.
    TV shows wouldn't count towards any icloud storage.

  • Is there a way to test for integrity of the Citadel Database?

    Gday,
    Currently I am logging OPC data to a Citadel 5 database (Labview Version 8.2.1).
    I have done some integrity testing to try and "break" the citadel database and I noticed that if you delete any of the .cdpg files no alarms are flagged or notifications given in MAX or elsewhere to show that the database has been comprimised.
    The result of deleting or the corruption of any of these .cdpg files will result in valid data being 'moved' back in time as the citadel databases only log changes in value with no corressponding timestamp. For example if you delete from 9.00am to 10.00am then all data logged after 10.00am will now start at 9.00am.
    So I was wondering if there is anyway to either correct or even test for corruption in a citadel 5 database.
    Regards
    Ben

    This should not happen according to the design of Citadel. Also I tested with current Citadel, and didn't see this problem. I'm not sure if it was a bug in the old Citadel(the one with DSC 8.2), but for current Citadel, I can't reproduce it.
    There are many files in database folder. The .cdpg file is the data file, containing all the logged data. Some other files, such as .cdin, .cdih, .cdib, are the index files. When you read data from a trace, Lookout will first find the index from those files, and then locate the position of the data in .cdpg files. Actually Citadel will rebuild the index files if it finds something changed or damaged. If you delete one .cdpg file, Citadel will rebuild the index files. With the new index files, you can work with the database without any problem. The only difference is that the data in the deleted file can't be viewed then, just like the data was nevered logged. So, to delete the .cdpg file won't damage the whole database. The new data will be logged to database with the real time or the user-defined time. Citadel does log the delta value, but it also records the time for each trace. The detailed architecture is too complex to describe.
    Can you give some screenshots to show the problem?
    Ryan Shi
    National Instruments

  • Is there a way to pay for the CC subscription by purchase order?

    I work for the NHS and I can only see the option for card as a payment option.
    Is there a way we can arrange to invoice and raise a purchase order?

    Who would our reseller be? We previously used a contract supplier called trustmarque but the old Adobe agreement had indeed expired back in March. GPS and Adobe were talking about another extension however in this instance no middle ground could be found. Adobe and GPS are in discussions for a replacement however this isn’t likely to be until the end of the year really.
    It doesn't seem very straight forward for businesses to come directly to Adobe to order.

  • Is there a way to auto capitalize the first letter of every word?

    I Like To Type In This Way. I Was Wondering If There Is A Setting That Will Automatically Capitalize The First Letter Of Each Word So That I Don't Have To Keep Hitting Shift Before Each First Letter.
    Thank You

    AdamMarshall wrote:
    Nice to see so many 'helpful' responses.
    This casing is useful for example, on an Address field. It would be good if the OS had this option for developers.
    I'm pretty sure it does as I've certainly had apps that, in certain fields, do use title case.

  • Is there a way to automate generating the documentat​ion from a function panel?

    We have some DLL projects which contain function panel (.fp) files.  We link a help file to the DLL so that we can call up the help file when using TestStand.  As part of the build, we have to manually run Options -> Generate Documentation -> HTML.  Then we load the .hhp file into the Microsoft tool HTML Help Workshop and select File -> Compile to generate a .chm file.  Then in LabWindows/CVI we can build our DLL with links to the .chm help file.
    Has anyone been able to automate this?  It seems like it would be convenient to generate the help file in the Pre-build actions section of the Build Steps for the project.
    Note: this slightly more convoluted process of generating the .chm file replaces the old method of generating a .hlp file from within LabWindows/CVI.
    Solved!
    Go to Solution.

    Thanks, Luis.  After generating the ActiveX interface to the CVI server, I was able to write a small command line program that calls GenHtmlHelpFromFPFile.
    To generate the .chm file from the .hhp file, there's an executable provided by the HTML Help Workshop (hhc.exe).  It only seems to work if you run it from the HTML Help Workshop directory, though.  We have the following Build Steps:
    cd "C:\Program Files\HTML Help Workshop"
    hhc.exe %CVIPROJDIR%\name_of_fp_file.fp

  • Is there a way to not indent the first sentence in a chapter?

    I understand how to indent paragraphs in the text, but with proper sentence construction you don't indent the first sentence of a chapter. Is there anyway that you have found to do this in Author while still indenting the rest of the paragraphs?

    Do you already have a custom style you can leverage, say between para1 and para2, as an example?

  • Is there a way to search for damaged/corrupt files in itunes?

    Hi all,
    I have several itunes-purchased files that became damaged when a hard drive of mine went on the fritz a few months ago.  I managed to get most of my files transferred to a new hard drive, but I keep running across songs that are corrupt.  The way I know they are corrupt is they just won't play, even though the file shows up in my library no problem.
    My library is several thousand songs.  Is there any way to test for corrupt songs without going song-by-song manually?

    Sorry, but I don't know what it is you are trying to accomplish and how a spreadsheet program would be related to an iTunes issue. Can you please explain in more detail what it is you're trying to do? If your command of the English language is a barrier for you, try posting in your native language and someone who is fluent in that language may be able to help.
    Regards.

  • Had to restore iphone from a backup that was done 1 week ago.  any way to get back the texts, call logs, etc. that happened within the last week?

    this morning, i had to restore iphone from a backup that was done 1 week ago.  is there any way to get back the texts, call logs, etc that happened within the last week?

    No

Maybe you are looking for