Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

How-To Tutorials

7018 Articles
article-image-adding-graphics-map
Packt
13 Feb 2014
4 min read
Save for later

Adding Graphics to the Map

Packt
13 Feb 2014
4 min read
(For more resources related to this topic, see here.) Graphics are points, lines, or polygons that are drawn on top of your map in a layer that is independent of any other data layer associated with a map service. Most people associate a graphic object with the symbol that is displayed on a map to represent the graphic. However, each graphic in ArcGIS Server can be composed of up to four objects, including the geometry of the graphic, the symbology associated with the graphic, attributes that describe the graphic, and an info template that defines the format of the info window that appears when a graphic is clicked on. Although a graphic can be composed of up to four objects, it is not always necessary for this to happen. The objects you choose to associate with your graphic will be dependent on the needs of the application that you are building. For example, in an application that displays GPS coordinates on a map, you may not need to associate attributes or display info window for the graphic. However, in most cases, you will be defining the geometry and symbology for a graphic. Graphics are temporary objects stored in a separate layer on the map. They are displayed while an application is in use and are removed when the session is complete. The separate layer, called the graphics layer, stores all the graphics associated with your map. Just as with the other types of layers, GraphicsLayer also inherits from the Layer class. Therefore, all the properties, methods, and events found in the Layer class will also be present in GraphicsLayer. Graphics are displayed on top of any other layers that are present in your application. An example of point and polygon graphics is provided in the following screenshot. These graphics can be created by users or drawn by the application in response to the tasks that have been submitted. For example, a business analysis application might provide a tool that allows the user to draw a freehand polygon to represent a potential trade area. The polygon graphic would be displayed on top of the map, and could then be used as an input to a geoprocessing task that pulls demographic information pertaining to the potential trade area. Many ArcGIS Server tasks return their results as graphics. The QueryTask object can perform both attribute and spatial queries. The results of a query are then returned to the application in the form of a FeatureSet object, which is simply an array of features. You can then access each of these features as graphics and plot them on the map using a looping structure. Perhaps you'd like to find and display all land parcels that intersect the 100 year flood plain. A QueryTask object could perform the spatial query and then return the results to your application, where they would then be displayed as polygon graphics on the map. In this article, we will cover the following topics: The four parts of a graphic Creating geometry for graphics Symbolizing graphics Assigning attributes to graphics Displaying graphic attributes in an info window Creating graphics Adding graphics to the graphics layer The four parts of a graphic A graphic is composed of four items: Geometry, Symbol, Attributes, and InfoTemplate, as shown in the following diagram: A graphic has a geometric representation that describes where it is located. The geometry, along with a symbol, defines how the graphic is displayed. A graphic can also have attributes that provide descriptive information about the graphic. Attributes are defined as a set of name-value pairs. For example, a graphic depicting a wildfire location could have attributes that describe the name of the fire along with the number of acres burned. The info template defines what attributes should be displayed in the info window that appears when the graphic appears, along with how they should be displayed. After their creation, the graphic objects must be stored inside a GraphicsLayer object, before they can be displayed on the map. This GraphicsLayer object functions as a container for all the graphics that will be displayed. All the elements of a graphic are optional. However, the geometry and symbology of a graphic are almost always assigned. Without these two items, there would be nothing to display on the map, and there isn't much point in having a graphic unless you're going to display it. The following figure shows the typical process of creating a graphic and adding it to the graphics layer. In this case, we are applying the geometry of the graphic as well as a symbol to depict the graphic. However, we haven't specifically assigned attributes or an info template to this graphic.
Read more
  • 0
  • 0
  • 4951

article-image-vmware-vcenter-operations-manager-essentials-introduction-vcenter-operations-manager
Packt
12 Feb 2014
14 min read
Save for later

VMware vCenter Operations Manager Essentials - Introduction to vCenter Operations Manager

Packt
12 Feb 2014
14 min read
(For more resources related to this topic, see here.) What is vCenter Operations Manager? vCenter Operations Manager, also known as vC Ops, is a VMware product that allows IT administrators to monitor their virtual environments in the most efficient way. It also aids in design and capacity planning. vC Ops allows us administrators and IT managers to have visibility into our entire virtual infrastructure and goes beyond the simple alarms and performance charts offered in vCenter Server alone. It offers dashboards, alerts, and several detailed reports to help us better assess our environments. We can even monitor several different vCenter environments by simply configuring vC Ops to connect with any vCenter Server that we have in our environment. vC Ops is a vApp consisting of two virtual appliances that can be downloaded from the VMware website. It comes with a management plugin that's easily installed on the vSphere client. Alternatively we can browse the management site directly, if preferable. With vSphere Version 5.1 and above, we can also use vSphere Web Client to manage vC Ops and we can find embedded metrics within the summary pages for most of the objects in our virtual infrastructure. As we can see from the following screenshot, the default dashboard offered in all the licensed versions of vC Ops above the Foundation edition holds a lot of information. We get an idea of the three major metrics, or badges, that vC Ops tells us about: Health, Risk, and Efficiency. Dashboards such as the one shown in the following screenshot can quickly give us an insight into the things that are happening in our environment and visually point out any errors or issues inside our environment that may have cause for more investigation. Although vCenter Server comes with its own alarms and performance charts, vC Ops actually learns about our environment and reports alerts based on that. In fact, it's recommended that we let vC Ops run for a month after the initial installation before we start looking at the metrics and going through the reports. vCenter Server has several alarms that will show up on our vSphere Client, but we need to set these alarms with hard triggers. For example, in the following screenshot, we can see the vCenter 5.1 alarm triggers for Host memory usage in vSphere Web Client. It shows that if the memory usage for a physical host is above 90 percent for five minutes or longer, it will give us a warning. If the host memory usage is above 95 percent for five minutes or longer, it will give us a critical error. For an alarm like this, a rigid or static trigger threshold may be appropriate. Memory should really not be at more than 95 percent utilization for too long. In that situation, we would want to add more memory to that host or perhaps vMotion VMs to another host if we have that option. However, what if we have an alarm triggered for CPU usage of a virtual machine? If this virtual machine consistently runs with high CPU usage because it's supposed to, vCenter will still tell us there is a critical error. Since vC Ops actually learns our environment, it will tell us that this is not an anomalous behavior, and we may not need to worry about it. Another example of when this is useful would be if a VM routinely runs scheduled tasks that cause CPU or memory utilization to be high for a brief time during the day. vCenter alarms would trigger everyday or every time this happens. vC Ops will learn this behavior, thereby reducing the barrage of alerts admins receive everyday. vC Ops will still tell us that CPU usage runs high via badge scores, such as Workload or Stress, so we don't have to worry about missing information either. Other than immediate notifications and alarms found throughout the dashboards and reports, vC Ops also gives us visibility into longer-term issues and helps us know whether it's safe to add or remove VMs as well as physical resources to our environment. Benefits of troubleshooting with vC Ops As mentioned in the previous section, vC Ops actually understands our environment and reports anomalous behavior. This is not to say that if a VM is always using 100 percent of its storage, vC Ops will let you know that. It will also let you know how long it's been happening and the normal range for the VM. If we zoom in on the Workload badge, as shown in the following screenshot, we can see that it shows CPU usage, memory usage, disk I/O, and network I/O. The blue bar above each graph shows the normal range for each metric. If it were outside of that normal range, that would indicate anomalous behavior. This can be very helpful for troubleshooting because now we can dive in and see what's changed. From vCenter Server alone, we can see some historical data, and we can see real-time metrics, but without doing some pretty intense math, we won't know the normal range. Another benefit you get with vC Ops, which you wouldn't necessarily see in the vCenter Server performance data, is that you can check whether VMs are undersized. An undersized VM is a virtual machine with less compute resources than it actually needs to perform properly. Again, this is not based solely on random peaks or bursts, but rather on historical and present data that has been run through algorithms, and vC Ops lets us know how much compute the VM should be assigned for it to work efficiently. So, for instance, if an application is running slow, or even slow at particular times in a day consistently, we would be able to open vC Ops, highlight the affected machine, and then go to the Planning tab. From here, we can see how much time this VM has been running without enough memory or CPU, for example, and it will also tell us how much additional resources it recommends. One of the most interesting benefits is when you pair vC Ops with vCenter Configuration Manager. Again, let's say we have an application that's all of a sudden running slow or sporadically. If we open vC Ops and highlight the problematic VM again, we can find the recent events and tasks that have been performed on that VM. On this page, we can also see a graph with the performance of the VM. We can see where the performance spiked and also the events that correlated with that timeframe. Perhaps the event would be something similar to "VM RAM was changed from 10 GB to 2 GB". Even before we use vCenter Configuration Manager, we've narrowed down the issue to being lack of memory. Now, if we check with vCenter Configuration Manager, we may be able to see which administrator made that change, if that change was made from vCenter Configuration Manager. The last benefit I'm going to bring up here, though there are certainly more, is the easy way to find relationships between VMs and other vSphere inventory objects. So, why is finding the relationship between a VM and what it's connected to important? Let's look at our previous two scenarios, where we had an application running slow on a VM. If we were to look at the VM, it could show that things are running slow, but we may be unable to find the reason immediately. However, if we look at the relationships between them, there may be a common denominator, such as a datastore or host, that is actually causing the issue. We may see that all the VMs on that particular datastore or host are running poorly, but if we correct the error at the root of the problem, we'll correct the issues on all the VMs connected to it. Using vCenter alone, we might have taken a lot longer to figure out this correlation, but because we can see all the relationships mapped out for us, it's easier to do a root cause analysis. See the following two screenshots for illustrations of how this might look. The following example is of the Overview section of the Environment tab. It shows all of the elements across the environment from the top down but highlights those related to, for example, a selected VM. The following example, found under the Relationships section of the Environment tab, gives you a different view. It shows only the components that are in a direct relationship with the component you have selected in the left-hand side pane. Benefits of capacity planning with vC Ops VMware used to have a solution called vCenter Capacity IQ. In early 2012, VMware stopped selling Capacity IQ and put all of the capacity planning features from Capacity IQ into vC Ops. We can upgrade vCenter Capacity IQ licenses to vC Ops licenses. vCenter itself doesn't really offer much by way of capacity planning. Obviously, we can look at how much space we have free on our datastores as well as how many compute resources we have free, but it would still be an estimate. With vC Ops, we take the guesswork out of it with the use of oversized VM reporting and what-if scenarios. The great thing about vC Ops is that it actually has a lot of capacity management features in every view and dashboard. No matter where we've drilled in, we'll be able to see information about how much storage or compute resources are left. However, most of the capacity planning features can be easily found under the Planning and Analysis tabs. Here, we can find information, not only on how much storage or compute a VM is using, but also what the trends have been for future planning purposes. For instance, you might be able to see that a datastore has been losing about 2 GB of free space every week. If the datastore is 1 TB, vC Ops can estimate when we might run out of space. Much like the undersized VM analysis discussed in the troubleshooting section, we also have data on which VMs are oversized. Many times applications and/or application owners will ask for outrageous amounts of CPU or memory. There are also cases where we perform physical to virtual migrations to convert a physical server to a virtual server and we just leave the original amount of compute resources even if it's not necessary. vCenter Server is never going to tell us that we've over allocated memory or CPU, for example, to a VM. vC Ops, however, will show us a full report on the VMs on which we can reclaim compute resources and how much can be reclaimed. This may seem like a small reclamation of resources, but let's say we have 100 VMs, and 25 of them are using an extra two vCPUs, then we can essentially reclaim 50 vCPUs as well as reduce CPU contention within our environment. Probably the most interesting benefit of using vC Ops to do our capacity planning is the what-if scenarios. We can actually click on a link under the Planning tab to pull up a what-if scenario wizard. For example, with this wizard, we can manually input the number of VMs we want to add, and it will output how that will affect the current environment. We can also have it automatically input the variables using trending analytics for our environment. vC Ops will take a look at the average size of our VMs, analyze any pertinent historical data, and then tell us if we have enough resources to add a certain amount of VMs. This is an incredibly powerful tool that most normal admins would not be able to replicate through the use of a simple script with simple mathematics. Feature comparison of versions A number of versions of vC Ops are available. The following is a quick overview of the various versions. What is vCenter Operations Manager Suite? The main focus of this article is vC Ops although we do get into some of the other components of the suite. VMware has historically sold the current components of the suite separately. Recently though, they've decided it would be beneficial to bundle them in a suite. The components of the suite are as follows: vCenter Operations Manager vCenter Configuration Manager vFabric Hyperic vCenter Infrastructure Navigator vCenter Chargeback Manager For more information on these components, check the documentation given on VMware.com. Licensing versions Not every component comes in the vC Ops suite. It depends on which version of the license has been purchased. The versions of the suite are as follows: Foundation Standard Advanced Enterprise The versions of the vC Ops suite should not be confused with the versions of the vCloud suite. They are separate items. As of Version 5.7, vC Ops licensing works in the following way. This chart was taken directly from the VMware.com website. By looking at the chart, Foundation and Standard look the same, as do Advanced and Enterprise. However, that's not actually the case. Currently the Foundation license is included in every version of vCenter. It does not give us insights using historical data, it only reports in real time. However, it will store the historical data if we decide to upgrade the license at a later date. Foundation doesn't really offer much by way of capacity planning either. It's really more of just an extension of our current alerts that we get from vCenter. As shown in the chart, Standard gives us all that is included in Foundation, as well as the capacity features. It is basically a full version of vCenter Operations Manager. The Advanced and Enterprise versions give us what is really more of a suite with the components mentioned earlier. The difference between these being that Enterprise gives us more OS- and application-level monitoring and Advanced really just gives us the VM-level monitoring. Using vC Ops with other solutions There are several plugins or adapters to vC Ops that will extend our monitoring capabilities even further. One plugin that came out in the last year or so is vCenter Operations Manager for Horizon View. Through the use of vC Ops adapters, we can now monitor our Horizon View virtual desktop implementations. This gives us custom dashboards that give us a lot more insight than we've had before. If you've ever run a VDI environment, you must be well aware that the ability to pinpoint our problem areas quickly is a necessity. Other VMware solutions it will connect to are vCloud Director 1.5.0 and above. There are several storage adapters for vC Ops as well. Among these are the EMC Smarts Adapter, EMC Symmetrix Adapter, EMC VNX Adapter, and NetApp Adapter. There are also several monitoring solutions that vC Ops can connect with to get a view of your whole environment, such as HP BAC Adapter, HP SiteScope Adapter, IBM Tivoli Monitoring Adapter, and Microsoft SCOM Adapter. It will also plug into Oracle Enterprise Manager to help you monitor your Oracle databases. In most cases, after connecting vC Ops to these adapters, we need to browse to a custom site other than our vC Ops management site. These sites will have custom dashboards set up with information from the product(s) we are connected to. At present, this information does not really affect the regular vC Ops dashboards. You will still see the same information there that you would see if you did not have the adapters installed and collecting data. Summary In this article, we discussed what vCenter Operations Manager is. It's a solution that allows us to monitor our virtual infrastructure as well as plan for future capacity issues that may arise. We then discussed some of the benefits of troubleshooting our virtual environments as well as doing some capacity planning with the help of vCenter Operations Manager. It's also important to keep in mind that there are several different versions of vC Ops, and it is possible to get it in a bundle with vCenter Configuration Manager, vFabric Hyperic, vCenter Infrastructure Navigator, and vCenter Chargeback Manager. Finally, we went over some of the other hardware and software solutions that we can integrate into our vCenter Operations Manager and/or suite, such as storage arrays and other third-party monitoring solutions. Resources for Article: Further resources on this subject: Securing vCloud Using the vCloud Networking and Security App Firewall [article] Cloning and Snapshots in VMware Workstation [article] Network Virtualization and vSphere [article]
Read more
  • 0
  • 0
  • 2917

article-image-introduction-vsphere-distributed-switches
Packt
11 Feb 2014
10 min read
Save for later

Introduction to vSphere Distributed switches

Packt
11 Feb 2014
10 min read
(For more resources related to this topic, see here.) Using vSphere Distributed Switches The vSphere Distributed Switches are virtual switches that span across multiple hosts. This makes it easier to configure hosts that need similar network configurations. It also ensures that virtual machines will get the same network configuration when they migrate to another host. You need a vSphere Enterprise Plus license and a vCenter Server to be able to use vSphere Distributed Switches. In vSphere PowerCLI, there are separate sets of cmdlets for working with vSphere Standard Switches and vSphere Distributed Switches. In the past, the VMware PowerCLI team tried to integrate both types of switches into one set of cmdlets. This is why, for example, the Get-VirtualSwitch cmdlet has a –Distributed parameter. However, this parameter is now obsolete, and VMware made a new set of cmdlets specific for vSphere Distributed Switches. The vSphere PowerCLI VDS snap-in that provides support for managing Distributed Switches and port groups was introduced in PowerCLI 5.1 Release 2. In this section, you will learn more about these new cmdlets. In the following diagram, you see a vSphere Distributed Switch that spans two hosts: Creating vSphere Distributed Switches The New-VDSwitch cmdlet creates new vSphere Distributed Switches. This cmdlet has the following syntax: New-VDSwitch [-ContactDetails <String>] [-ContactName <String>] [-LinkDiscoveryProtocol <LinkDiscoveryProtocol>] [-LinkDiscoveryProtocolOperation <LinkDiscoveryOperation>] [-MaxPorts <Int32>] [-Mtu <Int32>] [-Notes <String>] [-NumUplinkPorts <Int32>] [-Version <String>] -Name <String> -Location <VIContainer> [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>] New-VDSwitch -ReferenceVDSwitch <VDSwitch> -Name <String> -Location <VIContainer> [-WithoutPortGroups] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>] New-VDSwitch -BackupPath <String> [-KeepIdentifiers] [-Name <String>] -Location <VIContainer> [-WithoutPortGroups] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>] If you compare the preceding syntax with the syntax of the New-VirtualSwitch cmdlet, then you will see that the New-VDSwitch cmdlet has many more possibilities to configure the virtual switch during creation. In vSphere 5.1 and later versions, you can even specify a reference vSphere Distributed Switch or a backup profile from where a new switch can be created. Creating a new vSphere Distributed Switch from scratch. To create a new vSphere Distributed Switch from scratch, you have to specify at least the -Name and the –Location parameters. The location can be a datacenter or a folder. In the next example. we will create a new vSphere Distributed Switch named VDSwitch1 in datacenter New York: PowerCLI C:> $Datacenter = Get-Datacenter -Name "New York" PowerCLI C:> New-VDSwitch -Name "VDSwitch1" -Location $Datacenter Name NumPorts Mtu Version Vendor ------------------------------------------------------------------------ VDSwitch2 0 1500 5.5.0 VMware Cloning a vSphere Distributed Switch We can now clone the VDSwitch1 to a new switch VDSwitch2. Of course, this is not very useful because VDSwitch1 is not configured yet. We will clone the switch just to show you how to do it: PowerCLI C:> New-VDSwitch -Name "VDSwitch2" `>> -ReferenceVDSwitch "VDSwitch1" -Location $Datacenter>>Name NumPorts Mtu Version Vendor---- -------- --- ------- ------VDSwitch2 0 1500 5.5.0 VMware If you want to clone a vSpheredistributed switch without cloning the port groups, then you can use the –WithoutPortGroups parameter. Cloning a vSphere Distributed Switch and the New-VDSwitch-ReferenceVDSwitch parameter are only supported in VMware vSphere 5.1 and later versions. Creating a vSphere Distributed Switch from an export Later in this article, we will see how to create an export of the configuration of a vSphere Distributed Switch. If you have an export, then you can use it to recreate a switch or to create a new one. The next example will create a new vSphere Distributed Switch named VDSwitch3 in the datacenter New York from an export of the configuration of VDSwitch1: PowerCLI C:> New-VDSwitch -BackupPath C:VDSwitch1Config.zip ` >> -Name VDSwitch3 -Location (Get-Datacenter –Name "New York") Importing vSphere distributed switch - Switch name: 'VDSwitch1', Switch version: 5.5.0, Number of port groups: 1, Number of resource pools: 8, Number of uplinks: 1, Notes: VDSwitch1 Configuration Name NumPorts Mtu Version Vendor ------------------------------------------------------------------------ VDSwitch3 0 1500 5.5.0 VMware Also, for importing an export you can use the –WithoutPortGroups parameter to prevent importing the port groups. Retrieving vSphere Distributed Switches You can retrieve vSphere Distributed Switches with the Get-VDSwitch cmdlet. The syntax of this cmdlet is as follows: Get-VDSwitch [[-Name] <String[]>] [-Location <FolderContainer[]>] [-VMHost <VMHost[]>] [-VM <VirtualMachine[]>] [-Server <VIServer[]>] [<CommonParameters>] Get-VDSwitch -Id <String[]> [-Server <VIServer[]>] [<CommonParameters>] Get-VDSwitch -RelatedObject <VDSwitchRelatedObjectBase[]> [<CommonParameters>] If you use the Get-VDSwitch cmdlet without parameters, then it will return all of the vSphere Distributed Switches in your environment. You can use the -Location parameter to specify a datacenter or folder in which you want to search for vSphere Distributed Switches. The next example will retrieve all of the vSphere Distributed Switches in the datacenter New York: PowerCLI C:> Get-Datacenter -Name "New York" | Get-VDSwitch Name NumPorts Mtu Version Vendor -------------------------------------------------------------- VDSwitch1 0 1500 5.5.0 VMware VDSwitch2 0 1500 5.5.0 VMware VDSwitch3 0 1500 5.5.0 VMware You can specify a value for the –Name parameter to retrieve a specific vSphere Distributed Switch. In the following example, we will retrieve the vSphere Distributed Switch VDSwitch1: PowerCLI C:> Get-VDSwitch -Name VDSwitch1 Name NumPorts Mtu Version Vendor ------------------------------------------------------------------------ VDSwitch1 0 1500 5.5.0 VMware Configuring vSphere Distributed Switches The selection you make using Get-VDSwitch can be used as an input of the SetVDSwitch cmdlet to modify the configuration or version of one or more vSphere Distributed Switches, to roll back the configuration to its previous state, or to import the configuration from a backup profile. Rolling back the configuration of a vSphere Distributed Switch and importing the configuration of a vSphere Distributed Switch from a backup are available only on vSphere 5.1 and later versions. The Set-VDSwitchcmdlet has the following syntax: Set-VDSwitch [-Name <String>] [-ContactDetails <String>] [-ContactName <String>] [-LinkDiscoveryProtocol <LinkDiscoveryProtocol>] [-LinkDiscoveryProtocolOperation <LinkDiscoveryOperation>] [-MaxPorts <Int32>] [-Mtu <Int32>] [-Notes <String>] [-NumUplinkPorts <Int32>] [-Version <String>] [-VDSwitch] <VDSwitch[]> [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>] Set-VDSwitch -BackupPath <String> [-WithoutPortGroups] [-VDSwitch] <VDSwitch[]> [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>] Set-VDSwitch -RollBackConfiguration [-VDSwitch] <VDSwitch[]> [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>] In the next example, we will set almost every property for VDSwitch1 that you can set using PowerShell. We will use a PowerShell technique called splatting to create a parameter list for the Set-VDSwitch cmdlet. The parameter list will be a hash table called $Parameters. By using the splat operator @,you can add the parameters in the $Parameters hash table to the Set-VDSwitchcmdlet call. When you use splatting, you have to use the name of the variable containing the parameter's hash table without the dollar sign, that is, @Parameters and not @$Parameters. PowerCLI C:> $VDSwitch = Get-VDSwitch -Name vDSWitch1 PowerCLI C:> $Parameters = @{ >> NumUplinkPorts = 2 >> MaxPorts = 1024 >> LinkDiscoveryProtocol = 'LLDP' >> LinkDiscoveryProtocolOperation = 'Both' >> ContactName = 'vsphereadmin@blackmilktea.com' >> ContactDetails = 'New York office' >> Notes = 'VDSwitch for New York datacenter' >> } >> $VDSwitch | Set-VDSwitch @Parameters >> Get-VDSwitch -Name vDSWitch1 | Format-List -Property * >> Name NumPorts Mtu Version Vendor ------------------------------------------------------------- VDSwitch1 0 1500 5.5.0 VMware LinkDiscoveryProtocol : LLDP LinkDiscoveryProtocolOperation : Both VlanConfiguration : Name : VDSwitch1 ExtensionData : VMware.Vim. VmwareDistributedVirtualSwitch NumPorts : 0 Key : 6c 48 12 50 ca 61 ec be-4d a8 bb 95 d0 0f bd a7 Mtu : 1500 Notes : VDSwitch for New York datacenter Datacenter : New York NumUplinkPorts : 4 ContactName : vsphereadmin@blackmilktea.com ContactDetails : New York office Version : 5.5.0 Vendor : VMware Folder : network MaxPorts : 1024 Id : VmwareDistributedVirtualSwitch-dvs-182 Uid : /VIServer=root@192.168.0.132:443/Distrib utedSwitch=VmwareDistributedVirtualSwitch-dvs-49/ Client : VMware.VimAutomation.Vds.Impl. V1.VDClientImpl The following screenshot of the vSphere Web Client shows the settings of the Distributed Switch VDSwitch1 after executing the previous commands: Rolling back the configuration of a vSphere Distributed Switch If you made a mistake in the configuration of a vSphere Distributed Switch, then you can roll back the configuration to its previous state using the Set-VDSwitch –RollbackConfiguration parameter In the following example, we will modify the MTU size of the switch VDSwitch1to 9,000, and then use the –RollbackConfigurationparameter to revert to the previous value of 1,500: PowerCLI C:> Get-VDSwitch -Name VDSwitch1 | >> Set-VDSwitch -MTU 9000 >> Name NumPorts Mtu Version Vendor -------------------------------------------------------------- VDSwitch1 0 9000 5.5.0 VMware PowerCLI C:> Get-VDSwitch -Name VDSwitch1 | >> Set-VDSwitch –RollbackConfiguration >> Name NumPorts Mtu Version Vendor ------------------------------------------------------------ VDSwitch1 0 1500 5.5.0 Importing the configuration of a vSphere Distributed Switch from a backup You can import the configuration of a vSphere Distributed Switch from a backup created with the Export-VDSwitch cmdlet. Later in this article, you will learn how to create a backup. In this section, we will show you how to restore the configuration from a backup. You have to use the Set-VDSwitch -BackupPath parameter to specify the path to the configuration .zip file. You can also use the –WithoutPortGroups parameter if you don't want to restore the port groups. In the next example, we will import the configuration of VDSwitch1 from a backup file called 'c:myVDSwitch1Config.zip': PowerCLI C:> Get-VDSwitch -Name 'VDSwitch1' | >> Set-VDSwitch -BackupPath 'c:myVDSwitch1Config.zip' >> Restoring vSphere distributed switch configuration - Switch name: 'VDSwitch1', Switch version: 5.5.0, Number of port groups: 0, Number of resource pools: 8, Number of uplinks: 1, Notes: My VDSwitch1 configuration Name NumPorts Mtu Version Vendor ------------------------------------------------------------- VDSwitch1 0 1500 5.5.0 Upgrading a vSphere Distributed Switch In every new VMware vSphere version, VMware introduces new features to the vSphere Distributed Switch. To be able to use these new features, you have to upgrade your switches to the new version. In the next example, we will upgrade the version of the VDSwitch4 switch to 5.5.0: PS C:> $VDSwitch = Get-VDSwitch -Name VDSwitch4 PS C:> $VDSwitch Name NumPorts Mtu Version Vendor ---------------------------------------------------------------- VDSwitch4 0 1500 4.1.0 VMware PS C:> $VDSwitch | Set-VDSwitch -Version 5.5.0 Name NumPorts Mtu Version Vendor --------------------------------------------------------------- VDSwitch4 0 1500 5.5.0 VMware Adding hosts to vSphere Distributed Switches After creating a vSphere Distributed Switch, you have to add hosts to the switch. Normally, you add at least all of the hosts that are in the same cluster. Because a vSphere Distributed Switch is created in a datacenter or a folder, a vSphere Distributed Switch is not limited to one cluster. You can add hosts of multiple clusters to the same switch. The Add-VDSwitchVMHost cmdlet will add hosts to a vSphere Distributed Switch. The syntax of this cmdlet is as follows: Add-VDSwitchVMHost -VDSwitch <VDSwitch> -VMHost <VMHost[]> [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>] In the next example, we will add all of the hosts of the cluster "Cluster01" to the vSphere Distributed Switch "VDSwitch1": PowerCLI C:> $VMHost = Get-Cluster Cluster01 | Get-VMHost PowerCLI C:> Add-VDSwitchVMHost -VDSwitch VDSwitch1 -VMHost $VMHost
Read more
  • 0
  • 0
  • 7980

Packt
10 Feb 2014
8 min read
Save for later

XamChat – a Cross-platform App

Packt
10 Feb 2014
8 min read
(For more resources related to this topic, see here.) Describing our sample application concept The concept is simple: a chat application that uses a standard Internet connection as an alternative to sending text messages. There are several popular applications like this in the Apple App Store, probably due to the cost of text messaging and support for devices such as the iPod Touch or iPad. This should be a neat real-world example that could be useful for users, and will cover specific topics in developing applications for iOS and Android. Before starting with the development, let's list the set of screens that we'll need: Login / sign up: This screen will include a standard login and sign-up process for the user List of conversations: This screen will include a button to start a new conversation List of friends: This screen will provide a way to add new friends when we start a new conversation Conversation: This screen will have a list of messages between you and another user, and an option to reply A quick wireframe layout of the application would help us grasp a better understanding of the layout of the app. The following figure shows the set of screens to be included in your app: Developing our model layer Since we have a good idea of what the application is, the next step is to develop the business objects or model layer of this application. Let's start out by defining a few classes that would contain the data to be used throughout the app. It is recommended, for the sake of organization, to add these to a Models folder in your project. Let's begin with a class representing a user. The class can be created as follows: public class User {   public int Id { get; set; }   public string Username { get; set; }   public string Password { get; set; } } Pretty straightforward so far; let's move on to create classes representing a conversation and a message as follows: public class Conversation {   public int Id { get; set; }   public int UserId { get; set; }   public string Username { get; set; } } public class Message {   public int Id { get; set; }   public int ConversationId { get; set; }   public int UserId { get; set; }   public string Username { get; set; }   public string Text { get; set; } } Notice that we are using integers as identifiers for the various objects. UserId is the value that would be set by the application to change the user that the object is associated with. Now let's go ahead and set up our solution by performing the following steps: Start by creating a new solution and a new C# Library project. Name the project as XamChat.Core and the solution as XamChat. Next, let's set the library to a Mono / .NET 4.5 project. This setting is found in the project option dialog under Build | General | Target Framework. You could also choose to use Portable Library for this project, Writing a mock web service Many times when developing a mobile application, you may need to begin the development of your application before the real backend web service is available. To prevent the development from halting entirely, a good approach would be to develop a mock version of the service. First, let's break down the operations our app will perform against a web server. The operations are as follows: Log in with a username and password. Register a new account. Get the user's list of friends. Add friends by their usernames. Get a list of the existing conversations for the user. Get a list of messages in a conversation. Send a message. Now let's define an interface that offers a method for each scenario. The interface is as follows: public interface IWebService {   Task<User> Login(string username, string password);   Task<User> Register(User user);   Task<User[]> GetFriends(int userId);   Task<User> AddFriend(int userId, string username);   Task<Conversation[]> GetConversations(int userId);   Task<Message[]> GetMessages(int conversationId);   Task<Message> SendMessage(Message message); } As you see, we're using asynchronous communication with the TPL(Task Parallel Library) technology. Since communicating with a web service can be a lengthy process, it is always a good idea to use the Task<T> class for these operations. Otherwise, you could inadvertently run a lengthy task on the user interface thread, which would prevent user inputs during the operation. Task is definitely needed for web requests, since users could easily be using a cellular Internet connection on iOS and Android, and it will give us the ability to use the async and await keywords down the road. Now let's implement a fake service that implements this interface. Place classes such as FakeWebService in the Fakes folder of the project. Let's start with the class declaration and the first method of the interface: public class FakeWebService {   public int SleepDuration { get; set; }   public FakeWebService()   {     SleepDuration = 1;   }   private Task Sleep()   {     return Task.Delay(SleepDuration);   }   public async Task<User> Login(     string username, string password)   {     await Sleep();     return new User { Id = 1, Username = username };   } } We started off with a SleepDuration property to store a number in milliseconds. This is used to simulate an interaction with a web server, which can take some time. It is also useful for changing the SleepDuration value in different situations. For example, you might want to set this to a small number when writing unit tests so that the tests execute quickly. Next, we implemented a simple Sleep method to return a task that introduce delays of a number of milliseconds. This method will be used throughout the fake service to cause a delay on each operation. Finally, the Login method merely used an await call on the Sleep method and returned a new User object with the appropriate Username. For now, any username or password combination will work; however, you may wish to write some code here to check specific credentials. Now, let's implement a few more methods to continue our FakeWebService class as follows: public async Task<User> Register(User user) {   await Sleep();   return user; } public async Task<User[]> GetFriends(int userId) {   await Sleep();   return new[]   {     new User { Id = 2, Username = "bobama" },     new User { Id = 2, Username = "bobloblaw" },     new User { Id = 3, Username = "gmichael" },   }; } public async Task<User> AddFriend(   int userId, string username) {   await Sleep();   return new User { Id = 4, Username = username }; } For each of these methods, we kept in mind exactly same pattern as the Login method. Each method will delay and return some sample data. Feel free to mix the data with your own values. Now, let's implement the GetConversations method required by the interface as follows: public async Task<Conversation[]> GetConversations(int userId) {   await Sleep();   return new[]   {     new Conversation { Id = 1, UserId = 2 },     new Conversation { Id = 1, UserId = 3 },     new Conversation { Id = 1, UserId = 4 },   }; } Basically, we just create a new array of the Conversation objects with arbitrary IDs. We also make sure to match up the UserId values with the IDs we've used on the User objects so far. Next, let's implement GetMessages to retrieve a list of messages as follows: public async Task<Message[]> GetMessages(int conversationId) {   await Sleep();   return new[]   {     new Message     {       Id = 1,       ConversationId = conversationId,       UserId = 2,       Text = "Hey",     },     new Message     {       Id = 2,       ConversationId = conversationId,       UserId = 1,       Text = "What's Up?",     },     new Message     {       Id = 3,       ConversationId = conversationId,       UserId = 2,       Text = "Have you seen that new movie?",     },     new Message     {       Id = 4,       ConversationId = conversationId,       UserId = 1,       Text = "It's great!",     },   }; } Once again, we are adding some arbitrary data here, and mainly making sure that UserId and ConversationId match our existing data so far. And finally, we will write one more method to send a message as follows: public async Task<Message> SendMessage(Message message) {   await Sleep();   return message; } Most of these methods are very straightforward. Note that the service doesn't have to work perfectly; it should merely complete each operation successfully with a delay. Each method should also return test data of some kind to be displayed in the UI. This will give us the ability to implement our iOS and Android applications while filling in the web service later. Next, we need to implement a simple interface for persisting application settings. Let's define an interface named ISettings as follows: public interface ISettings {   User User { get; set; }   void Save(); } Note that you might want to set up the Save method to be asynchronous and return Task if you plan on storing settings in the cloud. We don't really need this with our application since we will only be saving our settings locally. Later on, we'll implement this interface on each platform using Android and iOS APIs. For now, let's just implement a fake version that will be used later when we write unit tests. The interface is created by the following lines of code: public class FakeSettings : ISettings {   public User User { get; set; }   public void Save() { } } Note that the fake version doesn't actually need to do anything; we just need to provide a class that will implement the interface and not throw any unexpected errors. This completes the Model layer of the application. Here is a final class diagram of what we have implemented so far:
Read more
  • 0
  • 0
  • 4578

Packt
06 Feb 2014
6 min read
Save for later

Bitcoins – Pools and Mining

Packt
06 Feb 2014
6 min read
(For more resources related to this topic, see here.) Installing Bitcoind Bitcoind is the software that connects you to other nodes in the network. There is no single point of failure, and the more nodes there are the faster and more secure the network becomes. Peers are rewarded with a transaction fee for the first validation of a transaction and are assigned randomly. After installing Bitcoind by using the following command, we have to synchronize it with the network, which means downloading millions of transactions exceeding a gigabyte in size to your Pi. sudo apt-get install bitcoind Before running the background daemon, you need to consider changing the data directory as the database files can take up many gigabytes of space. Mount a new storage place and always start Bitcoind with the following line: bitcoind –datadir /mnt/HDD/bitcoin –daemon After a few minutes, you can type in the following basic commands. You will need to wait until the entire block chain data is downloaded before you can do anything useful. During this time, the Pi might become less responsive, use a lot of bandwidth, and create a large amount of data in the data directory. This can take up to 12 hours. bitcoind getinfobitcoind getblockcount If you already have most of the block chain data downloaded on another computer, you can just copy all the data to the Pi. You can even have the same wallet and addresses in both locations. It is not recommended though, as that means it's twice as easy for hackers to get your wallet. Always encrypt your wallet with a very strong password and keep the password and wallet backup in a safe, offline place—like CDs or USB drives. If you lose the password, you lose access to the wallet, forever. Bitcoin wallet You need to generate addresses where other people can send you funds. Theoretically, you can generate an unlimited number of addresses, but practically managing all those addresses would become difficult. Bitcoin, by default, allows you to have a hundred addresses. You always get a default wallet address, which counts as the first address, and this address will receive network fees if you process any transactions for the first time. Cryptocurrency transactions cannot be reversed. Sending coins to the incorrect address means your coins will be lost forever. On the other hand, it also protects you if you are receiving coins from somebody else, as they cannot reverse the transaction. These addresses are globally unique, and can never be generated by anybody else in the universe or beyond it. It can get stolen by hackers or viruses, though. Imagine losing your wallet in real life. Unless a kind person returns it to you, the contents of that wallet will be lost forever. You can back up your wallet file, but you should store it on any two USB flash drives or CDs, and store it in a safety deposit box at home or in the bank. You should never be tempted to copy your wallet to any kind of online storage or backup services, especially if it's unencrypted. Creating a Bitcoin address These examples will work with the command line, as you can re-use them to display data on your web server. All online wallets use the Bitcoind API to generate addresses and manage your wallet. As a word of warning, you should never use online wallet services as almost all of them have been hacked, resulting in massive numbers of coins getting stolen. You can download the Bitcoin-QT client and run it in X if you prefer an easy way to manage your wallet. The following command lines will create a new receiving address and then list all your addresses: bitcoind getnewaddressbitcoind listaccounts Receiving Bitcoins As long as you know your address, people can send you Bitcoins. You do not need to have Bitcoind running all the time as the transactions are processes and are stored in the network. It is just very important to keep a backup of your wallet.dat file if you want to send the Bitcoins somewhere else, like an online exchange. Sending Bitcoins As long as you have coins in your wallet, you can easily send coins to another address by using the sendtoaddress command followed by the address and the amount. Here is an example sending 0.01 Bitcoins to the author's tip jar: bitcoind sendtoaddress 126HA8L1dP7fr7ECu2oEMtz6JpDRnzqp9N 0.01 You will get a response, which is a transaction ID. If you do not, the transaction has failed. You need to have at least 0.0001 Bitcoins reserved for the transaction fees. If you are sending large amounts of coins, this transaction fee will also become more expensive. The value of Bitcoins In July 2010, the value of Bitcoin was below 1 USD. Investing in Bitcoins was very controversial and a huge risk, since it was difficult to predict if the currency would be accepted or rejected by the community. As of writing this article, the Bitcoin value has exceeded 1100 USD. You can search the Internet and find interesting articles on early adopters mining Bitcoins, or buying a few hundred dollars and leaving their wallets lying around. Just like one person in the UK who threw away his hard drive with 7500 BTC stored on it. After going public, thousands of people flocked to the public dump ground to search for the hard drive. Other stories include a student who invested a few hundred dollars in 2010, and sold them for hundreds of thousands of dollars. With such large amounts, it is important to consult your local TAX authority or council. The trend seems to be that the more people find out about Bitcoins and the more media publicity it gets, the higher the value of the currency rises. This also looks like it applies to alternative currencies such as Litecoin. Summary We have seen what Bitcoin is. We have seen what are the uses of Bitcoins and also it's value. We have also seen how to send and receive Bitcoins. I hope this has given you a better idea about what Bitcoins really are. Resources for Article: Further resources on this subject: Clusters, Parallel Computing, and Raspberry Pi – A Brief Background [Article] Creating a file server (Samba) [Article] Our First Project – A Basic Thermometer [Article]
Read more
  • 0
  • 0
  • 21068

article-image-article-managing_your_social_channels
Packt
28 Jan 2014
3 min read
Save for later

Managing your social channels

Packt
28 Jan 2014
3 min read
(For more resources related to this topic, see here.) Targeted traffic is the lifeline of any website or blog. Most people rely on search engines for their traffic; but, when your social media channels are optimized properly, they can drive a huge amount of targeted traffic to your website or blog. Getting ready Blogs came way before Facebook, Twitter, and Google+, and they're still going strong. Every time you blog, you get a chance to get another one of your pages indexed by Google. Let's have a look at how we can use the Blog tool provided by HubSpot. How to do it... Make sure the title of your blog contains the relevant keywords. Now, in the Content tab, select Blog from the drop-down list as shown in the following screenshot: Now, select the Create Article option, which is located right under the Using the HubSpot Blog section, as shown in the following screenshot: If you look at the right-hand side of your browser now, HubSpot will be trying to help you out by displaying the important elements that are missing from the blog. Start filling in all those elements one-by-one. Enter your keyword-rich blog title in the textbox named Title and your content in the text area named Article Body. A blog should contain no fewer than 500 words. Use the options Bold, Italic, and Underline whenever required. Avoid writing a full-length essay. Try to use subheadings, numbers, and bullets. An image can speak a thousand words. Make sure you insert a relevant image for your blog, as images have the ability to drive decent traffic to your blog or website. Don't forget to give a relevant name and alt text attribute for the image you attach along with the keywords you identified. You can also select the option Left, Right, or Center depending upon where you want the image to be displayed in your blog. Make sure the tags you add are relevant to the blog. Tags are generally used in a blog to make it easier for the reader to identify the topic they are looking for. Once you are done with the tags, click on the Publish button to make your blog go live as shown in the following screenshot: Summary In this article we learned about using a Blog tool provided by HubSpot to manage our social channel. Resources for Article: Further resources on this subject: Clojure for Domain-specific Languages - Design Concepts with Clojure [Article] Cross-browser-distributed testing [Article] Working with Dashboards in Dynamics CRM [Article]
Read more
  • 0
  • 0
  • 1446
Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €18.99/month. Cancel anytime
Packt
27 Jan 2014
5 min read
Save for later

Understanding Citrix®Provisioning Services 7.0

Packt
27 Jan 2014
5 min read
(For more resources related to this topic, see here.) The following diagram provides a high-level view of the basic Provisioning Services infrastructure and clarifies how Provisioning Services components might appear within the datacenter post installation and implementation: Provisioning Service License server The License Server either should be installed within the shared infrastructure or an existing Citrix license server can be selected. However, we have to ensure the Provisioning Service license is configured in your existing Citrix Enterprise License servers. A License Server can be selected when the Provisioning Service Configuration Wizard is run on a planned server. All Provisioning Servers within the farm must be able to communicate with the License Server. Provisioning Service Database server The database stores all system configuration settings that exist within a farm. Only one database can exist within a provisioning service farm. We can choose an existing SQL Server database or install an SQL Server in cluster for High Availability from a redundancy business continuities perspective. The Database server can be selected when the Provisioning Service Configuration Wizard runs on a planned server. All Provisioning Servers within the farm must be able to communicate with the Database server, and only one database can exist within a Provisioning Service farm Provisioning Service Admin Console Citrix Provisioning Service Admin Console is a tool that is used to control your Provisioning Services implementation. After logging on to the console, we can select the farm that we want to connect to. Our role determines what we can look at in the console and operate in the Provisioning Service farm. Shared storage service Citrix Provisioning Service requires shared storage for vDisks that are accessible by all of the users in a network. They are intended for file storage and allowing simultaneous access by multiple users without the need to replicate files to their machines' vDisk. The supported shared storages are SAN, NAS, iSCSI, and CIFS. Active Directory Server Citrix Provisioning service requires Microsoft's Active Directory. It provides authentication and authorization mechanisms as well as a framework, within which other related services can be deployed. Microsoft Active Directory is an LDAP-compliant database that contains objects. The most commonly used objects are users, computers, and groups Network services Dynamic Host Control Protocol (DHCP) is used for the purpose of getting IP addresses for servers and systems. Trivial File Transfer Protocol (TFTP) is used for automated transfer of boot configuration files between servers and a system in a network. Preboot Execution Environment (PXE) is a standard used for client/server interface that allows networked computers that boot remotely to boot locally instead. System requirements Citrix Provisioning Service can be installed with following requirements: Citrix Provisioning Server Requirement Description Operation system Windows 2012: Standard, Essential, and Datacenter editions; Windows 2008 R2; Windows 2008 R2 SP1: Standard, Enterprise, and DataCenter editions; and all editions of Windows 2008 (32 or 64-bit) Processor Intel or AMD x86 or x64 compatible 2 GHz / 3 GHz (preferred) / 3.5 GHz Dual Core / HT or an equal one for growing capacity fulfiller Memory 2 GB RAM; 4 GB (greater than 250 vDisks) Hard disk To determine IOPS needed along RAID Level, please plan your sizing based on the following formula: Total Raw IOPS = Disk Speed IOPS x # of Disks Functional IOPS = ((Total Raw IOPS * Write %)/RAID Penalty ) + (Total Raw IOPS*Read %) For more, please refer to http://support.citrix.com/servlet/KbServlet/download/24559-102-647931/ Network adapter IP assignment to servers should be static. 1 GB is recommended for less than 250 target devices. If you are planning for more than 250 devices, Dual 1 GB is recommended. For High Availability, please have two NICs for redundancy purposes. Pre-requisite software components Microsoft .NET 4.0 and Microsoft Powershell 3.0 loaded on a fresh OS The Infrastructure components required are described as follows: Requirement Description Supported database Microsoft SQL 2008, Microsoft SQL 2008 R2, and Microsoft SQL 2012 Server (32-bit or 64-bit editions) databases can be used for the Provisioning ServicesDB sizing. Please refer to http://msdn.microsoft.com/en-us/library/ms187445.aspx. For HA Planning, please refer to http://support.citrix.com/proddocs/topic/provisioning-7/pvs-installtask1-plan-6-0.html. Supported hypervisor XenServer 6.0, Microsoft SCVMM 2012 SP1 with Hyper-V 3.0; SCVMM 2012 with Hyper-V 2.0, VMware ESX 4.1, ESX 5, or ESX 5 Update 1; vSphere 5.0, 5.1, 5.1 Update 1; along with Physical Devices for 3D Pro Graphics (Blade Servers, Windows Server OS machines, and Windows Desktop OS machines with XenDesktop VDA installed). Provisioning Console Hardware requirement: Processor 2 GHz, Memory 2 GB ,Hard Disk 500 MB Supported Operating Systems: all editions of Windows Server 2008 (32-bit or 64- bit); Windows Server 2008 R2: Standard, DataCenter, and Enterprise editions; Windows Server 2012: Standard, Essential, and Datacenter editions; Windows 7 (32-bit or 64-bit); Windows XP Professional (32-bit or 64-bit); Windows Vista (32-bit or 64-bit): Business, Enterprise, and Ultimate (retail licensing); and all editions of Windows 8 (32-bit or 64-bit). Pre-Requisite Software: MMC 3.0, Microsoft .NET 4.0, and Windows PowerShell 2.0 In case we are using Provisioning Services, we would require XenDesktop and, NET 3.5 SP1, and in the event that we are using Provisioning Services then we would require SCVMM 2012 SP1 and PowerShell 3.0. Supported ESD Apply only in case VDisk Update Management is used; ESD supports WSUS Server-3.0 SP2 and Microsoft System Center Configuration Management 2007 SP2, 2012, and 2012 SP1 Supported target device Supported Operating Systems: all editions of Windows 8 (32 or 64-bit); Windows 7 SP1 (32 bits or 64 bits): Enterprise, Professional, and Ultimate (Support alone in Private Mode); Windows XP Professional SP3 32-bit and Windows XP Professional SP2 64-bit; Windows Server 2008 R2 SP1: Standard, DataCenter, and Enterprise editions; Windows Server 2012: Standard, Essential, and Datacenter editions. Summary This article has thus covered the several components that make up a Citrix Provisioning Services farm and the system requirements that need to be met to run the software. Resources for Article: Further resources on this subject: Introduction to XenConvert [article] Citrix XenApp Performance Essentials [article] Getting Started with XenApp 6 [article]
Read more
  • 0
  • 0
  • 4746

article-image-diagnostic-leveraging-accelerated-poc-crm-online-service
Packt
24 Jan 2014
16 min read
Save for later

Diagnostic leveraging of the Accelerated POC with the CRM Online service

Packt
24 Jan 2014
16 min read
(For more resources related to this topic, see here.) For customers considering Dynamics CRM solutions, online or on-premises, Sure Step introduced a service called Accelerated Proof of Concept with CRM Online. This service was designed to take advantage of free trial licenses that can be afforded to prospective customers, giving them the ability to "test drive" the CRM Online solution on their own before deciding to move forward with solution envisioning and solution acquisition. Microsoft Dynamics is one of the unique solution providers in the world to give customers the same foundational code base for both on-premises and online solutions. Thus, customers may validate the functionality on CRM Online and still choose to deploy the on-premises solution if they so desire. Hence this Sure Step service is titled Accelerated POC with CRM Online as opposed to for CRM Online solutions only. The activity flow of the Accelerated POC with CRM Online service is shown in the following diagram: The conceptual design behind this service was to provide some standard scenarios to customers. Customers would then have the ability to upload their own dataset for these scenarios, giving them the ability to quickly validate the corresponding CRM functionality and get a comfort feel for the Dynamics CRM product. To start with, the Microsoft Services team developed five out-of-box Sales Force Automation (SFA) scenarios that encompassed basic workflows for the following: Lead capture Lead allocation/routing Opportunity management Quote/contract development Contract conversion The SFA scenarios were made available to the Dynamics partner ecosystem via the CRM Marketplace in the form of a Quick Start package. Besides the solution setup for the scenarios, the package also included a delivery guide, demo scripts, and sample data that could be used as a building block for a customer Proof of Concept for the corresponding scenarios. Using the previously discussed materials, solution providers could execute high-level requirements and Fit Gap reviews in the first step of this service. If one or more of the scenarios fits with the customer needs, the solution provider can conduct a preliminary business value assessment to get an initial gauge of the solution benefits as well as an architecture assessment to determine how the customer's users would access the system. Following that, the provider's team would set up the system with customer data and turn it over to the customer's assigned users, who could use the remainder of the free trial licenses to test the system. The idea of giving the customer's users a setup with their own data was to make it that much more intuitive to them in testing and evaluating a new system. The Accelerated POC concept can be leveraged for scenarios besides the five noted if the solution providers develop other predefined scenarios that they commonly encounter in customer engagements and then follow the process previously noted. The Accelerated POC scenarios can also be leveraged as starting points for customer demonstrations of the CRM solution. It also bears mention that the Accelerated POC was designed to get a quick win for the sales team with a customer by affording them hands-on experience on a limited subset of the CRM functionality. When the customer feels comfortable with that aspect of the solution, the solution provider may avail of the other Decision Accelerator Offering services previously discussed, including Requirements and Process Review, Fit Gap and Solution Blueprint, Architecture Assessment, and Scoping Assessment, to determine the scope of the full solution required for the customer. The Diagnostic phase for a current Dynamics customer We covered the Sure Step Diagnostic phase guidance for a new or prospective Dynamics customer. The Diagnostic phase also supports the process for due diligence and solution selling process for an existing Dynamics customer, which is the topic of discussion in this article. The following diagram shows the flow of activities and services of the Decision Accelerator Offering for an existing customer. The flow is very similar to the one for a prospect, with the only difference being the Upgrade Assessment DA service replacing the Requirements and Process Review DA service. Much like the flow for a prospect, the flow for the existing customer begins with the Diagnostic preparation. In this case, however, the sales team uses the guidance to explain the capabilities and features of the new version of the corresponding Microsoft Dynamics solution. When the customer expresses interest in moving their existing solution to the current version of the solution, the next step is the Upgrade Assessment DA service. Assessing the upgrade requirements The services delivery team has two primary objectives when executing the Upgrade Assessment DA service. First, the delivery team assesses the current solution to determine the impact of the proposed upgrade. Second, they determine the optimal approach to upgrade the solution to the current version. The Upgrade Assessment DA service begins with the solution delivery team meeting with the customer to understand the requirements for the upgrade. The solution delivery team is usually comprised of solution and/or service sales executives as well as solution architects and senior application consultants to provide real-life perspectives to the customer. Sure Step provides product-specific questionnaires that can be leveraged for the Upgrade Assessment exercise, including upgrade questionnaires for Microsoft Dynamics AX, CRM, CRM Online, GP, NAV, and SL. In future releases, the Upgrade questionnaires for AX may be replaced by the Upgrade Analysis tool from the new Microsoft Dynamics R&D Lifecycle Services. In the next step, the solution architect and/or application consultants review the configurations, customizations, integrations, physical infrastructure, and system architecture of the customer's existing solution. The team then proceeds to highlight those requirements that can be met by the new feature enhancements and determine whether there are any customizations that may no longer be necessary in the new product version. The team also reviews the customizations that will need to be promoted to the upgraded solution and identifies any associated complexities and risks involved in upgrading the solution. Finally, the team will clearly delineate those requirements that are met by current functionality and those that require implementation of new functionality. For the new functionality, the delivery team can avail of the corresponding product questionnaires from the Requirements and Process Review DA service. The last step in the Upgrade Assessment DA service is to agree upon the delivery approach for the upgrade. If no new functionality is deemed necessary as part of the upgrade, the solution can use the Technical Upgrade project type guidance, workflow, and templates. On the other hand, if a new functionality is deemed necessary, it is recommended that you use a phased approach, in which the first release is a Technical Upgrade to bring the solution to the current product version, and then the ensuing release or releases implement the new functionality using the other Sure Step project types (Rapid, Standard, Enterprise, or Agile). Applying the other Decision Accelerator Offerings services to upgrade engagements If the upgrade is strictly to promote the solution to a current, supported release of the product, the solution delivery team can skip the Fit Gap and Solution Blueprint exercise and go to the Architecture Assessment DA service to determine the new hardware and infrastructure requirements and the Scoping Assessment DA service to estimate the effort for the upgrade. The team may also choose to combine all these services into a single offering and just use the templates and tools from the other offerings to provide the customer with a Statement of Work and Upgrade estimate. If the upgrade is going to introduce a new functionality, depending on the magnitude of the new requirements, the customer and sales teams may deem it necessary to execute or combine the Fit Gap and Solution Blueprint, Architecture Assessment, and Scoping Assessment DA services. This ensures that a proper blueprint, system architecture, and overall release approach is collectively discussed and agreed upon by both parties. In both cases, the Proof of Concept DA and Business Case DA services may not be necessary, although depending on the scope of the new functionality being introduced in the upgrade, the customer and sales teams may decide to use the Business Case tools to ensure that project justification is established. After the completion of the necessary DA services, the sales team can proceed to the Proposal Generation activity to establish the Project Charter and Project Plan. The next step is then to complete the sale in the Final Licensing and Services Agreement activity, including agreeing upon the new terms of the product licenses and the Statement of Work for the solution upgrade. Finally, the delivery team is mobilized in the Project Mobilization activity to ensure that the upgrade engagement is kicked off smoothly. Supporting the customer's buying cycle The Sure Step Diagnostic phase is designed to help the seller in the solution provider organizations and the buyer in the customer organizations. We also covered the applicability of the phase to the seller; in this article, we will talk about how the customer's due diligence efforts are enabled with a thorough process for selecting the right solution to meet their vision and requirements. We discussed the stages that correspond to the customer's buying cycle. The following diagram shows how the same Sure Step Diagnostic phase activities and Decision Accelerator Offerings that we applied to the solution selling process also align with the phases of the customer's buying cycle: Phase I: Need Determination The Solution Overview activity The Requirements and Process Review Decision Accelerator service Phase II: Alternatives Evaluation The Fit Gap and Solution Blueprint Decision Accelerator service The Architecture Assessment Decision Accelerator service The Scoping Assessment Decision Accelerator service Phase III: Risk Evaluation The Proof of Concept Decision Accelerator service The Business Case Decision Accelerator service The Proposal Generation activity Let's first begin by addressing the application of the Decision Accelerator Offering and its services to a customer's perspective. From a seller's perspective, the term offering can be viewed as a sellable unit. But the term Decision Accelerator on the other hand, extends beyond the seller to the customer, as the intent of these units is to help them get expedient answers to their questions and move their decision making process forward in a logical and structured manner. In that context, the Decision Accelerator Offerings term is very much applicable to the customer as well. The following sections will discuss the alignment of the activities and Decision Accelerator Offering services to the customer's buying cycle. If the reader has not already done so, they are encouraged to review the previous sections to understand the constructs of the Decision Accelerator Offering services as that is not repeated in this article. Defining organizational needs The buyer starts their Need Determination phase by understanding the organizational pain points and gathering information on solutions available in the marketplace. The guidance links to additional websites and other information sources in the Diagnostic preparation activity can help address the solution information gathering effort. If the customer's organization operates in an industry covered by Sure Step, they can also gain additional information on how the solution relates to their specific needs in the industry sections. While the guidance in the Diagnostic preparation activity provides the customer with the external awareness of available solutions, the Sure Step Requirements and Process Review Decision Accelerator service facilitates the customer's understanding of their own internal needs. Using the role-tailored questionnaire templates in this offering, Subject Matter Experts (SMEs) from the customer team can work through "a-day-in-the-life-of" scenarios for each of the roles so that they can quantify the departmental and organizational needs from a user perspective, rather than from only a product perspective. Customers can also use detailed process maps as a starting point, especially the new BPM tool to begin visualizing the organization's workflow with the new solution. Again, this helps the customer describe their needs from a user's perspective. Ultimately, the success or failure of a solution is determined by how applicable or pertinent it is to the user, so this point cannot be overemphasized. The documentation of the requirements and to-be processes forms the basis for the future solution vision. Depending on how they are developed, the customer organization can leverage these documents to conduct a thorough evaluation of the solution alternatives and select the best solution to meet their needs. Determining the right solution After the needs are determined, the buyer begins evaluations of the solution alternatives. This is where the Sure Step Fit Gap and Solution Blueprint, Architecture Assessment, and Scoping Assessment Decision Accelerator services can help the customer determine whether the Microsoft Dynamics solution is the right one for them. As discussed in the earlier section, the Fit Gap and Solution Blueprint DA exercise begins by determining the Degree of Fit of the solution to each of the requirements. Some customers may desire a higher value of the Degree of Fit so as to minimize customizations, while others may be operating in a specialized environment that necessitates a fairly customized solution, and as such, they may be comfortable with a lower value of the Degree of Fit. However, in both the scenarios, the customer will want to ensure that their TCO for the solution is acceptable. Following the determination of the solution fit, the customer SMEs will work with the solution provider to develop the blueprint for the future solution. The solution blueprint is typically presented to the customer's executive or business sponsor. As such, the document should be written in business language and should clearly explain how the business needs or pains will be met or resolved by the proposed solution. Armed with the solution blueprint, the buyer then obtains other key information to evaluate whether the solution meets their cost criteria. The Architecture Assessment DA service will provide the customer with the proposed hardware and architecture, with which the customer's procurement department can determine the physical infrastructure costs. Should the customer have any concerns regarding performance, scalability, and reliability of the solution, they can also request more technical validation from the service provider by requesting more detailed analysis in the corresponding areas. Finally, the Scoping Assessment DA service provides the customer business sponsor with the effort estimate and the associated costs for solution delivery. This exercise also provides the customer with the understanding of the overall approach to delivering the solution, including timelines and projected resources, roles, and responsibilities. Understanding and mitigating risks In the last phase of their buying cycle, the customer will want assurances that the projected solution benefits far outweigh the associated risks. The Sure Step Proof of Concept Decision Accelerator service can help allay any specific concerns for the customer's SMEs or departmental leads around a certain area of the solution. The solution delivery team will set up, configure, and customize the solution and will use customer data where possible to show that the application of the solution matches the customer's requirements. Any solution efforts executed in this offering are then carried over to the implementation and become the starting point for solution delivery. The Sure Step Business Case Decision Accelerator service also helps the customer in this phase of their buying cycle, but more from the perspective of managing the executive and organizational buy-in for the solution. Using an independent analyst-developed ROI tool, this service can help the customer team justify the acquisition of the solution to other key stakeholders in the organization such as the CEO, CFO, or the board of directors. This can be a key step to counter organizational politics, and it can also be very important during the inevitable ebbs and flows of a solution delivery cycle. Finally, the Sure Step Proposal Generation activity provides the customer sponsor and customer project manager with the overall project charter and project plan, ensuring that they have clear documentation of what has been agreed upon between the buyer and the seller to avoid any assumptions or misunderstandings down the line. The project charter will also identify the risks associated with solution delivery and should outline a mitigation strategy for each of them. The project charter developed by the solution provider may also note any dependencies or assumptions owned by the customer; the customer should ensure that they have the necessary resources in place so that these dependencies do not become impediments to the delivery team. Approach to upgrade existing solutions Similar to the evaluation process for a new solution, the Sure Step Diagnostic phase also supports the due diligence process for a current customer looking to upgrade their solution. The following diagram shows a very similar flow to the new solution evaluation, with the only difference being that the Upgrade Assessment DA service now replaces the Requirements and Process Review DA service: As discussed in the earlier section, the Sure Step Upgrade Assessment Decision Accelerator service captures the business needs for the customer to change or enhance their current solution and determines the best approach to upgrade to the latest version of the solution. If the current solution includes customizations that may no longer be deemed necessary because of new features, the delivery team will identify this. They will also evaluate the complexity for the overall upgrade as well as the release process for the upgrade. The Upgrade Assessment DA exercise findings will also dictate the degree to which the customer should undertake the Fit Gap and Solution Blueprint, Architecture Assessment, Scoping Assessment, Proof of Concept, and Business Case Decision Accelerator services. Depending upon the magnitude of the new functionality desired, the customer sponsor and SMEs can decide to skip or combine the services as necessary. Regardless of how the DA Offering services are utilized, the project charter and project plan should be developed for the customer in the Proposal Generation activity. Summary This article discussed the activities and covered in detail the Decision Accelerator Offerings. It also spoke about the ways in which the Diagnostic phase sets the stage for quality implementation by outlining the risks involved. We discuss the selection of the right approach for the deployment as well as the parts that will be played by both the partner and the customer teams. Resources for Article: Further resources on this subject: An Overview of Microsoft Sure Step [Article] Foreword by Microsoft Dynamics Sure Step Practitioners [Article] Upgrading with Microsoft Sure Step [Article]
Read more
  • 0
  • 0
  • 1705

article-image-improving-proximity-filtering-knn
Packt
24 Jan 2014
7 min read
Save for later

Improving proximity filtering with KNN

Packt
24 Jan 2014
7 min read
(For more resources related to this topic, see here.) The basic question that we seek to answer in this article is the fundamental distance question, "Which are the closest (name what you are searching for) to me?", for example, "Which are the five coffee shops closest to me?" It turns out that while it is a fundamental question, it's not always easy to answer, though we will make this possible in this article. We will approach this with two approaches. The first way in which we'll approach this is in a simple heuristic, which will allow us to come to a solution quickly. Then, we'll take advantage of the deeper PostGIS functionality to make the solution faster and more general with a K-Nearest Neighbor (KNN) approach. A concept that we need to understand from the outset is that of a spatial index. A spatial index, like other database indexes, functions like a book index. It is a special construct to make looking for things inside our table easier, much in the way a book index helps us find content in a book faster. In the case of a spatial index, it helps us find faster where things are in space. Therefore, by using a spatial index in our geographic searches, we can speed up our searches by many orders of magnitude. To learn more about spatial indexes, see http://en.wikipedia.org/wiki/Spatial_index#Spatial_index. Getting ready We will start by loading our data. Our data are the address records from Cuyahoga County, Ohio, USA. shp2pgsql -s 3734 -d -i -I -W LATIN1 -g the_geom CUY_ADDRESS_POINTS chp04.knn_addresses | psql -U me -d postgis_cookbook As this dataset may take a while to load, you can alternatively load a subset. shp2pgsql -s 3734 -d -i -I -W LATIN1 -g the_geom CUY_ADDRESS_POINTS_ subset chp04.knn_addresses | psql -U me -d postgis_cookbook We specified the -I flag in order to request a spatial index be created upon the import of this data. Let us start by seeing how many records we are dealing with: SELECT COUNT(*) FROM chp04.knn_addresses; --484958 We have, in this address table, almost half a million address records, which is not an insubstantial number against which to perform a query. How to do it... KNN is an approach to searching for an arbitrary number of points closest to a given point. Without the right tools, this can be a very slow process that requires testing the distance between the point of interest and all the possible neighbors. The problem with this approach is that the search becomes exponentially slower as the number of points increases. Let's start with this naïve approach and then improve upon it. Suppose we were interested in finding 10 records closest to the geographic location, -81.738624, 41.396679. The naïve approach would be to transform this value into our local coordinate system and compare the distance to each point in the database from the search point, order those values by distance, and limit the search to the first 10 closest records (it is not recommended that you run the following query—it could run indefinitely) SELECT ST_Distance(searchpoint.the_geom, addr.the_geom) AS dist, * FROM chp04.knn_addresses addr, (SELECT ST_Transform(ST_SetSRID(ST_MakePoint(-81.738624, 41.396679), 4326), 3734) AS the_geom) searchpoint ORDER BY ST_Distance(searchpoint.the_geom, addr.the_geom) LIMIT 10; This is a fine approach for smaller datasets. This is a logical, simple, fast approach for relatively small numbers of records. This approach scales very poorly, however, getting exponentially slower with the addition of records, and with 500,000 points, this would take a very long time. An alternative is to only compare my point to the ones I know are close by setting a search distance. So, for example, in the following diagram, we have a star that represents my current location, and I want to know the 10 closest addresses. The grid in the diagram is a 100 foot grid, so I can search for the points within 200 feet, then measure the distance to each of these points, and return the closest 10 points to my search location. So far, our approach to answering this question is to limit the search using the ST_DWithin operator to only search for records within a certain distance. ST_DWithin uses our spatial index, so the initial distance search is fast and the list of returned records should be short enough to do the same pair-wise distance comparison we did earlier in this section. In our case here, we could limit the search to within 200 feet as follows. SELECT ST_Distance(searchpoint.the_geom, addr.the_geom) AS dist, * FROM chp04.knn_addresses addr, (SELECT ST_Transform(ST_SetSRID(ST_MakePoint(-81.738624, 41.396679), 4326), 3734) AS the_geom) searchpoint WHERE ST_DWithin(searchpoint.the_geom, addr.the_geom, 200) ORDER BY ST_Distance(searchpoint.the_geom, addr.the_geom) LIMIT 10; This approach performs well so long as our search window, ST_DWithin, is the right size for the data. The problem with this approach is that, in order to optimize it, we need to know how to set a search window that is about the right size. Any larger than the right size and the query will run more slowly than we'd like. Any smaller than the right size and we might not get all the points back that we need. Inherently, we don't know this ahead of time, so we can only hope for the best guess. In this same dataset, if we apply the same query in another location, the output will return no points because the 10 closest points are further than 200 feet away. We can see this in the following diagram: Fortunately, for PostGIS 2.0, we can leverage the distance operators (<-> and <#>) to do indexed nearest-neighbor searches. This makes for very fast KNN searches that don't require us to guess ahead of time how far away we need to search. Why are the searches fast? The spatial index helps, of course, but in the case of the distance operator, we are using the structure of the index itself, which is hierarchical, to very quickly sort our neighbors. When used in an ORDER BY clause, the distance operator uses the index: SELECT ST_Distance(searchpoint.the_geom, addr.the_geom) AS dist, * FROM chp04.knn_addresses addr, (SELECT ST_Transform(ST_SetSRID(ST_MakePoint(-81.738624, 41.396679), 4326), 3734) AS the_geom) searchpoint ORDER BY addr.the_geom <-> searchpoint.the_geom LIMIT 10; This approach requires no a priori knowledge of how far the nearest neighbors might be. It also scales very well, returning thousands of records in not more than the time it takes to return a few records. It is sometimes slower than using ST_DWithin, depending on how small our search distance is and how large the dataset we are dealing with. But the tradeoff is that we don't need to make a guess as to our correct search distance and for large queries, it can be much faster than the naïve approach. How it works... What makes this magic possible is that PostGIS uses an R-Tree index. This means that the index itself is sorted hierarchically based on spatial information. As demonstrated, we can leverage the structure of the index in sorting distances from a given arbitrary location and, thus, use the index to directly return the sorted records. This means that the structure of the spatial index itself helps us answer such fundamental questions quickly and inexpensively. More information about KNN and R-tree can be found at http://workshops.boundlessgeo.com/postgis-intro/knn.html and https://en.wikipedia.org/wiki/R-tree. Summary This article covered the introduction and learning of KNN filters to increase the performance of proximity queries. Now you must be quite familiar with the usage of KNN filters to increase the performance of proximity queries. Resources for Article: Further resources on this subject: PostgreSQL: Tips and Tricks [article] Backup in PostgreSQL 9 [article] Python Libraries for Geospatial Development [article]
Read more
  • 0
  • 0
  • 2315

article-image-good-time-management-casperjs-tests
Packt
24 Jan 2014
5 min read
Save for later

Good time management in CasperJS tests

Packt
24 Jan 2014
5 min read
(For more resources related to this topic, see here.) When developing with JavaScript, we often need to chain two pieces of code (for instance, first we load some JSON data, and then we update the page content using that data). But each step is generally non-blocking (meaning the rest of the code will continue to execute even if the step is not complete), and there is no way to predict when the first step will be complete. The most solid and most common approach to solve this problem is the callback mechanism. We put the second piece of code in a function, and pass it as a parameter to the first one, so that it can call this function when it finishes. As a result, there is no linear and predictably-ordered execution of the code, which makes testing a little bit tricky. The following is an example. Use case – simple place name matching with Geonames.org <html> <head> <script type='text/javascript' src = 'http://code.jquery.com/jquery-1.9.1.js'></script> <style> .searching { color: grey;} .success { color: green;} .noresults {color: red;} </style> </head> <body> <script> function geonamesSearch() { $('#results').html("Searching..."); $('#results').attr('class', 'searching'); var url = "http://ws.geonames.org/searchJSON"; var query = $('#searchedlocation').val(); $.getJSON(url + "?q="+ query +"&maxRows=25&featureClass=P", null, function(data) { var data = data.geonames; var names = []; if(data.length > 0) { $.each(data, function(i, val){ names.push(val.name +" ("+val.adminName1+")"); }); $('#results').html(names.join("<br/>")); $('#results').attr('class', 'success'); } else { $('#results').html("No matching place."); $('#results').attr('class', 'noresults'); } } ); } </script> <input type="text" id="searchedlocation" /> <button id="search" onclick="geonamesSearch();">Click me</button> <div id="results"></div> </body> </html> This page contains a text input field, a button, and an empty div whose ID is 'results'. When we click on the button, the JavaScript function geonamesSearch does the following: It puts the 'searching' class on the results div, and inserts the mention Searching... It reads the current value of the text input It calls the Geonames.org JSON web services to get the place names matching this value This JSON call is performed by jQuery and we provides it with a callback function (that will be called when the Geonames web service will respond), which reads the results If there is no result, it changes the results div class to 'noresults', and its text to No matching place. If there are some results, it sets the class to 'success' and displays the matching place names. We can try it with our web browser, and see it works nicely. Testing our use case with CasperJS Now let's test this page with the following CasperJS script which enters the value 'barcelona' and asserts we do get Barcelona (Catalonia) in the results: casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)'); casper.test.begin('Search a city by name', 1, function(test) { casper.start('http://localhost:8000/example3.html', function() { this.sendKeys("input#searchedlocation", "barcelona"); this.click("button#search"); }); casper.then(function() { test.assertTextExists('Barcelona (Catalonia)', 'Barcelona (Catalonia) has been found.'); }) casper.run(function() { test.done(); }); }); Note that we need to set up a regular user agent to make sure geonames.org will accept to process our request. If we run it, we get a failure: Why is that? It is because our this.click() triggers the geonamesSearch function and immediately after we try to assert the result content, but the Geonames web service had no enough time to respond, the content is not yet the one expected at the time the assertion is performed. Timing is everything The CasperJS then() blocks allow to make sure we will execute our test steps sequence in the right order, but they cannot guarantee that an asynchronous call performed in one of the block will be complete before we move to the next block. To manage this kind of cases, CasperJS offers the ability to wait before executing the rest of our test sequence. Here is a working test script: casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)'); casper.test.begin('Search a city by name', 1, function(test) { casper.start('http://localhost:8000/example3.html', function() { this.sendKeys("input#searchedlocation", "barcelona"); this.click("button#search"); }); casper.waitForSelector('div.success', function() { test.assertTextExists('Barcelona (Catalonia)', 'Barcelona (Catalonia) has been found.'); }) casper.run(function() { test.done(); }); }); We can see the tests pass successfully now: With waitForSelector, we make sure the assertion will be performed only when the results div will have the 'success' class, and it will only happen once our JSON loading callback function has been called. Summary In this article, we learned how to test our use case with CasperJS and how timing is everything. Resources for Article: Further resources on this subject: Introducing a feature of IntroJs [article] So, what is Ext JS? [article] So, what is EaselJS? [article]
Read more
  • 0
  • 0
  • 1958
article-image-design-documentation
Packt
23 Jan 2014
19 min read
Save for later

The Design Documentation

Packt
23 Jan 2014
19 min read
(For more resources related to this topic, see here.) The design documentation provides written documentation of the design factors and the choices the architect has made in the design to satisfy the business and technical requirements. The design documentation also aids in the implementation of the design. In many cases where the design architect is not responsible for the implementation, the design documents ensure the successful implementation of the design by the implementation engineer. Once you have created the documentation for a few designs, you will be able to develop standard processes and templates to aid in the creation of design documentation. Documentation can vary from project to project. Many consulting companies and resellers have standard documentation templates that they use when designing solutions. A properly documented design should include the following information: Architecture design Implementation plan Installation guide Validation test plan Operational procedures This information can be included in a single document or separated into different documents. VMware provides Service Delivery Kits to VMware partners. These kits can be found on the VMware Partner University portal at http://www.vmware.com/go/partneruniversity, which provides documentation templates that can be used as a foundation for creating design documents. If you do not have access to these templates, example outlines are provided in this article to assist you in developing your own design documentation templates. The final steps of the design process include gaining customer approval to begin implementation of the design and the implementation of the design. Creating the architecture design document The architecture design document is a technical document describing the components and specifications required to support the solution and ensure that the specific business and technical requirements of the design are satisfied. An excellent example of an architecture design document is the Cloud Infrastructure Architecture Case Study White Paper article that can be found at http://www.vmware.com/files/pdf/techpaper/cloud-infrastructure-achitecture-case-study.pdf. The architect creates the architecture design document to document the design factors and the specific choices that have been made to satisfy those factors. The document serves as a way for the architect to show his work when making design decisions. The architecture design document includes the conceptual, logical, and physical designs. How to do it... The architecture design document should include the following information: Purpose and overview Executive summary Design methodology Conceptual design Logical management, storage, compute, and network design Physical management, storage, compute, and network design How it works... The Purpose and Overview section of the architecture design includes the Executive Summary section. The Executive Summary section provides a high-level overview of the design and the goals the design will accomplish, and defines the purpose and scope of the architecture design document. The following is an example executive summary in the Cloud Infrastructure Architecture Case Study White Paper : Executive Summary: This architecture design was developed to support a virtualization project to consolidate 100 existing physical servers on to a VMware vSphere 5.x virtual infrastructure. The primary goals this design will accomplish are to increase operational efficiency and to provide high availability of customer-facing applications. This document details the recommended implementation of a VMware virtualization architecture based on specific business requirements and VMware recommended practices. The document provides both logical and physical design considerations for all related infrastructure components including servers, storage, networking, management, and virtual machines. The scope of this document is specific to the design of the virtual infrastructure and the supporting components. The purpose and overview section should also include details of the design methodology the architect has used in creating the architecture design. This should include the processes followed to determine the business and technical requirements along with definitions of the infrastructure qualities that influenced the design decisions. Design factors, requirements, constraints, and assumptions are documented as part of the conceptual design. To document the design factors, use a table to organize them and associate them with an ID that can be easily referenced. The following table illustrates an example of how to document the design requirements: ID Requirement R001 Consolidate the existing 100 physical application servers down to five servers R002 Provide capacity to support growth for 25 additional application servers over the next five years R003 Server hardware maintenance should not affect application uptime R004 Provide N+2 redundancy to support a hardware failure during normal and maintenance operations The conceptual design should also include tables documenting any constraints and assumptions. A high-level diagram of the conceptual design can also be included. Details of the logical design are documented in the architecture design document. The logical design of management, storage, network, and compute resources should be included. When documenting the logical design document, any recommended practices that were followed should be included. Also include references to the requirements, constraints, and assumptions that influenced the design decisions. When documenting the logical design, show your work to support your design decisions. Include any formulas used for resource calculations and provide detailed explanations of why design decisions were made. An example table outlining the logical design of compute resource requirements is as follows: Parameter Specification Current CPU resources required 100 GHz *CPU growth 25 GHz CPU required (75 percent utilization) 157 GHz Current memory resources required 525 GB *Memory growth 131 GB Memory required (75 percent utilization) 821 GB Memory required (25 percent TPS savings) 616 GB *CPU and memory growth of 25 additional application servers (R002) Similar tables will be created to document the logical design for storage, network, and management resources. The physical design documents have the details of the physical hardware chosen along with the configurations of both the physical and virtual hardware. Details of vendors and hardware models chosen and the reasons for decisions made should be included as part of the physical design. The configuration of the physical hardware is documented along with the details of why specific configuration options were chosen. The physical design should also include diagrams that document the configuration of physical resources, such as physical network connectivity and storage layout. A sample outline of the architecture design document is as follows: Cover page: It includes the customer and project names Document version log: It contains the log of authors and changes made to the document Document contacts: It includes the subject matter experts involved in the creation of the design Table of contents: It is the index of the document sections for quick reference List of tables: It is the index of tables included in the document for quick reference List of figures: It is the index of figures included in the document for quick reference Purpose and overview: This section consists of an executive summary to provide an overview of the design and the design methodology followed in creating the design Conceptual design: It is the documentation of the design factors: requirements, constraints, and assumptions Logical design: It has the details of the logical management, storage, network, and compute design Physical design: It contains the details of the selected hardware and the configuration of the physical and virtual hardware Writing an implementation plan The implementation plan documents the requirements necessary to complete the implementation of the design. The implementation plan defines the project roles and defines what is expected of the customer and what they can expect during the implementation of the design. This document is sometimes referred to as the statement of work. It defines the key points of contact, the requirements that must be satisfied to start the implementation, any project documentation deliverables, and how changes to the design and implementation will be handled. How to do it... The implementation plan should include the following information: Purpose statement Project contacts Implementation requirements Overview of implementation steps Definition of project documentation deliverables Implementation of change management How it works... The purpose statement defines the purpose and scope of the document. The purpose statement of the implementation plan should define what is included in the document and provide a brief overview of the goals of the project. The purpose statement is simply an introduction so that someone reading the document can gain a quick understanding of what the document contains. The following is an example purpose statement: This document serves as the implementation plan and defines the scope of the virtualization project. This document identifies points of contact for the project, lists implementation requirements, provides a brief description of each of the document deliverables, deliverables, and provides an overview of the implementation process for the data-center virtualization project. The scope of this document is specific to the implementation of the virtual data-center implementation and the supporting components as defined in the Architecture Design. Key project contacts, their roles, and their contact information should be included as part of the implementation plan document. These contacts include customer stakeholders, project managers, project architects, and implementation engineers. The following is a sample table that can be used to document project contacts for the implementation plan: Role Name Contact information Customer project sponsor     Customer technical resource     Project manager     Design architect     Implementation engineer     QA engineer     Support contacts for hardware and software used in the implementation plan may also be included in the table, for example, contact numbers for VMware support or other vendor support. Implementation requirements contain the implementation dependencies to include the access and facility requirements. Any hardware, software, and licensing that must be available to implement the design is also documented here. Access requirements include the following: Physical access to the site. Credentials necessary for access to resources. These include active directory credentials and VPN credentials (if remote access is required). Facility requirements include the following: Power and cooling to support the equipment that will be deployed as part of the design Rack space requirements Hardware, software, and licensing requirements include the following: vSphere licensing Windows or other operating system licensing Other third-party application licensing Software (ISO, physical media, and so on) Physical hardware (hosts, array, network switches, cables, and so on) A high-level overview of the steps required to complete the implementation is also documented. The details of each step are not a part of this document; only the steps that need to be performed will be included. For example: Procurement of hardware, software, and licensing. Scheduling of engineering resources. Verification of access and facility requirements. Performance of an inventory check for the required hardware, software, and licensing. Installation and configuration of storage array. Rack, cable, and burn-in of physical server hardware. Installation of ESXi on physical servers. Installation of vCenter Server. Configuration of ESXi and vCenter. Testing and verification of implementation plan. Migration of physical workloads to virtual machines. Operational verification of the implementation plan. The implementation overview may also include an implementation timeline documenting the time required to complete each of the steps. Project documentation deliverables are defined as part of the implementation plan. Any documentation that will be delivered to the customer once the implementation has been completed should be detailed here. Details include the name of the document and a brief description of the purpose of the document. The following table provides example descriptions of the project documentation deliverables: Document Description Architecture design This is a technical document describing the vSphere components and specifications required to achieve a solution that addresses the specific business and technical requirements of the design. Implementation plan This identifies implementation roles and requirements. It provides a high-level map of the implementation and deliverables detailed in the design. It documents change management procedures. Installation guide This document provides detailed, step-by-step instructions on how to install and configure the products specified in the architecture design document. Validation test plan This document provides an overview of the procedures to be executed post installation to verify whether or not the infrastructure is installed correctly. It can also be used at any point subsequent to the installation to verify whether or not the infrastructure continues to function correctly. Operational procedures This document provides detailed, step-by-step instructions on how to perform common operational tasks after the design is implemented. How changes are made to the design, specifically changes made to the design factors, must be well documented. Even a simple change to a requirement or an assumption that cannot be verified can have a tremendous effect on the design and implementation. The process for submitting a change, researching the impact of the change, and approving the change should be documented in detail. The following is an example outline for an implementation plan: Cover page: It includes the customer and project names Document version log: It contains the log of authors and changes made to the document Document contacts: It includes the subject matter experts involved in the creation of the design Table of contents: It is the index of document sections for quick reference List of tables: It is the index of tables included in the document for quick reference List of figures: It is the index of figures included in the document for quick reference Purpose statement: It defines the purpose of the document Project contacts: It is the documentation of key project points of contact Implementation requirements: It provides the access, facilities, hardware, software, and licensing required to complete the implementation Implementation overview: It is the overview of the steps required to complete the implementation Project deliverables: It consists of the documents that will be provided as deliverables once implementation has been completed Developing an installation guide The installation guide provides step-by-step instructions for the implementation of the architecture design. This guide should include detailed information about how to implement and configure all the resources associated with the virtual datacenter project. In many projects, the person creating the design is not the person responsible for implementing the design. The installation guide outlines the steps necessary to implement the physical design outlined in the architecture design document. The installation guide should provide details about the installation of all components, including the storage and network configurations required to support the design. In a complex design, multiple installation guides may be created to document the installation of the various components required to support the design. For example, separate installation guides may be created for the storage, network, and vSphere installation and configuration. How to do it... The installation guide should include the following information: Purpose statement Assumption statement Step-by-step instructions to implement the design How it works... The purpose statement simply states the purpose of the document. The assumption statement describes any assumptions the document's author has made. Commonly, an assumption statement simply states that the document has been written, assuming that the reader is familiar with virtualization concepts and the architecture design. The following is an example of a basic purpose and assumption statement that can be used for an installation guide: Purpose: This document provides a guide for installing and configuring the virtual infrastructure design defined in the Architecture Design. Assumptions: This guide is written for an implementation engineer or administrator who is familiar with vSphere concepts and terminologies. The guide is not intended for administrators who have no prior knowledge of vSphere concepts and terminology. The installation guide should include details on implementing all areas of the design. It should include configuration of the storage array, physical servers, physical network components, and vSphere components. The following are just a few examples of installation tasks to include instructions for: Storage array configurations Physical network configurations Physical host configurations ESXi installation vCenter Server installation and configuration Virtual network configuration Datastore configuration High availability, distributed resource scheduler, storage DRS, and other vSphere components installation and configuration The installation guide should provide as much detail as possible. Along with the step-by-step procedures, screenshots can be used to provide installation guidance. The following screenshot is an example taken from an installation guide that details enabling and configuring the Software iSCSI adapter: The following is an example outline for an installation guide: Cover page: It includes the customer and project names Document version log: It contains the log of authors and changes made to the document Document contacts: It includes the subject matter experts involved in the creation of the design Table of contents: It is the index of document sections for quick reference List of tables: It is the index of tables included in the document for quick reference List of figures: It is the index of figures included in the document for quick reference Purpose statement: It defines the purpose of the document Assumption statement: It defines any assumptions made in creating the document Installation guide: It provides the step-by-step installation instructions to be followed when implementing the design Creating a validation test plan The validation test plan documents how the implementation will be verified. It documents the criteria that must be met to determine the success of the implementation and the test procedures that should be followed when validating the environment. The criteria and procedures defined in the validation test plan determine whether or not the design requirements have been successfully met. How to do it... The validation test plan should include the following information: Purpose statement Assumption statement Success criteria Test procedures How it works... The purpose statement defines the purpose of the validation test plan and the assumption statement documents any assumptions the author of the plan has made in developing the test plan. Typically, the assumptions are that the testing and validation will be performed by someone who is familiar with the concepts and the design. The following is an example of a purpose and assumption statement for a validation test plan: Purpose: This document contains testing procedures to verify that the implemented configurations specified in the Architecture Design document successfully addresses the customer requirements. Assumptions: This document assumes that the person performing these tests has a basic understanding of VMware vSphere and is familiar with the accompanying design documentation. This document is not intended for administrators or testers who have no prior knowledge of vSphere concepts and terminology. The success criteria determines whether or not the implemented design is operating as expected. More importantly, these criteria determine whether or not the design requirements have been met. Success is measured based on whether or not the criteria satisfies the design requirements. The following table shows some examples of success criteria defined in the validation test plan: Description Measurement Members of the active directory group vSphere administrators are able to access vCenter as administrators Yes/No Access is denied to users outside the vSphere administrators active directory group Yes/No Access to a host using the vSphere Client is permitted when lockdown mode is disabled Yes/No Access to a host using the vSphere Client is denied when lockdown mode is enabled Yes/No Cluster resource utilization is less than 75 percent. Yes/No If the success criteria are not met, the design does not satisfy the design factors. This can be due to a misconfiguration or error in the design. Troubleshooting will need to be done to identify the issue or modifications to the design may need to be made. Test procedures are performed to determine whether or not the success criteria have been met. Test procedures should include testing of usability, performance, and recoverability. Test procedures should include the test description, the tasks to perform the test, and the expected results of the test. The following table provides some examples of usability testing procedures: Test description Tasks to perform test Expected result vCenter administrator access Use the vSphere Web Client to access the vCenter Server. Log in as a user who is a member of the vSphere administrators AD group. Administrator access to the inventory of the vCenter Server vCenter access: No permissions Use the vSphere Web Client to access the vCenter Server. Log in as a user who is not a member of the vSphere administrators AD group. Access is denied Host access: lockdown mode disabled Disable lockdown mode through the DCUI. Use the vSphere Client to access the host and log in as root. Direct access to the host using the vSphere Client is successful Host access: lockdown mode enabled Re-enable lockdown mode through the DCUI. Use the vSphere Client to access the host and log in as root. Direct access to the host using the vSphere Client is denied The following table provides some examples of reliability testing procedures: Test description Tasks to perform test Expected result Host storage path failure Disconnect a vmnic providing IP storage connectivity from the host The disconnected path fails, but I/O continues to be processed on the surviving paths. A network connectivity alarm should be triggered and an e-mail should be sent to the configured e-mail address. Host storage path restore Reconnect the vmnic providing IP storage connectivity The failed path should become active and begin processing the I/O. Network connectivity alarms should clear. Array storage path failure Disconnect one network connection from the active SP The disconnected paths fail on all hosts, but I/O continues to be processed on the surviving paths. Management network redundancy Disconnect the active management network vmnic The stand-by adapter becomes active. Management access to the host is not interrupted. A loss-of-network redundancy alarm should be triggered and an e-mail should be sent to the configured e-mail address. These are just a few examples of test procedures. The actual test procedures will depend on the requirements defined in the conceptual design. The following is an example outline of a validation test plan: Cover page: It includes the customer and project names Document version log: It contains the log of authors and changes made to the document Document contacts: It includes the subject matter experts involved in the creation of the design Table of contents: It is the index of document sections for quick reference List of tables: It is the index of tables included in the document for quick reference List of figures: It is the index of figures included in the document for quick reference Purpose statement: It defines the purpose of the document Assumption statement: It defines any assumptions made in creating the document Success criteria: It is a list of criteria that must be met to validate the successful implementation of the design Test Procedures: It is a list of test procedures to follow, including the steps to follow and the expected results
Read more
  • 0
  • 2
  • 47263

Packt
23 Jan 2014
6 min read
Save for later

XenApp® Policies

Packt
23 Jan 2014
6 min read
(For more resources related to this topic, see here.) Creating a XenApp® Computer or User policy This recipe will show you how to create policies in general to configure Computer and User settings for Citrix XenApp. Getting ready Before configuring computer and user policies, you have to decide which tool to use to create and configure Citrix policies. As of Citrix XenApp 6.x, you can use both the Microsoft Group Policy Management Console (GPMC) as Citrix's AppCenter to create policies. Policies can be managed from only one of the consoles as policies created with GPMC are not visible in AppCenter and vice versa. When using GPMC, a public hotfix must be installed on the machine that is running on the management console. The latest version can be found at Citrix's Knowledge Center: http://support.citrix.com/product/xa/v6.5_2008r2/hotfix/general/public/. How to do it... To create a Citrix policy that is applied to the XenApp servers with AppCenter, follow these steps: Open the Citrix XenApp Management Console AppCenter (Start | Administrative Tools | Citrix | Management Consoles). Navigate to XenApp | <FarmName> | Policies in the left pane. Click on the Computer tab in the Policies pane. Click on New to create a new policy. Enter values in the Name and Description fields for the policy and click on Next. Select a category in the left pane. Add a policy setting by clicking on Add in the right pane for each setting. Configure the policy setting and click on OK. Repeat steps 6 to 8 to add more policy settings. Click on Next when all policy settings are configured. Configure the filter settings and click on Next. The filter options are addressed in the next recipe. Ensure the Enable this policy option is selected and click on Create. Computer policies are applied to XenApp servers when the server is started or when policy updates are applied to the XenApp server. To force the policies to be applied immediately to the XenApp server, run the following command on the server: gpupdate /force To create a Citrix policy that is applied to the XenApp user session with AppCenter, follow these steps: Open the Citrix XenApp management console AppCenter (Start | Administrative Tools | Citrix | Management Consoles). Navigate to XenApp | <FarmName> | Policies in the left pane. Click on the User tab in the Policies pane. Click on New to create a new policy. Enter values in the Name and Description fields for the policy and click on Next. Select a category in the left pane. Add a policy setting by clicking on Add in the right pane for each setting. Configure the policy setting and click on OK. Repeat steps 6 to 8 to add more policy settings. Click on Next when all policy settings are configured. Configure the filter settings and click on Next. Filter options are addressed in the next recipe. Ensure the Enable this policy option is selected and click on Create. Just like Windows User policies, Citrix User policies are applied when the user session starts. There's more... You can read more on creating Citrix policies at Citrix's eDocs at http://support.citrix.com/proddocs/topic/xenapp65-admin/ps-admin-publishing-policies-create-all.html. See also The Adding filters to a policy recipe The Comparing XenApp® policies and templates recipe The Simulating connection scenario's with Citrix® policies recipe The Configuring policy priorities and exceptions recipe Adding filters to a policy This recipe will show you how to add filters to a policy to apply the policy to a selective group of XenApp servers or user sessions. Policies that are not configured with a filter apply to all XenApp servers in the farm and to all logged on users for a XenApp session. This will have the same effect as using the default unfiltered computer or user policy that cannot have a filter applied to it. How to do it... You can apply different policy filters to computer or user policies. To add filters to a Citrix Computer policy follow these steps: Create a new policy by following steps 1 to 10 from the previous recipe. Click on Add to configure the Organizational Unit (OU) or Worker Group filter. Click on Add to configure a filter element. Configure the mode (allow or deny) and use Browse to find the correct worker group or OU. Click on OK to add the filter element. Repeat steps 3 to 5 to add more filter elements. Click on OK to add the filter to the policy. Repeat steps 2 to 7 to configure multiple filters for the policy. Click on Next. Ensure the Enable this policy option is selected and click on Create. To add filters to a Citrix User policy follow these steps: Create a new policy by following the steps 1 to 10 from the previous recipe. Click on Add to configure Access Control, Branch Repeater, Client IP Address, Client Name, Organizational Unit (OU), User or Group, or Worker Group filter. Click on Add to configure a filter element. Configure the mode (allow or deny) and use Browse to find the correct OU, User or Group, or Worker Group, or enter filter-specific settings for Client IP Address, Name, Access Control, or Branch Repeater. Click on OK to add the filter element. Repeat steps 3 to 5 to add more filter elements. Click on OK to add the filter to the policy. Repeat steps 2 to 7 to configure multiple filters for the policy. Click on Next. Ensure the Enable this policy option is selected and click on Create. See also The Creating a XenApp® Computer or User policy recipe The Comparing XenApp® policies and templates recipe The Simulating connection scenarios with Citrix® policies recipe The Configuring policy priorities and exceptions recipe Comparing XenApp® policies and templates This recipe will show you how to compare policy settings with other policies or policy templates by using Citrix's management console AppCenter to see if policies contain similar settings, contradicting settings, or have no correlation whatsoever. How to do it... To compare policies with templates in AppCenter, follow these steps: Open the Citrix XenApp management console AppCenter (Start | Administrative Tools | Citrix | Management Consoles). Navigate to XenApp | <FarmName> | Policies in the left pane. Click on the Templates tab in the Policies pane. Click on the Compare View icon on the right-hand side of the menu bar. Select the policies that you want to compare and click on Compare. To check the configured policy settings against default policy settings for the XenApp Farm, select a policy, and select the Compare to setting defaults option. The policy settings from the selected policies are shown and can easily be compared. To add additional policies to the comparison or check all available policy settings, click on Configured Settings and select either Add/Remove Columns or Show All Settings. There's more... You can read more about comparing policies and templates at Citrix's eDocs: http://support.citrix.com/proddocs/topic/xenapp65-admin/ps-policies-templates-compare.html. See also The Creating a XenApp® Computer or User policy recipe The Adding filters to a policy recipe The Simulating connection scenarios with Citrix® policies recipe The Configuring policy priorities and exceptions recipe
Read more
  • 0
  • 0
  • 3032

article-image-branding-sharepoint-device-channels-and-design-packages
Packt
22 Jan 2014
11 min read
Save for later

Branding SharePoint with Device Channels and Design Packages

Packt
22 Jan 2014
11 min read
With the 2013 release of SharePoint, Microsoft has added two new capabilities that assist with full-scale branding of SharePoint sites: device channels and design packages. A device channel uses the user agent of the web browser sending the incoming web request to determine which master page to render the content pages with. A common use of the device channels is to detect tablets and smartphones to use a more touch-friendly interface design. For instance, a device channel can be configured to look for an iPad in the following user agent to identify the iPad devices: Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X)AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0Mobile/11B554a Safari/9537.53 Any portion of the user agent can be used for a device channel. It is important to be specific, but not too specific. Using iPad would apply to all the devices that specify iPad in their user agent, whereas iPad; U; CPU OS 7_0 would only apply to iPads running on iOS Version 7.0. A design package is a SharePoint solution, packaged as a WSP file containing branding customizations, such as master pages and cascading style sheets. This provides a simple method of exporting a site design from one site and applying it to another. A design package will only contain items that are not default to SharePoint. Default items, such as the included master pages, will be referenced, but are not included as part of the package. Prior to SharePoint 2013, packaged design solutions could only be created manually or with Visual Studio. Design packages allow any site collection administrator to create and apply packaged designs. This allows the site collection administrators to obtain packaged designs (from third parties, and so on) and apply them, without having to manually upload and configure each piece of the design. Creating a device channel for mobile devices One of the most common scenarios for using device channels is to identify the tablet and smartphone browsers. Applying a mobile-specific master page, when appropriate, can provide the users with a design that is more touch friendly and is laid out in a specific manner for smaller screens. In this recipe, we are going to create a device channel that will identify Android, iOS, BlackBerry, WebOS, and Windows mobile devices. There are hundreds of mobile-specific browsers that we can detect with the user agent. However, for this recipe we are going to keep it simple. Getting ready In order to view and modify the device channels for a SharePoint site, the SharePoint Server Publishing Infrastructure site collection feature and SharePoint Server Publishing site feature must be activated. How to do it... Follow these steps to create a device channel for mobile devices: Navigate to the site in your preferred web browser. Select Site settings from the Settings menu. Select Device Channels from the Look and Feel section. You can also navigate to the Device Channels page from the Design Manager page. Select New Item. Provide a Name, Description, and Alias for the device channel. The Alias field specified will be used when specifying which master page to use with the device channel in the device channel mappings file. We will learn about this in the next recipe, Applying a master page to a device channel. Specify the Device Inclusion Rules to be included in the device channel. Android iPad iPod iPhone BlackBerry IEMobile WebOS When using multiple device inclusion rules, place each string on a new line to match the user agent. Device Inclusion Rules are simply strings that are looked for in the user agent of incoming web requests. Mark the Active checkbox and click on Save. How it works... Device channels are created and stored in the /DeviceChannels SharePoint list in the root site of a site collection. When an incoming browser request is received, SharePoint checks whether the incoming user agent matches any of the Device Inclusion Rules before selecting the master page to use. Many web browsers have developer tools that allow changing the user agent reported by the browser. Switching the user agent is one way in which we can test to ensure our device channels are working correctly. Internet Explorer 11, for instance, includes this option in the Emulation section of the F12 Developer Tools. There's more... A device channel may also be created with PowerShell or with code using the server-side object model. Creating a device channel for mobile devices using PowerShell Follow these steps to create a device channel for mobile devices using PowerShell: Get the site using the Get-SPWeb Cmdlet. $web = Get-SPWeb http://sharepoint/site Get the DeviceChannels list. $list = $web.Lists["Device Channels"] Add a new SPListItem item to the Items collection of the list. $item = $list.Items.Add() Assign the values to each of the properties on the SPListItem item. $item["Name"] = "PowerShell" $item["Alias"] = "PowerShell" $item["Description"] = "PowerShell Channel" $item["Device Inclusion Rules"] = "Android`niPad`niPod`niPhone`nBlackBerry`nIEMobile`nWebOS" $item["Active"] = $true When a line break is required within a string, in PowerShell, an escape character can be used. Escape characters in PowerShell use the tilde character. For example, a new line is represented by `n. Call the Update method on the list to update the Items collection. $item.Update() Use the Dispose method to discard the SPWeb object. $web.Dispose() Creating a device channel for mobile devices with code using the server-side object model Follow these steps to create a device channel for mobile devices with code using the server-side object model: Open the site collection containing the site in a using statement. using (var site = new SPSite("http://sharepoint/site")) Open the site in a using statement. using (var web = site.OpenWeb()) Get the DeviceChannels list. var list = web.Lists["Device Channels"]; Add a new SPListItem item to the Items collection of the list. var item = list.Items.Add(); Assign the values to each of the properties on the SPListItem item. item["Name"] = "Code"; item["Alias"] = "Code "; item["Description"] = "Code Channel"; item["Device Inclusion Rules"] = "AndroidniPadniPodniPhonenBlackBerrynIEMobilenWebOS"; item["Active"] = true; When a line break is required within a string in C#, an escape character can be used. Escape characters in C# use the backslash character. For example, a new line is represented by n. Call the Update method on the list to update the Items collection. item.Update(); See also SharePoint Design Manager branding and design capabilities How to: Add or Delete List Items SPWeb class SPSite class Get-SPWeb Applying a master page to a device channel Once a device channel has been created, it can be configured to use as a different site master page rather than the default site master page. For instance, browsers targeted by a mobile device channel could display the content using the oslo master page whereas all other browsers could display the same content using the seattle master page. The System Master Page is configured for all device channels and cannot be configured for individual device channels. How to do it... Follow these steps to apply a master page to a device channel: Navigate to the site in your preferred web browser. Select Site settings from the Settings menu. Select Master page from the Look and Feel section. Specify which Site Master Page to use for each device channel. Click on Save. How it works... The master page to device channel mappings are stored in the _catalogs/masterpages/__DeviceChannelMappings.aspx file as XML within the root site of a site collection. For each incoming browser web request, this file is used by SharePoint to determine which master page to use with the content returned to the browser. There's more... A device channel mapping may also be configured with PowerShell or with code using the server-side object model. In this recipe, these two methods are similar. However, the .NET reflection methods used are slightly different. When an object is instantiated with reflection in PowerShell, its public properties and methods become available to the command line. However, when an object is instantiated with reflection in the .NET code, each property and method needs to be searched for before being able to access them. The methods that provide the functionality to configure the device channel mappings are not publicly exposed in the SharePoint assemblies. As a result, we will use the .NET reflection to instantiate the objects required. It is important to note that non-public classes in the SharePoint assemblies can change between SharePoint versions and updates without notice. Using reflection tools, such as .NET Reflector (http://www.red-gate.com/products/dotnet-development/reflector/) and dotPeek (http://www.jetbrains.com/decompiler/), we can browse the assemblies to adjust the references accordingly. Applying a master page to a device channel using PowerShell Follow these steps to apply a master page to a device channel using PowerShell: Load the Microsoft.SharePoint.dll and Microsoft.SharePoint.Publishing.dll assemblies into the PowerShell session. [Reflection.Assembly]::LoadFrom("C:Program FilesCommonFilesmicrosoft sharedWeb ServerExtensions15ISAPIMicrosoft.SharePoint.Publishing.dll") [Reflection.Assembly]::LoadFrom("C:Program FilesCommonFilesmicrosoft sharedWeb ServerExtensions15ISAPIMicrosoft.SharePoint.dll") Get the object types for the parameters that will be used when getting the class constructor for the MasterPageMappingsFile object and later instantiating the object. $typeWeb = [Microsoft.SharePoint.SPWeb] $typeBool = [System.Boolean] $typeMappingFile =[System.Type]::GetType("Microsoft.SharePoint.Publishing.Mobile.MasterPageMappingsFile, Microsoft.SharePoint.Publishing,Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") Create an array of the object types. $consMappingFileParams = ($typeWeb, $typeBool, $typeWeb) Get the class constructor for the MasterPageMappingsFile object. $consMappingFile = $typeMappingFile.GetConstructor($consMappingFileParams) Create an array of the parameters required to instantiate the MasterPageMappingsFile object. $mappingFileParams =[System.Array]::CreateInstance([System.Object], 3)$mappingFileParams[0] = (Get-SPSitehttp://sharepoint/sitecollection).RootWeb$mappingFileParams[1] = $false$mappingFileParams[2] = $null When invoking a constructor to create an instance of a .NET object in PowerShell, we have to create a System.Object array rather than using a PowerShell array. Even though the base class for a PowerShell array is System.Object[], when calling the Invoke method on the class constructor, it will see it as a PSObject object instead. The same goes for the SPWeb object we are passing as the first parameter. .NET will see the object as a PSObject object instead of a SPWeb object if we use Get-SPWeb. However, if we get the SPWeb object from the SPSite object, it will not get treated as a PSObject object. Invoke the class constructor to create an instance of the MasterPageMappingsFile object. $mappingFile = $consMappingFile.Invoke($mappingFileParams) Set the MasterPageUrl property for the device channel on the MasterPageMappingsFile object. $mappingFile["PowerShell"].MasterPageUrl = "/_catalogs/masterpage/oslo.master" Save the changes using the UpdateSingleChannel method. $mappingFile.UpdateSingleChannel("PowerShell") Applying a master page to a device channel with code using the server-side object model Follow these steps to apply a master page to a device channel with code using the server-side object model: A reference to the Microsoft.SharePoint.Publishing.dll assembly is required for this recipe. Get the site collection in a using statement. using (var site = new SPSite("http://sharepoint/sitecollection")) Get the root site of the site collection in a using statement. using (var web = site.RootWeb) Get the object type that will be used when getting the class constructor for the MasterPageMappingsFile object and later instantiating the object. MasterPageMappingsFile object and later instantiating the object.var typeMappingFile =Type.GetType("Microsoft.SharePoint.Publishing.Mobile.MasterPageMappingsFile, Microsoft.SharePoint.Publishing,Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"); Get the class constructor for the MasterPageMappingsFile object. var consMappingFile =typeMappingFile.GetConstructor(new Type[] { typeof(SPWeb),typeof(bool), typeof(SPWeb) }); Invoke the constructor to create an instance of the MasterPageMappingsFile object. var mappingFile = consMappingFile.Invoke(new object[] { web, false, null }); Get the mappings field of the MasterPageMappingsFile object, and cast the field as an IDictionary. var mappings = (IDictionary)typeMappingFile.GetField("mappings",BindingFlags.Instance | BindingFlags.NonPublic).GetValue(mappingFile); Set the MasterPageUrl property for the device channel on the mappings field. mappings["PowerShell"].GetType().GetProperty("MasterPageUrl",BindingFlags.Instance |BindingFlags.Public).SetValue(mappings["PowerShell"],"/_catalogs/masterpage/seattle.master", null); Set the mappings field of the MasterPageMappingsFile object. typeMappingFile.GetField("mappings", BindingFlags.Instance |BindingFlags.NonPublic).SetValue(mappingFile, mappings); Get the UpdateSingleChannel method from the type of the MasterPageMappingsFile object. var updateMethod = typeMappingFile.GetMethod("UpdateSingleChannel",BindingFlags.Instance | BindingFlags.Public, null, new Type[]{ typeof(string) }, null); Save the changes by invoking the UpdateSingleChannel method. updateMethod.Invoke(mappingFile, new object[] { "Code" });
Read more
  • 0
  • 0
  • 4767
article-image-organizing-backbone-applications-structure-optimize-and-deploy
Packt
21 Jan 2014
9 min read
Save for later

Organizing Backbone Applications - Structure, Optimize, and Deploy

Packt
21 Jan 2014
9 min read
(For more resources related to this topic, see here.) Creating application architecture The essential premise at the heart of Backbone has always been to try and discover the minimal set of data-structuring (Models and Collections) and user interface (Views and URLs) primitives that are useful when building web applications with JavaScript. Jeremy Ashkenas, creator of Backbone.js, Underscore.js, and CoffeeScript As Jeremy mentioned, Backbone.js has no intention, at least in the near future, to raise its bar to provide application architecture. Backbone will continue to be a lightweight tool to produce the minimal features required for web development. So, should we blame Backbone.js for not including such functionality even though there is a huge demand for this in the developer community? Certainly not! Backbone.js only yields the set of components that are necessary to create the backbone of an application and gives us complete freedom to build the app architecture in whichever way we want. If working on a significantly large JavaScript application, remember to dedicate sufficient time to planning the underlying architecture that makes the most sense. It's often more complex than you may initially imagine. Addy Osmani, author of Patterns For Large-Scale JavaScript Application Architecture So, as we start digging into more detail on creating an application architecture, we are not going to talk about trivial applications or something similar to a to-do-list app. Rather, we will investigate how to structure a medium- or large-level application. After discussions with a number of developers, we found that the main issue they face here is that there are several methodologies the online blog posts and tutorials offer to structure an application. While most of these tutorials talk about good practices, it becomes difficult to choose exactly one from them. Keeping that in mind, we will explore a number of steps that you should follow to make your app robust and maintainable in the long run. Managing a project directory This is the first step towards creating a solid app architecture. We have already discussed this in detail in the previous sections. If you are comfortable using another directory layout, go ahead with it. The directory structure will not matter much if the rest of your application is organized properly. Organizing code with AMD We will use RequireJS for our project. As discussed earlier, it comes with a bunch of facilities such as the following: Adding a lot of script tags in one HTML file and managing all of the dependencies on your own may work for a medium-level project, but will gradually fail for a large-level project. Such a project may have thousands of lines of code; managing a code base of that size requires small modules to be defined in each individual file. With RequireJS, you do not need to worry about how many files you have—you just know that if the standard is followed properly, it is bound to work. The global namespace is never touched and you can freely give the best names to something that matches with it the most. Debugging the RequireJS modules is a lot easier than other approaches because you know what the dependencies and path to each of them are in every module definition. You can use r.js, an optimization tool for RequireJS that minifies all the JavaScript and CSS files, to create the production-ready build. Setting up an application For a Backbone app, there must be a centralized object that will hold together all the components of the application. In a simple application, most people generally just make the main router work as the central object. But that will surely not work for a large application and you need an Application object that should work as the parent component. This object should have a method (mostly init()) that will work as the entry point to your application and initialize the main router along with the Backbone history. In addition, either your Application class should extend Backbone.Events or it should include a property that points to an instance of the Backbone.Events class. The benefit of doing this is that the app or Backbone.Events instance can act as a central event aggregator, and you can trigger application-level events on it. A very basic Application class will look like the following code snippet: // File: application.js define([ 'underscore', 'backbone', 'router' ], function (_, Backbone, Router) { // the event aggregator var PubSub = _.extend({}, Backbone.Events); var Application = function () { // Do useful stuff here } _.extend(Application.prototype, { pubsub: new PubSub(), init: function () { Backbone.history.start(); } }); return Application; }); Application is a simple class with an init() method and a PubSub instance. The init() method acts as the starting point of the application and PubSub works as the application-level event manager. You can add more functionality to the Application class, such as starting and stopping modules and adding a region manager for view layout management. It is advisable to keep this class as short as you can. Using the module pattern We often see that intermediate-level developers find it a bit confusing to initially use a module-based architecture. It can be a little difficult for them to make the transition from a simple MVC architecture to a modular MVC architecture. While the points we are discussing in this article are valid for both these architectures, we should always prefer to use a modular concept in nontrivial applications for better maintainability and organization. In the directory structure section, we saw how the module consists of a main.js file, its views, models, and collections all together. The main.js file will define the module and have different methods to manage the other components of that module. It works as the starting point of the module. A simple main.js file will look like the following code: // File: main.js define([ 'app/modules/user/views/userlist', 'app/modules/user/views/userdetails' ], function (UserList, UserDetails) { var myVar; return { initialize: function () { this.showUserList(); }, showUsersList: function () { var userList = new UserList(); userList.show(); }, showUserDetails: function (userModel) { var userDetails = new UserDetails({ model: userModel }); userDetails.show(); } }; }); As you can see, the responsibility of this file is to initiate the module and manage the components of that module. We have to make sure that it handles only parent-level tasks; it shouldn't contain a method that one of its views should ideally have. The concept is not very complex, but you need to set it up properly in order to use it for a large application. You can even go for an existing app and module setup and integrate it with your Backbone app. For instance, Marionette provides an application infrastructure for Backbone apps. You can use its inbuilt Application and Module classes to structure your application. It also provides a general-purpose Controller class—something that doesn't come with the Backbone library but can be used as a mediator to provide generic methods and work as a common medium among the modules. You can also use AuraJS (https://github.com/aurajs/aura), a framework-agonistic event-driven architecture developed by Addy Osmani (http://addyosmani.com) and many others; it works quite well with Backbone.js. A thorough discussion on AuraJS is beyond the scope of this book, but you can grab a lot of useful information about it from its documentation and examples (https://github.com/aurajs/todomvc). It is an excellent boilerplate tool that gives your app a kick-start and we highly recommend it, especially if you are not using the Marionette application infrastructure. The following are a few benefits of using AuraJS ; they may help you choose this framework for your application: AuraJS is framework-agnostic. Though it works great with Backbone.js, you can use it for your JavaScript module architecture even if you aren't using Backbone.js. It utilizes the module pattern, application-level and module-level communication using the facade (sandbox) and mediator patterns. It abstracts away the utility libraries that you use (such as templating and DOM manipulation) so you can swap alternatives anytime you want. Managing objects and module communication One of the most important ways to keep the application code maintainable is to reduce the tight coupling between modules and objects. If you are following the module pattern, you should never let one module communicate with another directly. Loose coupling adds a level of restriction in your code, and a change in one module will never enforce a change in the rest of the application. Moreover, it lets you re-use the same modules elsewhere. But how can we communicate if there is no direct relationship? The two important patterns we use in this case are the observer and mediator patterns. Using the observer/PubSub pattern The PubSub pattern is nothing but the event dispatcher. It works as a messaging channel between the object (publisher) that fires the event and another object (subscriber) that receives the notification. We mentioned earlier that we can have an application-level event aggregator as a property of the Application object. This event aggregator can work as the common channel via which the other modules can communicate, and that too without interacting directly. Even at the module-level, you may need a common event dispatcher only for that module; the views, models, and collections of that module can use it to communicate with each other. However, publishing too many events via a dispatcher sometimes makes it difficult to manage them and you must be careful enough to understand which events you should publish via a generic dispatcher and which ones you should fire on a certain component only. Anyhow, this pattern is one of the best tools to design a decoupled system, and you should always have one ready for use in your module-based application. Summary This article dealt with one of the most important topics of Backbone.js-based application development. At the framework level, learning Backbone is quite easy and developers get a complete grasp over it in a very short period of time. Resources for Article: Further resources on this subject: Building an app using Backbone.js [article] Testing Backbone.js Application [article] Understanding Backbone [article]
Read more
  • 0
  • 0
  • 8321

article-image-article-prototyping-recipes
Packt
21 Jan 2014
16 min read
Save for later

Prototyping Recipes

Packt
21 Jan 2014
16 min read
(For more resources related to this topic, see here.) Sketching, scanning, and prototyping Most folks start the design process by developing quick sketches of the concepts. These sketches can be elaborate or rudimentary. Oftentimes, these sketches evolve into paper prototypes that illustrate the flow or steps a user would take to complete a task. By scanning your drawings, making adjustments with your favorite image editing software (Gimp, Adobe Photoshop, and so on), and Axure, you can quickly create a clickable prototype. Getting ready To go through this recipe, you will need to have digital scans of your sketches and access to the image editing software of your choice. How to do it... You will now create a carousel including thumbnails from digital scans of simple, freehanddrawn sketches. Using your image-editing tool, first organize your images and crop them appropriately. You will have to organize the images and visualize the user flow just as you would do for paper prototypes. Start Axure and under Create New select RP File. If you already have Axure open, select File in the main menu, and then click on New, in the drop-down menu to create a new RP document. In the Sitemap, add additional child or sibling pages as necessary to complete your flow by clicking on the Add Page button icon or by right-clicking on any page in the sitemap. In the menu that appears, mouse over Add, and then click on the Child or the Sibling page. Double-click on any page title in Sitemap to select that page. You will see the wireframe for the associated page shown. While holding down the mouse button, drag the Image widget, and place it on the wireframe. Double-click on the Image widget on the wireframe, and select the appropriate scanned sketch. While holding down the mouse button, drag the Hot Spot widget, and place it over the item you would like to make clickable. While holding down the mouse button, drag the corners of the Hot Spot widget on the wireframe to the desired size. With Hot Spot selected, in the Widget Interactions and Note spane, click on Create Link…. In the Sitemap pop up, click on the associated page in the user flow. Repeat steps 7 through 10 for each region on your wireframe that you would like to make clickable. Repeat steps 4 through 11 for each page in Sitemap that you would like to make a part of the prototype. You can now choose to preview or save a copy of the prototype. To preview the prototype, click on the Preview button in the toolbar. To save a copy of the prototype, click on the Publish button in the toolbar, and select Generate HTML Files…. You can also generate the prototype by going to the main menu, selecting Publish, and clicking on Generate HTML Files…. How it works... Using this recipe, you are able to convert your paper sketches into clickable digital prototypes. Each paper sketch becomes a page in the Sitemap through the use of the Image widget. To accomplish this, you opened the scanned image with the Image widget to display your paper sketch on the page. To create clickable regions, you used Hot Spot and associated the next page in the flow using Create Link…. You used as many image map regions as clickable elements needed for the interactions on a page. Creating a dynamic Breadcrumb Master Using Masters in Axure allows you to create reusable components. When you make a change to a Master, the change is applied to all wireframes that contain that Master. Leveraging Masters can ensure the consistency of elements across your prototypes. Getting ready In this recipe you will create a dynamic Breadcrumb Master. In Axure, verify that the Widget Manager and Page Properties panes are shown. To verify, click on View in the main menu and mouse over Panes. In the pop-up menu, make sure that a check mark is next to all items, including the Widget Manager and Page Properties panes. How to do it... To create a dynamic Breadcrumb Master, first you will create new pages in your sitemap and three empty Masters (for example, Template, Header, Menu, and BreadCrumb). Next, you will place widgets on the Header, Menu, and BreadCrumb Masters. You will then place the Header, Menu, and BreadCrumb Masters onto the Template Master. Finally, you will drag the Template Master to all of the pages in Sitemap. Start Axure and under Create New select RP File. In the Sitemap create pages as follows: In the Masters pane, create four individual Masters, titled: Template, Header, Menu, and BreadCrumb, respectively, as shown in the following screenshot: Right-click on each Master you created in step 3, mouse over Drop Behaviour, and click on Lock to Master Location. This will cause the widgets in each Master to maintain the xand ycoordinates no matter where the Master is placed in a wireframe. In the Masters pane, double-click on the Header Master to select it. While holding down the mouse button, drag the Placeholder widget, and place it on the wireframe. With the Placeholder widget selected, type Home, and change the x: 10, y: 12, w: 96, and h: 30(present at the top-left of the window). In the Widget Interactions and Notes pane, click on the Shape Name text field, and type HomeLink. While holding down the mouse button, drag the Label widget, and place it at the coordinates (130,18) on the wireframe. With the Label widget selected, perform the following steps: Type BreadCrumb Prototype. In the Widget Interactions and Notes pane, click on the Shape Name text field, and type HeaderLabel. In the Widget Properties and Style pane, click on the Style tab, and then scroll to the Font section. Increase the font size to 18 by clicking on the font size dropdown, mouse over 18, and click to select: In the Masters pane, double-click on the Menu Master to select it. While holding down the mouse button, drag the Classic Menu - Horizontal widget, and place it at the coordinates (10,52) on the wireframe. In the Widget Interactions and Notes pane, click on the Menu Name text field, and type MainMenu. To name and link the primary menu item, perform the following steps: Click on the first menu item labeled File to select it, and type Primary. In the Widget Interactions and Notes pane, click on the Menu Item Name text field, and type MenuPrimary. In the Widget Interactions and Notes pane, click on the Interactions tab, and then click on Add Case…. In the Case Editor (OnClick) pop up, in Case description, rename the case description OpenPrimaryPage. In Click to add actions, click on Open Link. In Organize actions, you will see the interaction description update to Open Link in Current Window. In Configure actions, click on the radio button next to Link to a page in this design, and then click on Primary Page. Click on OK. In the Widget Properties and Style pane, click on the Style tab, and then scroll to the Font section. Increase the font size to 16 by clicking the font size dropdown, mouse over 16, and then click on it to select. To name and link the category menu item, perform the following steps: Click on the second menu item, labeled Edit, to select it, and type Category. In the Widget Interactions and Notes pane, click on the Menu Item Name text field, and type MenuCategory. In the Widget Interactions and Notes pane, click on the Interactions tab, and then click on Add Case…. In the Case Editor (OnClick) pop up, in Case description, rename the case description OpenCategoryPage. In Click to add actions, click on Open Link. In Organize actions, you will see the interaction description update to Open Link in Current Window. In Configure actions, click on the radio button next to Link to a page in this design, and then click on Category page. Click on OK. In the Widget Properties and Style pane, click on the Style tab, and then scroll to the Font section. Increase the font size to 16 by clicking the font size dropdown, mouse over 16, and then click on it to select. To name and link the content menu item, perform the following steps: Click on the third menu item labelled View to select it, and type Content. In the Widget Interactions and Notes pane, click on the Menu Item Name text field, and type MenuContent. In the Widget Interactions and Notes pane, click on the Interactions tab, and then click on Add Case…. In the Case Editor (OnClick) pop up, in Case description, rename the case description OpenContentPage. In Click to add actions, click on Open Link. In Organize actions, you will see the interaction description update to Open Link in Current Window. In Configure actions, click on the radio button next to Link to a page in this design, and then click on Content Page. Click on OK. In the Widget Properties and Style pane, click on the Style tab, and then scroll to the Font section. Increase the font size to 16 by clicking the font size dropdown, mouse over 16, and click on it to select it. To add a submenu item, right-click on the Primary menu item, and click on Add Submenu: Click on the first submenu item, and enter Secondary, and then perform the following steps: In the Widget Interactions and Notes pane, click on the Menu Item Name text field, and type MenuSecondary. In the Widget Interactions and Notes pane, click on the Interactions tab, and then click on Add Case…. In the Case Editor (OnClick) pop up, in Case description, rename the case description OpenSecondaryPage. In Click to add actions, click on Open Link. In Organize actions, you will see the interaction description update to Open Link in Current Window. In Configure actions, click on the radio button next to Link to a page in this design, and then click on Secondary Page. Click on OK. Right-click on the second and third submenu items, and click on Delete Menu Item. In the Masters pane, double-click on the BreadCrumb Master to select it. While holding down the mouse button, drag the Dynamic Panel widget, and place it on the wireframe. Change the x: and y: coordinates and w: and h: to be: With the Dynamic Panel selected, perform the following steps: In the Widget Interactions and Notes pane, click on the Dynamic Panel Name text field, and then type BreadCrumb. In the Widget Manager, rename State1 Home. Add states to Dynamic Panel as follows: Primary, Secondary, Tertiary,Category, Product, and Content. With Dynamic Panel selected, perform the following steps: Double-click on the state labeled Primary in the Dynamic Panel Manager. While holding down the mouse button, drag a Label widget and place it on the wireframe at coordinates (0,6). Enter Homeas the text on the Label widget. In the Widget Interactions and Notes pane, click on the Shape Name text field, and then type HomeBreadCrumbLink. In the Widget Interactions and Notes, pane click on the Interactions tab, and then click on Add Case…. In the Case Editor (OnClick) pop up, in Case description, rename the case description OpenHomePage. In Click to add actions, click on Open Link. In Organize actions, you will see the interaction description update to Open Link in Current Window. In Configure actions, click on the radio button next to Link to a page in this design, and click on Home page. Click on OK. You will now focus on building the Dynamic Panel states Primary, Secondary, Tertiary, Category, Product, and Content. The following screenshot shows what the Primary state will look like: To build the Dynamic Panel states Primary, Secondary, Tertiary, Category, Product, and Content, with the Dynamic Panel selected perform the following step: Repeat step 27, changing the step each time with the following information: Panel State Coordinates for Label Widget Label Text Shape Name Case description Configure Actions Link to Primary (0,6) Home HomeBreadCrumbLink OpenHomePage Home Primary (55,6) Primary PrimaryBreadCrumbLink OpenPrimaryPage Primary Page Secondary (0,6) Home HomeBreadCrumbLink OpenHomePage Home Secondary (55,6) Primary PrimaryBreadCrumbLink OpenPrimaryPage Primary Page Secondary (115,6) Secondary SecondaryBreadCrumbLink OpenSecondaryPage Secondary Page Tertiary (0,6) Home HomeBreadCrumbLink OpenHomePage Home Tertiary (55,6) Primary PrimaryBreadCrumbLink OpenPrimaryPage Primary Page Tertiary (115,6) Secondary SecondaryBreadCrumbLink OpenSecondaryPage Secondary Page Tertiary (200,6) Tertiary TertiaryBreadCrumbLink OpenTertiaryPage Tertiary Page Category (0,6) Home HomeBreadCrumbLink OpenHomePage Home Category (55,6) Category CategoryBreadCrumbLink OpenCategoryPage Category Page Product (0,6) Home HomeBreadCrumbLink OpenHomePage Home Product (55,6) Category CategoryBreadCrumbLink OpenCategoryPage Category Page Product (125,6) Product Detail DetailBreadCrumbLink OpenDetailPage Product Detail Page Content (0,6) Home HomeBreadCrumbLink OpenHomePage Home Content (55,6) Content ContnetBreadCrumbLink OpenContentPage Content Page To populate the Template Master with the component masters (for example, Header, Menu, and BreadCrumb Masters), perform the following steps: In the Masters pane, double-click on the Template Master to select it. While holding down the mouse button, drag the Header Master, and place it anywhere on the wireframe. In step 4, you specified Lock to Master Location for the Drop Behaviour of each Master. This causes the widgets in each Master to maintain their x and y coordinates no matter where the Master is placed in a wireframe. While holding down the mouse button, drag the Menu Master, and place on the wireframe. While holding down the mouse button, drag the BreadCrumb Master, and place it on the wireframe. While holding down the mouse button, drag the Template Master, and place it anywhere on the wireframe. The Template Master will align to the fixed X and Y coordinates. Below the wireframe, click on the Page Interactions tab, and double-click on the OnPageLoad interaction. In the Case Editor (OnPageLoad) pop up, perform the following steps: In Case description, rename the case description SetBreadCrumbState. In Click to add actions, click on Dynamic Panels to expand, and then click on Set Panel State. In Organize actions, you will see the interaction description update to Set Panel to State. In Configure actions under Select the panels to set the state, click on the checkbox next to the Label for the Breadcrumb (Dynamic Panel). Click on the Select the state dropdown, and mouse over Home. Click on Home to select it. You will see the interaction description under Organize actions update to read. Set Template/BreadCrumb/BreadCrumb Home. Click on OK. Repeat steps 30 to 32 for the remaining pages in Sitemap, modifying each OnPageLoad case to set the BreadCrumb state to the appropriate panel state corresponding to the selected page in Sitemap(for example, for the Primary page, the corresponding state would be Primary, and so on). You can now choose to preview or save a copy of the prototype. To preview the prototype, click on the preview button in the toolbar. To save a copy of the prototype, click on the Publish button in the toolbar, and select Generate HTML Files…. You can also generate the prototype by going to the main menu, selecting Publish, and clicking on Generate HTML Files…. How it works... For this recipe, you used Masters, a dynamic panel, a menu widget, and text widgets to create a dynamic BreadCrumb Master. You created four Masters: Template, Header, Menu, and BreadCrumb and set the behavior of each to Lock to Master Location. This retained the coordinates of the widgets placed on each Master when used on a page. The Template Master contained the Header, Menu, and BreadCrumb Masters. The Menu was labeled and linked to the corresponding pages in Sitemap. The BreadCrumb Master contained a dynamic panel that had a corresponding panel state for each of the pages in Sitemap. For each individual panel state, label widgets were used and linked to the corresponding page in the sitemap. When a page is loaded, the Page Interaction OnPageLoad event sets the state of the BreadCrumb dynamic panel to show the correct BreadCrumb state. Generating a dynamic welcome message Using variables, you can set widget values and text dynamically. For example, when a page loads, you could show the user a welcome message based on the day of the week. Getting ready In this recipe, you are going to explore using built-in variables in expressions. You will show the user a welcome message using the DayOfWeek variable. How to do it... Perform the following steps: Start Axure and under Create New select RP File. If you already have Axure open, select File in the main menu, and then click on New in the drop-down menu to create a new RP document. While holding down the mouse button, drag the Label widget, and place it on the wireframe at (53,13). With the Label widget selected, in the Widget Interactions and Notes pane, click on the field below Shape Name, and then type WelcomeText. In the Page Properties pane, click on the Page Interactions tab and double-click on the OnPageLoad interaction. The page will appear as shown in the following screenshot: In the Case Editor (OnPageLoad) pop up, in Case description, type DisplayMessage. In Click to add actions, click on Set Text. In Organize actions, you will see the interaction description update to Set Text In Configure actions, under Select the widgets to set text, click in the checkbox next to Label for the Welcome Text (Shape). In Configure actions under Set text to, set the dropdown to value, and click on the fx button to bring up the Edit Text pop up. In the Edit Text popup, enter in the text field Welcome. Today is. Click on the Insert Variable or Function... link to open the drop-down menu; scroll to Date; click on Date to expand the selection; and click on getDayOfWeek(), as shown in the following screenshot: Click on OK. You can now choose to preview or save a copy of the prototype. To preview the prototype, click on the preview button in the toolbar. To save a copy of the prototype, click on the Publish button in the toolbar, and select Generate HTML Files…. You can also generate the prototype by going to the main menu, selecting Publish, and then clicking on Generate HTML Files…. How it works... For this recipe, you used the Label widget, and using the Widget Interactions and Notes pane, you applied a label to the widget. Next in the Page Properties pane, you set a case on the OnPageLoad interaction to Set Variable/Widget value(s). Finally, in the Edit Text popup, you used a built-in variable. There's more... At times you may find that your Label widget is not displaying the built-in variable. One possible cause is that the length of the Label widget is not long enough to display all of the characters. For a list of variables available in Axure 7, visit http://www.axure.com/forum/tips-tricks-examples/8030-v7-variables-list.html
Read more
  • 0
  • 0
  • 1180
Modal Close icon
Modal Close icon