What best practices of cfc

What do you think of this code? I use right of arguments? Can I use the argmuents collection instead? Cfparam becomes redundant when you use cfargument? Thanks for the advice, I try just to understand these last points thanks again

>
> I have (as a rule, if it can be avoided ~) acceding not external scopes
> directly into a CFC method. It breaks encapsulation and made less code
> reusable.

> hmm, I don't understand - I was setting a default value for the session.getemp session
> so it has been inside, apologies, I don't understand that we

Maybe it's a good idea if read you on the encapsulation and data hiding.
Or the fundamental principles of programming procedure (leaving aside the OO principles
as a first step).

Your function could well be designed to set the values default to * a user object *,.
but where this user object is stored and how much should really be his
company. If possible a function should do something:
-validate a user object;
-Put it in the session.

It's two things.

What happens on the track when you want valdiate a user but object
* don't * want to session? It could be part of your process of
creation of the user record in the first place, before putting it in the DB.
You don't want to write another function which is almost the same.
with the exception of the end of the session. So you have two pieces of code to maintain
If something changes. It is, of course, just the visible part of the iceberg.

My approach here would be to put a vanilla user object (a structure in the)
CFC instance taking bits and user data elements), and * back * that.
Then in your calling code you assign to the scope of the session.

Google "getters and setters.

In general, a function should only manipulate data in its own scope of application
(past arguments and local variables in the function (or the CFC
instance) and then go back a result based on this manipulation. They
should not manipulate anything "outside". The session scope is
intrinsically outdoors.

Except that I would have to this would be to have a session manager, which is
especially used to hold the values in the scope of the session. While its
job: managaing the scope of the session. He don't care about whether it is a user
permissions object or authorization, or a [something] State that
persists for the session; It handles just to put things in and to
things out of session.

However, for good practice, there is a situation where it is not the
best approach. However, I don't think this falls into this category.

Dan probably roll his eyes and goes 'too complicated', but I think that
We differ in opinion as to what is a good level of "complication" (I wish I
you mean "abstraction"), which is too much and what is too little ;-)

>
>

> Why don't you param just for a struct in the first place?

> OK so like so:
>

N ° you don't want it to be a string, even a vacuum. Param to a
* structure *:

> True if the values of arguments are not passed in there is an error thrown.
> That's why I was using the cfparam to stop all errors, if they were not passed

The error would be thrown by the code that performs the function call, so the
params would not get a look.

> so it should be
>
> where can I "both"?

Just the VAR statement is fine.

>
> no name

> Considered generally bad form to produce anything from a function.
>

> I'm sorry that you completely lost me on this one!

I mean exactly what I said (that is to say: I was not at an angle). In general, the
the code in a function should not out anything. An if function
* Return * something, no exit it.

I can't recommend which specific books / web pages to read, but I recommend
you google on the place of writing functions coding practices.

--
Adam

Tags: ColdFusion

Similar Questions

  • What best practices to remove a host server data store without emptying the contents of the data store

    Hi all

    This question was probably asked a million times. the best practice to remove a host server data store without emptying the contents of the data store?

    I have two clusters and I moved host group A to group B. host A is now to see data from Cluster Both A store and Group B datastore. We want that host A to store data in Cluster B. The Cluster a data store is not and can not be empty coz VM A Cluster using data warehouses. So I just unpreset the data LUN to host A store and Reanalyze the data store? Or there is a better way to do it?

    Thank you all

    Yes that's what I meant - should have specified where virtual machines are running.

  • Best practices for backup of a VM Web server?

    This question comes from another thread, that I created, but I figure I might as well start a thread fresh since it is his own question.

    Basically, I have an environment that I inherited when I started my new job within this environment, there is a lonely VM that runs from our Web server and was created using VMware player (will go to the workstation for the snapshot feature).

    I am extremely concerned by the fact that there is no backup strategy for it, so I'm interested in finding the best way to save this virtual machine.

    Being that it's a machine virtual I instantly thought, but of course I'm open to dictate what best practices.

    A lot of what I've read so far indicates to stop or suspend the virtual machine, then copy files, however is there a way to do that without temporarily take down my Web server?  It's just that we have customers in the world that has access to the server to different time zones and I want her to be in place 24/7.

    You'll have to stop the Virtual Machine and close VMware Player and uninstall VMware Player to install VMware Workstation and it is the time where you should make a backup copy of the master of the Virtual Machine.  Once installed VMware Workstation and the Virtual Machine is back and then runs to reduce the minimum time for subsequent backups you necessarily do not do such proposed by Richardson Porto although I don't disagree with what he says.

    In theory anyway, and in practice, when you want to backup you would take a cliché Hot and then copy the Parent disk such that it is now read-only and the Virtual Machine is still running while you make a copy of the Parent disk.  Once you have copied the Parent disk, you can then remove the snapshot thus merging Delta and drive Parent and now ready for the next time you want to back up the drive.  The duration of that Virtual Machine is interrupted during the snapshot warm and hot snapshot delete should be considerably less and then stop and restart the virtual machine.  The reason why I said "in theory" because while it is supposed to work in practice, nevertheless if you correctly shutdown the guest operating system before capture instant, so you do not rely on VMware Workstation to make sure that everything works all in being hot.  Not that you should have problems, it's hot, however you remove a layer of the process that has the potential of being wrong compared to when is cold, even if it is cold takes a little longer.

    In both cases, I would avoid cloning because it changes the UUID and MAC address of the clone of the parent company and by creating a second occurrence technically need a second license for the Windows operating system that is installed on the cloned virtual machine.  In other words an archived copy complete or exact unedited from the original is a legitimate backup a clone of IMO is a second occurrence but it has a different UUID and MAC address.  It would be like taking a copy of the operating system with a single license and install on two different physical computers.  Also by doing as I have suggested and make a backup copy of Master of the Virtual Machine and then just save the Parent read-only disks disk hard virtual are themselves not a computer virtual and just that copy a backup, however can be used to restore the same Virtual Machine driven and not having not any changes in the UUID MAC addresses etc.

    Finally, you should look into what you are running in the guest operating system and how to properly save Web Site and database, or user data etc in the guest operating system.  In other words, you should always have a copy backup of the virtual machine and everything that is necessary in the guest operating system to be able to restore it without necessarily restore all of the Virtual Machine.  IMO it's better to have several and backup types to have more options in a recovery scenario!

  • Best practices the iSCSI target LUN

    I connect to my ESX laboratory to a QNAP iSCSI target and wonder what best practices to create LUNS on the target. I have two servers each connection to its own target. Do I create a LUN for each virtual machine, I intend to create in the laboratory, or is it better to create a LUN of the largest and have multiple VMs per LUN? Place several virtual machines on a LUN has concequenses HA or FA?

    Concerning

    It is always a compromise...

    ISCSI reservations are per LUN.    If you get many guests on the same logical unit number, it becomes a problem and Yes we saw it.

    Slim sure to layout.   This way you can make your smaller LUN and still get several s VM we each their.

  • What is the best practice to move an image from one library to another library

    What is the best practice to move an image from a photo library to another library of Photos ?

    Right now, I just export an image on the desktop, then remove the image from Photos. Then, I open the other library and import these images from the office in Photos.

    Is there a better way?

    Yes -PowerPhotos is a better way to move images

    LN

  • What are the best practices framework OA customizations autour?

    Hello

    We make many customizations in our case.

    What are the best practices around customizations.

    How to document?

    What is a good practice to make all the customizations by using functional Adimistrator?

    Kind regards

    Sandra

    Best place for this question would be OA Framework

    What are the best practices around customizations.

    What do you mean by that? There is one way you can do customization. But the functionality can be achieved differently, in this case, it will be very specific in what you want to achieve.

    If you reference how to do customization, such as aid of the functional administrator or go to the page and clicking in the Customize link in the page or by using the xml file and using XMLImporter, it is not really important.

    If ask you questions about the migration of customization, you can either export to leave an instance and import them into another instance using functional administrator or XML importer. Or do it manually again.

    The XML importer is usually easy and need less documentation from the point of view of migration.

    How to document?

    If you migrate manually, could better document the steps with screenshots.

    If not, document changes in the screen as well as the reference to the downloaded file customization.

    What is a good practice to make all the customizations by using functional Adimistrator?

    This is one of the option.   I don't see anything wrong with that.

    By accessing the page could be more easily test the change.

    See you soon

    AJ

  • A listener by server or a listener instance?  What is the best practice?

    I joined a company owner and new oracle DBA uses a listener and a port (by default) by server.  We have 7 instances of oracle on a server database using the same listener.  I always created a new listener. / netca or make entries manually by database instance. / dbca

    What is the best practice?  My argument for the creation of a separate listener is to be able to restrict connections and accelerator by database using the parameters and the params of the listener.  With a listener, it seems impossible to use several listener settings or settings since all the dB to use it only a listener.  Also if the listener does not have any new connection for all the dB to use it on the server.

    What is the best practice?

    The best practice is what works best for you in your particular environment

    Personally I have found don't have much need to adjust the configuration of the listener for each separate instance so in my environment of each server has 1 single earphone that is shared by several bodies. I can see your points about the benefits of having separated from listeners, but also additional administration required for the best answer is the one that is right for you. Some of the servers I maintain may have up to 20 instances (development) so having 20 listeners is probably a little more work I want keep.

  • What are the best practices for creating only time data types, and not the Date

    Hi gurus,

    We use 12 c DB and we have a requirement to create the column with datatype of time only, if someone please describe what are the best practices for the creation of this.

    I would strongly appreciate ideas and suggestions.

    Kind regards
    Ranjan

    Hello

    How do you intend to use the time?

    If you are going to combine with DATEs or timestamps from a other source, then an INTERVAL DAY TO SECOND or NUMBER may be better.

    Will you need to perform arithmetic operations on time, for example, increase the time to 20%, or take an average?   If so, the NUMBER would be preferable.

    You are just going to display it?  In this case, DAY INTERVAL in SECONDS, DATE or VARCHAR2 would work.

    As Blushadow said, it depends.

  • What are the best practices for a new employee to learn inside the instance of their business of Eloqua as efficiently as possible?

    We have companies everything changed at some point in our lives. And we all go through the process in the first weeks, where you feel new and are just trying to figure out how not to get lost on your way in the mornings.

    On top of that, trying to familiarize yourself with your new company Eloqua instance can be a daunting task, especially if it's a large organization.

    What are the best practices for new employees to learn as efficiently and effectively as possible?

    I am in this situation right now. Moved to a much larger organization. It is a huge task trying to understand all the ins and outs not only society, but also of the eloqua instance, especially when she is complex with many points of integration. I find that most of the learning happens when I really go do the work. I spent a ton of time going through the programs, documentation, integrations, etc., but after awhile, it's all just words on a page and not absorbed.

    The biggest thing that I recommend is to learn how and why things are made the way they are currently, ask lots of questions, don't assume not that things work the same as they did with your previous employer.

    Download some base in place level benchmarks to demonstrate additional improvement.

    Make a list of tasks in the long term. As a new pair of eyes, make a list of things you'd like to improve.

  • What is the best practice to block through several layers sizes: hardware and hypervisor VM OS?

    The example below is not a real Setup, I work with, but should get the message. Here's my example of what I'm doing as a reference layer:

    (LAYER1) Hardware: The hardware RAID controller

    • -1 TB Volume configured in the 4K block size. (RAW)?


    (Layer2) Hypervisor: Data store ESXi

    • -1 TB of Raid Controller formatted with VMFS5 @ block size of 1 MB.


    Layer (3) the VM OS: Server 2008 R2 w/SQL

    • -100 GB virtual HD using NTFS @ 4 K for the OS block size.
    • -900 GB virtual HD set up using NTFS @ 64 K block size to store the SQL database.

    It seems that vmfs5 is limited to only having a block size of 1 MB. It would be preferable that all or part of the size of the blocks matched on different layers and why or why not? What are the different block sizes on other layers and performance? Could you suggest better alternative or best practices for the sample configuration above?

    If a San participated instead of a hardware on the host computer RAID controller, it would be better to store the vmdk of OS on the VMFS5 data store and create an iSCSI separated THAT LUN formatted to a block size of 64 K, then fix it with the initiator iSCSI in the operating system and which size to 64 K. The corresponding block sizes through layers increase performance or is it advisable? Any help answer and/or explaining best practices is greatly appreciated.

    itsolution,

    Thanks for the helpful response points.  I wrote a blog about this which I hope will help:

    Alignment of partition and blocks of size VMware 5 | blog.jgriffiths.org

    To answer your questions here, will:

    I have 1 TB of space (around) and create two Virutal Drives.

    Virtual Drive 1-10GB - to use for OS Hyper-visiere files

    Virtual Drive 2 - 990 GB - used for the storage of data/VM VMFS store

    The element size of default allocation on the Perc6 / i is 64 KB, but can be 8,16,32,64,128,256,512 or 1024 KB.

    What size block would you use table 1, which is where the real hyper-visiere will be installed?

    -> If you have two tables I would set the size of the block on the table of the hypervisor to 8 KB

    What block size that you use in table 2, which will be used as the VM data store in ESXi?

    ->, I'd go with 1024KO on VMFS 5 size

    -Do you want 1024KO to match the VMFS size which will be finally formatted on top he block?

    -> Yes

    * Consider that this database would eventually contain several virtual hard drives for each OS, database SQL, SQL logs formatted to NTFS to the recommended block, 4K, 8K, 64K size.

    -> The problem here is THAT VMFS will go with 1 MB, no matter what you're doing so sculpture located lower in the RAID will cause no problems but does not help either.  You have 4 k sectors on the disk.  RAID 1 MB, 1 MB invited VMFS, 4 k, 8K, 64 K.   Really, 64K gains are lost a little when the back-end storage is 1 MB.

    If the RAID stripe element size is set to 1 024 Ko so that it matches the VMFS 1 MB size of block, which would be better practice or is it indifferent?

    -> So that's 1024KB, or 4 KB chucks it doesn't really matter.

    What effect this has on the OS/Virtual HD and their sizes respective block installed on top of the tape and the size of block VMFS element?

    -> The effect is minimal on the performance but that exists.   It would be a lie to say that he didn't.

    I could be completely on the overall situation of the thought, but for me it seems that this must be some kind of correlation between the three different "layers" as I call it and a best practice in service.

    Hope that helps.  I'll tell you I ran block size SQL and Exchange time virtualized without any problem and without changing the operating system.  I just stuck with the standard size of microsoft.  I'd be much more concerned by the performance of the raid on your server controller.  They continue to do these things cheaper and cheaper with cache less and less.  If performance is the primary concern then I would consider a matrix or a RAID5/6 solution, or at least look at the amount of cache on your raid controller (reading is normally essential to the database)

    Just my two cents.

    Let me know if you have any additional questions.

    Thank you

    J

  • Using PowerPoint and Captivate together - what are your best practices?

    HI - here are my two questions...

    (1) it seems that when you insert PowerPoint slides in CP7 and duplicate a slide - slide 2 is not a fresh new creation.  It is always related to the original slide & all changes to one of them in PowerPoint, a direct impact on other related slides.  I realize now that I can go back in PP and duplicate it... But it just seems like extra which steps.  Am I missing something here?

    (2) I would like to hear how others approach developers creating a new project of CP, using PowerPoint as a starting point.  Go you back or do you create new themes based on the drawings of PP and then copy and paste the content?  I guess I'm looking here for best practices.

    I appreciate your help!

    Denise

    Hello

    If you start from scratch, PowerPoint is a terrible thing to consider. Don't get me wrong it's a great tool for what it does. But the reason we see even any possibility for Captivate shoot in a PowerPoint presentation is because there are still masses of people out there who have hundreds of thousands of PowerPoint presentations they want to reallocate in e-learning. So it is to get this way managed job 'quick and dirty '.

    The process of importing a PowerPoint performs a conversion of the PowerPoint slide in Flash SWF file. Then, the SWF file is configured as the subject of the slide background. That's why when you duplicated the slide, you have seen the behaviour you have done.

    Here is that if you start from scratch, start with a blank Captivate project. Use PPT if you wish, but only as a design tool. Copy the images of PPT, then insert into Captivate.

    See you soon... Rick

  • What is the best practice for a 'regular' Server VMware and VDI environment?

    What is the best practice for a "regular" VMware Server and VDI environment?   A single environment (ESXi and SAN) can accommodate two if it is a whole new configuration?  Or even better to keep separate?

    Enjoying inputs.

    Quick and dirty answer is that "it depends."

    serioulsy, it depends really two things budget and IO.  If you had the money for two without then buy two and don't have to host your server environment and the other for VDI desktop, their IO profiles are completely different.

    If this is not the case, try to keep each type of use for their own dedicated LUN.

  • What is the best way or best practices for access to the session defined in servelt pipeline component?

    Hi Experts,

    What is the best way or best practices for access to the session defined in servelt pipeline component?

    Please, share your ideas.

    Thank you

    ankV

    As performance is concerned, a lot would depend on as to how your design & logic is implemented and you presented search operations to support the specific performance problems. In fact the operation itself can be not expensive than in-house it is somewhat like a search for key/value of the objects in session/application context name. But having said that, Yes, a potential performance problem could be because it's a synchronized operation. So to avoid searches to be performed during each request, caching the results of a search of a component. And in the majority of cases to solve a 'A' component within your component, you must configure a property reference 'A' in the file properties for your component.

  • Big 2 TB + vm - what is the best practice?

    Hello

    Our file server currently uses the measure with a total area of 4 to DS. The virtual machine contains 11 vDisks with sizes ranging from 50 GB to 1.35 to totaling 3.8 TB of data. each vDisk belongs to a division within the company. We are running out of space on the DS, and we need to make changes.

    I did read something positive on the use of measurement other than for a short fix.

    Question: What are the best practices to go forward get rid us of the widespread use, it has been suggested, we look at DFS or perhaps a new virtual machine intended only for the major divisions.

    If we add a new disk and that it points to an another DS on it's own logic unit number, we run into the trouble of storage vMotion, try to group the disc under a store.

    I'm sure that there are large organizations out there running in this situation, any guidance is appreciated!

    See you soon

    Brendan

    If you need a file server, that SFR might be a solution.

    You can use vmdk as well on the same VM, or more file servers.

    For other purposes, you can use the junction to mount a drive in a folder.

    André

  • What is the best practice to merge both vMware vSphere environments?

    We recently bought another company that also manages vMware 4.

    They have a 4-node cluster and we have a 3 a node. Each is managed by its own vcentre.

    What would be the best practice to migrate all the guests and the hosts on the server main vCentre.

    Thank you

    Lance

    I choose one of the vCenters, unplug and remove hosts from the other and connect them to those elected. Configure the cluster after that (all in the same or keep the separation of the group, which I think is the best)

    You can also use related modes.

    Marcelo Soares

    VMWare Certified Professional 310/410

    Master virtualization technology

    Globant Argentina

    Review the allocation of points for "useful" or "right" answers.

Maybe you are looking for