Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
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

7019 Articles
article-image-extending-opencms-developing-custom-widget
Packt
16 Oct 2009
8 min read
Save for later

Extending OpenCms: Developing a Custom Widget

Packt
16 Oct 2009
8 min read
Structured Content Types Support for structured content is a key feature of OpenCms. Structured content types allow different templates to be used to re-skin a site, or to share content with other sites that have a different look. Structured content types are defined by creating XSD schemas and placing them into modules. Once a new content type has been defined, the Workplace Explorer provides a user interface to create new instances of the content and allows it to be edited. There are some sample content types and templates that come with the Template One group of modules. These content types are very flexible and allow a site to be built using them right away. However, they may not fit our site requirements. In general, site requirements and features will determine the design of the structured content types and templates that need to be developed. BlogEntry Content Type For designing a blog website it is required that the content type contains blog entries. The schema file for the BlogEntry content type looks like the following : <!-- ======================================================== Content definition schema for the BlogEntry type ========================================================== --> <!-- 1. Root Element --> <xsd:schema elementFormDefault="qualified"> <!-- 2. Define the location of the schema location --> <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/> <!-- 3. Root element name and type of our XML type --> <xsd:element name="BlogEntrys" type="OpenCmsBlogEntrys"/> <!-- 4. Definition of the type described above --> <xsd:complexType name="OpenCmsBlogEntrys"> <xsd:sequence> <xsd:element name="BlogEntry" type="OpenCmsBlogEntry" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <!-- 5. Data field definitions --> <xsd:complexType name="OpenCmsBlogEntry"> <xsd:sequence> <xsd:element name="Title" type="OpenCmsString" minOccurs="1" maxOccurs="1" /> <xsd:element name="Date" type="OpenCmsDateTime" minOccurs="1" maxOccurs="1" /> <xsd:element name="Image" type="OpenCmsVfsFile" minOccurs="0" maxOccurs="1" /> <xsd:element name="Alignment" type="OpenCmsString" minOccurs="1" maxOccurs="1" /> <xsd:element name="BlogText" type="OpenCmsHtml" minOccurs="1" maxOccurs="1" /> <xsd:element name="Category" type="OpenCmsString" minOccurs="0" maxOccurs="10" /> </xsd:sequence> <!-- 6. locale attribute is required --> <xsd:attribute name="language" type="OpenCmsLocale" use="required"/> </xsd:complexType> <!—optional code section --> <xsd:annotation> <xsd:appinfo> <!-- Mappings allow data fields to be mapped to content properties --> <mappings> <mapping element="Title" mapto="property:Title" /> <mapping element="Date" mapto="attribute:datereleased" /> </mappings><!-- Validation rules for fields --> <validationrules> <rule element="BlogText" regex="!.*[Bl]og.*" type= "warning" message="${key.editor.warning.BlogEntry. dontallowblog|${validation.path}}"/> </validationrules> <!-- Default values for fields --> <defaults> <default element="Date" value="${currenttime}"/> <default element="Alignment" value="left"/> </defaults> <!-- user interface widgets for data fields --> <layouts> <layout element="Image" widget="ImageGalleryWidget"/> <layout element="Alignment" widget="SelectorWidget" configuration="left|right|center" /> <layout element="Category" widget="SelectorWidget" configuration="silly|prudent|hopeful|fearful| worrisome|awesome" /> <layout element="BlogText" widget="HtmlWidget"/> </layouts> <!-- UI Localization --> <resourcebundle name="com.deepthoughts.templates.workplace"/> <!-- Relationship checking --> <relations> <relation element="Image" type="strong" invalidate="node" /> </relations> <!-- Previewing URI --> <preview uri="${previewtempfile}" /> <!-- Model Folder for content models --> <modelfolder uri="/system/modules/com.deepthoughts.templates /defaults/" /> </xsd:appinfo> </xsd:annotation> </xsd:schema> The BlogEntry content type file is named as blogentry.xsd and it placed in the folder named schemas in modules. Designing a Custom Widget Referring to the highlighted code in BlogEntry content type schema file we can see that the category field is populated from a drop-down list provided by SelectorWidget. The SelectorWidget obtains its values from the static configuration string defined within the blog schema file. This design is problematic as we would like category values to be easily changed or added. Ideally, the list of category values should be able to be updated by site content editors. Fortunately, we can create our own custom widget to handle this requirement. An OpenCms widget is a Java class that implements the I_CmsWidget interface, located in the org.opencms.widgets package. The interface contains a number of methods that must be implemented. First there are some methods dealing with instantiation and configuration of the widget: newInstance: This returns a new instance of the widget. setConfiguration: This method is called after the widget has been initialized to configure it. The configuration information is passed as a string value coming from the declaration of the widget within the schema file of the content type using it. getConfiguration: This is called to retrieve the configuration information for the widget. Next, there are some methods used to handle the rendering. These methods are called by widget enabled dialogs that might be used in a structured content editor or an administration screen. The methods provide any Javascript, CSS, or HTML needed by the widget dialogs: getDialogIncludes: This method is called to retrieve any Javascript or CSS includes that may be used by the widget. getDialogInitCall: This method may return Javascript code that performs initialization or makes calls to other Javascript initialization methods needed by the widget. getDialogInitMethod: This method may return Javascript code containing any functions needed by the widget. getDialogHtmlEnd: This method is called at the end of the dialog and may be used to return an HTML or Javascript needed by the widget. getDialogWidget: This method returns the actual HTML and Javascript used to render the widget along with its values. getHelpBubble: This method returns the HTML for displaying the help icon relating to this widget. getHelpText: This method returns the HTML for displaying the help text relating to this widget. Lastly, there are some methods used to get and set the widget value: getWidgetStringValue: This method returns the value selected from the widget. setEditorValue: This method sets the value into the widget. All these methods have base implementations in the A_CmsWidget class. In most cases, the base methods do not need to be overridden. As such, we will not cover all the methods in detail. If it is necessary to override the methods, the best way to get an idea of how to implement them is to look at the code using them. All widgets are used in dialog boxes which have been enabled for widgets, by implementing the I_CmsWidgetDialog interface. There are two general instances of these dialogs, one is used for editing structured XML content, the other is found in any dialog appearing in the Administration View. The two classes implementing this interface are: org.opencms.workplace.CmsWidgetDialog org.opencms.workplace.editors.CmsXmlContentEditor The CmsWidgetDialog class is itself a base class, which is used by all dialogs found in the Administrative View. Before designing a new widget, it is useful to examine the existing widget code. The default OpenCms widgets can be found in the org.opencms.widgets package. All the widgets in this package subclass the A_CmsWidget class mentioned earlier. Often, a new widget design may be subclassed from an existing widget. Designing the Widget As mentioned earlier, we would like to have a widget that obtains its option data values dynamically rather than from a fixed configuration string value. Rather than create a widget very specific to our needs, we will use a flexible design where the data source location can be specified in the configuration parameter. The design will allow for other data sources to be plugged into the widget. This way, we can use a single widget to obtain dynamic data from a variety of sources. To support this design, we will use the configuration parameter to contain the name of a Java class used as a data source. The design will specify a pluggable data source through a Java interface that a data source must implement. Furthermore, a data source can accept parameters via the widget configuration string. With this design, an example declaration for a widget named CustomSourceSelectWidget would look like this: <layout element="Category" widget="CustomSourceSelectWidget" configuration="source='com.widgets.sources.MySource'| option1='some config param'| option2='another param'" /> This declaration would appear in the schema of a content type, using the widget as covered earlier. The configuration parameter consists of name/value pairs, delimited by the vertical bar character. Each name/value pair is separated by the equal to sign and the value is always enclosed in single quotes. The design requires that at least the source parameter be specified. Additional parameters will depend upon the specific data source being used. The example declaration specifies that the data field named Category will use the CustomSourceSelectWidget widget for its layout. The configuration parameter contains the name of the Java class to be used to obtain the data source. The data source will receive the two parameters named option1 and option2 along with their values. Next, lets move on to the code to see how this all gets implemented.
Read more
  • 0
  • 0
  • 2519

article-image-earning-your-first-gold
Packt
16 Aug 2013
15 min read
Save for later

Earning Your First Gold

Packt
16 Aug 2013
15 min read
(For more resources related to this topic, see here.) You need to spend gold to make gold The adage "You need to spend money to make money" holds true in World of Warcraft as well. A lot of your income will come from manufacturing processes: taking raw materials (or mats) and turning them into finished goods for the end user. To expedite this process, we will be mostly buying the materials from the Auction House, and so you will need a sizeable supply of gold when you're starting out and building inventory. Unlike in the real world, where you can get investors or loans to start up a business, in World of Warcraft you will need to collect every bit of copper yourself. It's not until you have built up this starting capital that you can truly start making significant amounts of gold. There are a few ways to go about this and some players may be able to build capital while playing as they usually do, but most players will have to work at building this capital. All the methods in this section are designed to earn you gold, with time being the only investment; no gold needs to be invested. Once you've built your starting capital, you may find yourself moving away from these sources of revenue to focus on more lucrative markets. Reselling vendor pets There are many items that you can sell on the Auction House but vendor pets will be your best bet when trying to make gold. While your mileage may vary depending on your server's economy, there are certain vendors and items that are usually profitable. As with any other tip, you will have to confirm for yourself that this is pro fitable on your server. Even before Mists of Pandaria was announced and launched with its pet battles, pets were in great demand. There are several vendors scattered throughout Azeroth that sell pets; you can then resell the pets on the Auction House for a profit. There are two reasons why pets from these vendors can typically be sold for a profit over the vendor price: Players are too lazy to venture out into the world themselves to visit these vendors and buy the pets Players don't do their research and, when they see these pets on the Auction House, are unaware that they can get these pets from the vendors We'll take a look at some examples of where you can get pets from a vendor to sell on the Auction House. Always make sure you're selling these pets for a profit. As with most methods we will go over, this tactic's effectiveness is largely determined by your server's market. Be sure to check market prices for these pets before you go out and collect them (The Undermine Journal (https://theunderminejournal.com/) will help you with market research). Neutral vendors Players from either faction will be able to access these vendors and resell their wares on their faction-specific Auction House. One of these vendors is Dealer Rashaad at the Stormspire in Netherstorm and he can be found west of the flight master at Stormspire. The following screenshot shows the map of Netherstorm, and the player icon marks the location of Dealer Rashaad: Dealer Rashaad is marked with the <Exotic Creatures> tag and sells the following pets (as presented by the vendor, from left to right, top to bottom): Parrot Cage (Senegal): Purchase for 40 silver Cat Carrier (Siamese): Purchase for 60 silver Undercity Cockroach: Purchase for 50 silver Crimson Snake: Purchase for 50 silver Brown Rabbit Crate: Purchase for 10 gold Red Moth Egg: Purchase for 10 gold Blue Dragonhawk Hatchling: Purchase for 10 gold Mana Wyrmling: Purchase for 40 gold Dealer Rashaad has associations with the faction The Consortium, and so these pets will appear cheaper, depending on your reputation with this faction (up to 20 percent off if you have Exalted reputation). Another pet vendor you should visit is Breanni (tagged as <Pet Supplies>) at Magical Menagerie in the city of Dalaran in Crystalsong Forest, Northrend. The following screenshot shows the map of Dalaran and the player icon marks the location of Breanni: Breanni sells the following pets (listed in order of appearance): Cat Carrier (Calico Cat): Purchase price 50 gold Albino Snake: Purchase price 50 gold Obsidian Hatchling: Purchase price 50 gold Breanni also sells accessories for pets but, since these are Bind on Pickup items, you will not be able to sell them on the Auction House. There are several vendors that sell only one or two pets; while you can sell many of these on the Auction House as well, you will have to determine for yourself if the profit margins are worth your time spent in collecting them. The following is a list of these pets and their vendors. Only those pets that can be purchased for gold (or silver) are included in this list as there are several that can be purchased for other currencies: Ancona Chicken: Plucky Johnson in Thousand Needles Tree Frog Box: Flik at the Darkmoon Faire Wood Frog Box: Flik at the Darkmoon Faire Winterspring Cub: Michelle De Rum in Winterspring Parrot Cage (Cockatiel): Narkk in Booty Bay To make the most of these pet vendors, buy multiples of each pet (at least three to five of each) and store the spares in a bank while you are selling them. Doing this limits the number of repeat trips you have to make and makes it more worth your while. Be sure to empty your bags as much as possible when going out to fetch these pets. While being at Friendly reputation or better with these vendors can fetch you a discount of five to 20 percent, the amount of time it takes to reach these reputations is not really worth the discount. That being said, if you have a character that you know gets a discount with these vendors, use it to collect the pets and get the five to 20 percent discount on the purchase price. If you have trouble finding any of these pets, you can go to http://www.wowhead.com, which is a database of all the items, vendors, achievements, and more. Wowhead has every vendor listed and a map of where to find the vendors.  Pets from in-game events During most in-game holidays, there is a selection of pets you can buy with the holiday-specific currencies (typically tokens). While it's likely that it won't be worth your time to gather these currencies specifically to buy these pets, only you can decide what is worth your time; you might want to have these currencies anyway. Note that these pets are related to specific events only and are not available all year round. These pets are as follows: Captured Flame: 350 Burning Blossoms (Midsummer Fire Festival) Purchasable at vendors in every major city for every major faction during the course of the Midsummer Fire Festival Feline Familiar: 150 Tricky Treats Purchasable at vendors in Undercity and Elwynn Forest as part of the Hallow's End festivities Sinister Squashling: 150 Tricky Treats Purchasable at vendors in Undercity and Elwynn Forest as part of the Hallow's End Festivities Spring Rabbit's Foot: 00 Noblegarden Chocolate Purchasable at various vendors outside every major Alliance or Horde city as part of the Noblegarden festivities Pint-Sized Pink Pachyderm: 100 Brewfest Tokens Purchasable at vendors in Dun Morogh, Durotar, Ironforge, and Orgrimmar as part of Brewfest Activities Lunar Lantern and Festival Lantern: 50 Coins of Ancestry each Purchasable at vendors in Moonglade during the Lunar Festival event Truesilver Shafted Arrow: 40 Love Tokens Purchasable at vendors in all major Alliance and Horde cities during the Love is in the Air event These pets are available in plenty during and shortly after the events, so to get the best price out of your hard work, hold on to the pets for a month or more after the event ends. Some of these pets do drop (not significantly, though) as part of the incentive for Call to Arms but the largest supply comes from the events themselves. The currencies for these pets are obtained through quests and achievements related to the event and can thus only be obtained while the event is active. Many players choose to do these events anyway (for achievements or for the sake of completion), so you might find that selling these pets is an easy way to make extra gold. If you have any problems with the quests or achievements, the posts on Wowhead will typically have advice and the writers at WoW Insider (http://wow.joystiq.com) put up guides every year for the events. Faction-specific vendors and pets Each faction, Alliance and Horde, has a selection of pets that are specific to it. While you can sell them on your home Auction House, you can often get much better prices on the neutral Auction House, where you can sell to the opposite faction because this, and faction transfers, which cost money, are the only ways for them to get the pets. Keep in mind though that the neutral Auction House charges a higher fee—they charge a 15 percent cut on sales — so be wary when selling and adjust your profi t margins accordingly. As with the faction-neutral pets, these pets are broken into two categories: Purchasable with standard currency (gold, silver, and copper) Purchasable with other currencies Alliance The list of Alliance vendors with pets available for standard currency is as follows: Donni Anthania <Crazy Cat Lady>, Elwynn Forest: Cat Carrier (Bombay): Costs 40 silver Cat Carrier (Cornish Rex): Costs 40 silver Cat Carrier (Orange Tabby): Costs 40 silver Cat Carrier (Silver Tabby): Costs 40 silver Yarlyn Amberstill, Dun Morogh: Rabbit Crate (Snowshoe): Costs 40 silver Shylenai <Owl Trainer>, Darnassus: Great Horned Owl: Costs 50 silver Hawk Owl: Costs 50 silver Sixx <Moth Keeper>, The Exodar: Blue Moth Egg: Costs 50 silver White Moth Egg: Costs 50 silver Yellow Moth Egg: Costs 50 silver Lil Timmy <Boy with kittens>, Stormwind, rare spawn: Cat Carrier (White Kitten): Costs 60 silver The White Kitten especially commands a good price on the Auction House as it's difficult to get even for Alliance players, so always keep an eye out for Lil Timmy when you are in Stormwind. Finally, for those who are champions in the Argent Tournament with the playable races on the Alliance side, you can buy pets at the Argent Tournament for 40 Champion's Seals. All the vendors can be found in the Alliance tent on the north-east corner of the Argent Tournament grounds. The following screenshot shows the map of Icecrown; the player icon marks the location of the Alliance team: The pets available to Alliance players are as follows: Teldrassil Sproutling, Darnassus Mechanopeep, Gnomeregan Ammen Vale Lashling, Exodar Elwynn Lamb, Stormwind Dun Morogh Cub, Ironforge? Shimmering Wyrmling, Silver Covenant The Argent Tournament champions do well on the Alliance Auction House as well since no one plays the Argent Tournament any more and unlocking the pets requires a significant amount of work. Horde The list of Horde vendors with pets available for standard currency is as follows: Xan'tish <Snake Vendor>, Orgrimmar: Black Kingsnake: 50 silver Brown Snake: 50 silver Crimson Snake*: 50 silver Halpa <Prairie Dog Vendor>, Thunder Bluff: Prairie Dog Whistle: 50 silver Jeremiah Payson <Cockroach Vendor>, Undercity: Undercity Cockroach*: 50 silver Jilanne, Eversong Woods: Golden Dragonhawk Hatchling: 50 silver Red Dragonhawk Hatchling: 50 silver Silver Dragonhawk Hatchling: 50 silver Pets with an asterisk (*) next to them can also be purchased from a faction-neutral vendor and so may not get the same price on the neutral Auction House. Champions of the Horde's main races can get pets from the Argent Tournament for 40 Champion's Seals. To be able to buy any of these pets, a player must be a champion of the race that the particular pet is associated with. All the vendors for these pets can be found in the Horde tent at the Argent Tournament on the south-east corner of the grounds. The following screenshot shows the map of Icecrown; the player icon marks the location of the Horde tent: Fishing Fishing, one of the original secondary professions, is a convenient way to make gold with no real start-up costs. You don't need to level Fishing to make gold with it; you can train it and start fishing up valuable fish straightaway. Without max fishing, you can still fish from pools around Pandaria; the fish can then be sold on the Auction House to players looking to make buff foods. Make sure to only fish from pools if you don't have max fishing as a lower skill level in Fishing makes it almost impossible to pull any fish (except Golden Carp) from open waters. The following screenshot shows a character fishing from a pool in Pandaria: The Tillers, farming, and Sunsong Ranch Every player, over the course of leveling, will come across the Sunsong Ranch. The ranch is an excellent source of income for those who don't have the capital or professions to start the gold-making methods discussed later in this book. The ranch is basically 16 plots of soil (you start out with four and then unlock an additional four at every reputation level with the Tillers) where you can plant seeds for vegetables and other items such as Motes of Harmony. With the vegetables, you can either create buff food (requires 600 Cooking) or sell them on the Auction House to other players (who will more than likely be using them to create buff foods themselves). A copper saved is a copper earned A surprising amount of gold can be saved by nickel-and-diming everything in the game; when you're putting so much work into building up your pile of gold, you don't want to waste it! To keep inflation in check and the economy from getting out of hand, World of Warcraft has several gold sinks to try and keep the gold that is leaving the economy balanced with the gold entering it. One of the biggest gold sinks is armor repair, and an untold amount of gold is lost to this necessity every day. Luckily, there are ways to minimize how much gold is syphoned out of your pockets and into the repair vendors'. Vendors that are associated with factions (typically displayed in the way a player's guild would be, that is, in brackets under the name) give players discounts if they have a reputation with the faction. Discounts start at Friendly with 5 percent and continue all the way through to Exalted, which offers a 20 percent discount; and yes, this discount applies to repairs as well. What this means is that players can save up to 20 percent on their repair bills by repairing only at vendors. Obviously, you can't always get to a vendor you have Exalted reputation with but simply paying attention to where you repair can save you some serious gold. Make sure to repair before you go out into the world or get into a raid and resist the temptation of repairing between every wipe. Guilds can give many perks that provide you with ways to save gold. Guilds level 9 and higher have a perk that reduces the durability loss your gear experiences when you die or take damage. This means you need to repair your gear less often, which in turn means you have to spend less gold to keep it in good condition. Also, look into items before you buy them as sometimes, even though you can find them on a vendor, you can find them cheaper on the Auction House or vice versa. As we discussed in the previous section, there's a whole market for buying items from a vendor and selling them on the Auction House, so be an informed buyer! Similarly, there are some items, such as Disappearance Dust, which are often sold cheaper on the Auction House because it's cheaper to produce them through Inscription than it is to buy them from the vendor. Costs associated with the Auction House There are several places where you can reduce the amount of gold you lose when posting items on the Auction House. There are two ways you lose gold when posting items in the Auction House: Auction House cuts on sales: 5 percent is cut at Alliance and Horde Auction Houses 15 percent is cut at the neutral Auction House Lost deposits on expired or cancelled auctions When using the Auction House, it will benefit you greatly to be diligent in how you post. Don't use the neutral Auction House except for selling faction-specific items (the items that only players from one faction can obtain). Attempting to use the neutral Auction House for any other items will be futile; the few sales you actually make will be cut heavily and you'll waste way too much gold on deposits. On that note, it's best to limit how long you post auctions for as the longer the auction, the higher the deposit required. When an auction expires or is canceled, you don't get your deposit back, so if you know you will be canceling a lot of auctions, don't post your auctions for 48 hours; instead, post for 24 hours, if you don't have a lot of time to dedicate to the game, or for 12 hours if you can check the Auction House more frequently.
Read more
  • 0
  • 0
  • 2516

article-image-faq-installing-and-using-ibm-lotus-sametime-8-mobile-client
Packt
22 Nov 2010
10 min read
Save for later

FAQ on Installing and Using the IBM Lotus Sametime 8 Mobile Client

Packt
22 Nov 2010
10 min read
  IBM Lotus Sametime 8 Essentials: A User's Guide Mastering Online Enterprise Communication with this collaborative software Collaborate securely with your colleagues and teammates both inside and outside your organization by using Sametime features such as instant messaging and online meetings Make your instant messaging communication more interesting with the inclusion of graphics, images, and emoticons to convey more information in fewer words Communicate with other instant messaging services and users, such as AOL Instant Messaging, Yahoo Instant Messaging, and Google Talk and know how someone's online status can help you communicate faster and more efficiently Discover how the Sametime Meeting Center can maximize the productivity of teams in your organization with the use of online meetings, training session playback, seamless voice/video integration, and screen sharing See how Sametime works in common, every-day, real-world situations with tips, resources, and detailed screenshots         Q: Show some instances where Sametime would be most useful? A: The following cases highlight a few instances where Sametime is most useful: Lisa is waiting on some information from a team member for a project deadline, but she's away from her desk. However, she has Sametime Mobile installed on her Windows Mobile 6 device and she can connect during her board meeting. Juan is on a long distance trip between countries. He doesn't want to pull his laptop down from the overhead bins, but he does have his Blackberry available to chat with his staff in the home office since he has Sametime Mobile installed. He can set his presence awareness to unavailable once he's in the air. Logan needs some contract information during a lengthy meeting. He can ping his project team for any detail clarification from his Blackberry using Sametime Mobile, without disrupting the meeting.   Q: Which are the supported devices for Sametime Mobile? A: Sametime Mobile is available for a number of mobile operating systems and devices. Devices include those that support the Microsoft Windows Mobile operating system, Research in Motion Blackberry devices, Sony Ericsson cell phones, and Nokia Eseries devices. As new devices are made available on a continual basis, check both your mobile device website as well as the IBM Sametime support site (http://www-01.ibm.com/support/docview.wss?rs=477&uid=swg27013765) for updated information about which devices are supported. Research in Motion provides downloads for Sametime for new devices from their website at http://www.blackberry.com. Windows MobileWindows Mobile 2003 Second Edition Pocket PCWindows Mobile 5 Pocket PCWindows Mobile SmartphoneWindows Mobile 6 StandardWindows Mobile 6 ProfessionalResearch in Motion BlackberryBlackberry 7100Blackberry 8100Blackberry 8300Blackberry 8700Blackberry 8800Blackberry 8900Blackberry 9000Sony EricssonM600iP990iP1iNokiaEseries Q: How do we Package the Sametime Mobile client for download? A: As part of the Sametime server installation, files for each of the mobile platforms are included in subdirectories on your organization's Sametime server. Your Sametime administrator makes these files available to you via configuration options. These files will have specific file extensions based on what type of device you have. For example, the files for Sametime Mobile on the Windows Mobile operating system are packaged as a .cab file, while .cod and .alx files are part of the Blackberry download package. Your Sametime administrator will also provide you with a website that will provide access to the files. Q: How to download and install Sametime Mobile? A: To begin using Sametime Mobile, you must first download and install the application to your mobile device. The installation steps will be specific to the type of device you are using. The process first begins with accessing the download website provided to you by your Sametime administrator. Depending on your device you might use Internet Explorer (Windows Mobile), a browser for mobile phones like Opera, or the Blackberry browser specifically designed for the Blackberry. The URL will be similar to the following: http://sametime.topchefs.com/mobile/.When the main download page appears, it will look much like the following screenshot: You'll need to select your language and the device type and then select Download. You may be prompted for a user ID and password at this point. Your Sametime administrator should provide you with this information. Our example here shows a login screen for a Windows Mobile device: If your organization or company uses a Blackberry Enterprise Server, they may have configured the server to deploy the Sametime client "over the air" to your device. This means that the Sametime client application may be pushed to your device without any interaction on your part, because the Blackberry Enterprise Server can push out software updates. You can also download the Sametime client from the Blackberry website at http://na.blackberry.com/eng/services/server/domino/lotus_software.jsp#tab_tab_sametime. This method uses the Blackberry desktop manager to upload the Sametime client to your Blackberry device using the combination of .cod and .alx files provided in the install packages. Your Sametime administrator will provide you with a user ID and password for use to login to your organization's Sametime server. The installation of Sametime Mobile for Windows Mobile includes a couple of extra steps. This installation includes a configuration file that must be downloaded to the device. You should check with your Sametime administrator for additional information if you have questions in this situation. Q: How to use the Sametime Mobile client? A: So you've downloaded the Sametime Mobile client to your mobile device. Let's confirm that you have installed the application and that you can login and start the application successfully! On the following pages we'll use a Blackberry 8900 or a Windows Mobile 6 device as our working models for the Sametime Mobile images. We're going to cover a number of options and features and they may display somewhat differently depending on the device you use. So as we're going through these options, try to focus more on the function that's being shown rather than the specifics of what is being displayed on the screen. Microsoft® Windows® Mobile: Choose Start | Programs | Sametime. BlackBerry: Open the Instant Messaging folder; choose the Enterprise Messaging or Sametime application. Nokia: Open the Installations folder, choose the Sametime application. Sony Ericsson: Open the Tools folder, choose the Sametime application. Your Blackberry device will show an icon that looks similar to the following screenshot: The Windows Mobile Device Sametime icon will be similar to the following screenshot: Q: How to log into Sametime Mobile? A: To login to Sametime, enter the Sametime user ID and password that your Sametime administrator has provided to you. This would be most likely the user ID and password that you use with the Sametime Embedded client or the Sametime Connect client. You have the ability to save the password and will automatically login the next time you open Sametime on your device. Please note, while it is more convenient to have the device remember your password here, make sure to consult the security policies of your organization when saving a password to a mobile device. Always set a device password for your mobile device, so that in the event that the device is stolen or lost, your accounts and data can't be accessed. The following depicts the login screen for the Sametime client on a Blackberry device: As we explained earlier, we're going to show screens from both a Blackberry and a Windows Mobile device. We assume that you are familiar with navigating to menu options as one of those device users. Q: How to begin a chat? A: When you login, you'll see a list of all your active chats, as well as your contact list groups. You can click on any group name in order to expand it to see the names of the people you have in that group. To begin chatting with a contact, move your device cursor and select their name. A blank chat window will appear with a panel for you to begin typing. Your chat conversation will appear in the chat window. Within the Sametime Mobile client itself, there are option menus to view your contact list, groups, etc. In this example the Blackberry has a pop-up menu that lets you accomplish a number of tasks such as adding a new contact or sending a message to someone. Emoticons help to convey emotion and "body language" in text messages that could be misread without any verbal or body language context. In Sametime Mobile you still have that feature available to you. When you're chatting with someone, you will see a small smiley icon to the right of your chat input field (if you're on a Blackberry) or an Insert Emoticon option. Sametime Mobile displays a screen of available emoticons that you can click on to insert into your chat message. (See the Blackberry version in the following screenshot.) As with the Sametime Embedded or Sametime Connect client, you can invite other contacts to join an ongoing chat. "Invite Other to Chat" or "Invite Others" will display as a menu option depending on your mobile device. This will display a list of your contacts and you can select one or more names to invite to your current chat. Q: How to Send an announcement? A: Have you ever wanted to "ping" a number of contacts at one time to let them know of a meeting room change? From the Sametime Mobile client you can send an announcement to all members of a group or choose individual contacts from the group list. This appears on their chat window as an announcement. If you need an easy method to notify a group of users, this is it! Q: How to enable Multiple chat conversations? A: Another feature that extends to the Sametime Mobile client is the ability to have multiple chat conversations at one time. Regardless of whether you're in front of your computer or on your phone, people are not going to wait for you to finish one chat before you answer theirs. With your Blackberry, Windows Mobile, Sony, or Nokia phone, you'll be able to talk with multiple contacts at the same time. When you're participating in one chat and you receive an invitation to participate in another chat, you can choose the Chat List icon. Each new chat displays the Responding icon. Select the new chat you want to participate in and that chat window will display. On the Blackberry client the Chat List displays as a number of chats at the top of your contact list. Using the Chat List icon, you can move between chat windows, toggle between any of the chats included in the list, or choose to close all chat windows. Q: What are "quick responses"? A: You have the option to create prepared responses, also known as "quick responses", which you can store in your mobile device. These are handy when you're on a call or in a meeting, and can't respond to a chat. On a Windows Mobile device, this feature looks like the one shown in the following screenshot: To end a chat, you can select the menu option to "End Chat" or "Close Chat". Again, this depends on your mobile operating system as to how this will be displayed, but the function remains the same.
Read more
  • 0
  • 0
  • 2515

article-image-iphone-customizing-our-icon-navigation-bar-and-tab-bar
Packt
09 Dec 2011
7 min read
Save for later

iPhone: Customizing our Icon, Navigation Bar, and Tab Bar

Packt
09 Dec 2011
7 min read
  (For more resources on iPhone, see here.) The application icon and essential interaction elements such as the Navigation Bar and Tab Bar are crucial for the success of our work. The user will be tapping the icon every time they go to use our app, and interact with our navigation elements throughout their entire experience in our application. If we want success, we must focus on making these components attractive and functional. Attention to detail and the presentation of these pieces will be key, and we'll need to produce our best work if we want to stand out in a sea of apps. Designing an application icon and preparing it for the user home screen It's often said that a book shouldn't be judged by its cover, but the harsh reality of mobile development is that an app is often judged by its icon. This rounded rectangle will appear on the home screen of every user, and it's important that we create something that is attractive and also a good indication as to what the user should expect after downloading our application. In this recipe, we'll create a strategy for successful app icon design. Getting ready Adobe Photoshop will be our primary tool in the design of our app icon. It may also be helpful to grab some paper and a pencil so that we can sketch out any concepts we may have before we begin working on our computer. How to do it... The application icon is a primary component of any work. Appearing in the App Store, on a user's home screen, in Spotlight searches, and more, it's an important part of our job. Let's take a look at several steps that will be useful in the creation of our app icon: We should start by with either a rough sketch or Photoshop mockup of our intended design. We should create this mock up at several sizes to help represent the different resolutions at which our icon will be viewed. After we've developed an idea that we believe is going to scale well, its time to sit down in Photoshop or Illustrator and begin work on our icon. At this point, we need to determine what size canvas we want to design our icon on. Apple requires that our icon be available at a variety of sizes, with a 512 by 512 pixel square currently being the largest required format, but we should be prepared in case this requirement changes in the future and design our icon accordingly. There are two different ways we can go about making our icon "future proof". We can go about designing the icon in a vector format using an application like Adobe Illustrator. Vector drawings will always be the best way to ensure that our icon will scale to any size, but they can be a bit more difficult to create. If we're more comfortable using a raster image manipulation program like Photoshop, it's best to create our icon at a resolution well above what we'll ever need for the App Store, starting with a canvas of 4096 by 4096 pixels square or greater. Such a large raster size will give us a piece of art that will print comfortably on sizes as large as 13 inches when printed at 300 DPI, while also easily scaling down to whatever size we need for the App Store. Once we've decided which format we're most comfortable with, its time to go about creating our icon. Once we've completed our icon, it is time to prepare it for inclusion into our application. This icon should then be named apple-touch-icon.png and placed inside of our application bundle. iOS will then automatically add the glare effect to the top half of the icon, as seen throughout the interface. The Info.plist is a file that allows us to customize a bunch of different application attributes. We'll learn how to use it to remove the icon gloss effect in an upcoming recipe titled Removing the app icon's gloss effect. After finishing our icon, we may also want to run a small focus group, much like we would in order to gain feedback on our user interface design.We can quickly set up a simple website with a form asking for opinions on our design or even email an image of the icon to friends and family in order to facilitate feedback. When looking to gather opinion on our icon, we want to better understand a user's first impression of our icon. For a good portion of purchase decisions, the icon may be the only bit of insight into our app that the user has before tapping the buy button. We want to make sure that on first impression, the typical user associates our icon with quality, simplicity, and value. If our icon looks amateur, users probably won't consider our application for purchase. How it works... Icon design is tough, primarily because we're required to design a small square that represents our application's purpose, quality, and value. It's truly a challenge to design something that works well at 512 pixels and 27 pixels. Let's take a look at how the steps above work together to create a good icon. Resolution flexibility is arguably the difficult part of icon design, as our work needs to look great at 512 pixels by 512 pixels and at 27 by 27 pixels. Small details that look great at a high resolution can really make an icon indecipherable when scaled down to the lowest resolution required: In the above screenshot, we can quickly see how an icon becomes less legible as it decreases in size. It's necessary to provide the icon to Apple in several different sizes, which can vary depending upon the iOS device we're developing our application for and the current operating system requirements from Apple. These file sizes have varied significantly throughout the life of iOS, so we should verify the current requirements in the iOS Development Center before their creation. Sebastiaan De With keeps an excellent Photoshop file for iOS icon design, complete with resolution requirements, which he updates every time Apple changes the icon requirements. We can find the file here at http://blog.cocoia.com/2010/iphone-4-icon-psd-file/ and it should reference it while designing a new icon. When building our icon, we should really take time to think about what our icon should look like and what users will think when they first set eyes on it in the App Store. This set process works because it systematically creates a piece of work that will be optimized for the various needs of iOS. There's more... It may take a bit of practice to get a firm grasp on what makes a great or poor icon. Here are a few helpful ideas, just in case we're struggling to develop an icon that we're happy with. Dropping the text We should always refrain from including a great deal of text in our app icon. Text tends to become illegible when scaled down to small resolutions such as 27 x 27, so it is often best to keep text out of our icon. If we absolutely must include text in our icon, we should use short words that are large in size and in a bold typeface. Great gradients From an art design perspective, we'll probably be including an artistic gradient in our icon to offer the illusion of brushed metal or progressive lighting. But choosing a strong color palate for a gradient can be difficult. Dezigner Folio has created a large library of fresh, modern gradients that they've offered up for free use in any project. For the entire library, feel free to visit their website at http://www.dezinerfolio.com/2007/05/03/ultimate-web-20-gradients-v30-release. If all else fails.... If we're having a rough time with icon design and all else fails, we can always hire a freelance artist or design firm to help out with the production of our application icon. A quick search of Google can help us find a multitude of artists who have become specialists in the field of icon design. Finding a talented designer can actually be quite affordable, with many freelance artists charging a hundred dollars or less for a high quality icon. As icons can be produced in Photoshop, local graphic designers or students can help out at affordable rates as well.  
Read more
  • 0
  • 0
  • 2514

article-image-configuring-endpoint-protection-configuration-manager
Packt
01 Nov 2016
5 min read
Save for later

Configuring Endpoint Protection in Configuration Manager

Packt
01 Nov 2016
5 min read
In this article by Nicolai Henriksen, the author of the book Microsoft System Center 1511 Endpoint Protection Cookbook, we will cover how you need to configure Endpoint Protection in Configuration Manager. (For more resources related to this topic, see here.) This is the part where you need to think through every setting you make so that it does the impact and good you want in your organization. How to configure Endpoint Protection in Configuration Manager In order to manage security and malware on your client computers with Endpoint Protection. There are a few steps you must setup and configure in order to get it working in System Center Configuration Manager (SCCM). Getting ready In this article we assume that you have SCCM in-place and working. And have setup and installed the Software Update Point Role with its prerequisites like Windows Server Update Services (WSUS). Also you have planned and thought through what impact this has in your environment, a good understanding how this should and would work in your Configuration Manager hierarchy. How to do it… First we start with installing the Endpoint Protection Role from within the SCCM console. This role must be installed before you can use and configure Endpoint Protection. It must only be installed on one site system server, and it must be installed on top of your hierarchy, meaning if you have a Central Administration Site (CAS) you install in there, or if you have a stand-alone primary site you install it there. Be aware that when you install the Endpoint Protection Role on the site server it will also install the Endpoint Protection client on that same server. This is by default and cannot be changed. However services and scans are disabled so that you can still run any other existing anti-malware solution that you may already have in place. No real-time scanning or any other form of scanning will be performed by Endpoint Protection before you enable it with a policy. So be aware of this so that you don't accidentally enable it while having another anti-malware solution installed. Installing the Endpoint Protection Role is pretty easy and straight forward; these are the steps to manage that. To install and configure Endpoint Protection Role you open the Configuration Manager console, Click Administration. And in the Administration workspace you expand Site Configuration and click on Servers and Site System Roles. You click on Add Site System Roles in the picture shown below: On the next screen I choose to use as default settings that will use the server's computer Account to install the Role on the chosen server. In my case I have a single primary site server where all the Roles reside and this will require no other preparation. However, keep in mind that if you are adding Roles to other site system servers it will require that you add the primary site server's computer Account to the local Administrators group, or you could use an installation account as shown in the following figure: Let's click Next >. This is the page where we choose the Endpoint Protection Role that we want to install. It will only list up the Roles that you have not already added to the chosen server. Pay attention that it also warns you to have software updates and anti-malware definitions already in-place and deployed. The warring will show regardless weather you have this already in-place or not as shown in the next screenshot. The next page on the wizard it about the Microsoft Active Protection Service membership. I like to think of this as the cloud feature, and I encourage you to consider setting this to Advanced membership as that will give you and Microsoft a greater chance of dealing will the unknown type of malware. This will send more information from the infected client about the surroundings of the malware. And Microsoft can investigate the bits and pieces more thoroughly in their environment in the cloud service. If it turns out that this is infectious malware like a Trojan downloader for example, it will get further removal instructions directly and try its best to remove it automatically. Now this feature will work either way on what you choose, but it will work even better if you choose to share some more information. Most other anti-virus and anti-malware products don't ask about this, they just enable it. But Microsoft has chosen to let you decide. Because there could be situations that you might not want to share this at all. You can always choose Do not join MAPS in this page and decide individually in each Endpoint Protection Policy how you want it. Setting it here simply makes this the default setting for every policy made afterwards. Clicking Next > and Finish will start the installation of the Endpoint Protection Role and finish in a few minutes. In the Monitoring | Components status shown below you can see two components starting with SMS_ENDPOINT_PROTECTION that will have a green icon on the left and will tell you that the Role is installed. How it works… So we the Endpoint Protection Role is installed in our SCCM hierarchy as simple as that. But there are more configurations to do that will be the next topic. If you remember the Endpoint Protection client will always be installed on the site server that has the Endpoint Protection Role installed. But by default, it is with no scanning or real-time protection enabled, looks like this red icon on the task-bar on the right side as shown in the figure below. Summary In this article we learned that security is key aspect for any organization. Misconfiguration may have a very bad outcome as this has to do with security. Resources for Article: Further resources on this subject: Managing Application Configuration [article] CoreOS Networking and Flannel Internals [article] Zabbix Configuration [article]
Read more
  • 0
  • 0
  • 2514

article-image-visual-studio-2010-test-types
Packt
21 Dec 2010
9 min read
Save for later

Visual Studio 2010 Test Types

Packt
21 Dec 2010
9 min read
Software Testing using Visual Studio 2010 A step by step guide to understand the features and concepts of testing applications using Visual Studio. Master all the new tools and techniques in Visual Studio 2010 and the Team Foundation Server for testing applications Customize reports with Team foundation server. Get to grips with the new Test Manager tool for maintaining Test cases Take full advantage of new Visual Studio features for testing an application's User Interface Packed with real world examples and step by step instructions to get you up and running with application testing Software testing in Visual Studio 2010 Before getting into the details of the actual testing using Visual Studio 2010 let us find out the different tools provided by Visual Studio 2010 and their usage and then we can execute the actual tests. Visual Studio 2010 provides different tools for testing and management such as the Test List Editor and the Test View. The test projects and the actual test files are maintained in Team Foundation Server (TFS) for managing the version control of the source and the history of changes. Using Test List Editor we can group similar tests, create any number of Test Lists, and add or delete tests from a Test List. The other aspect of this article is to see the different file types generated in Visual Studio during testing. Most of these files are in XML format, which are created automatically whenever a new test is created. For the new learners of Visual Studio, there is a brief overview on each one of those windows. While we go through the windows and their purposes, we can check the Integrated Development Environment (IDE) and the tools integration into Visual Studio 2010. Testing as part of the Software Development Life Cycle The main objective of testing is to find the defects early in the SDLC. If the defect is found early, then the cost will be lower than when the defect is found during the production or implementation stage. Moreover, testing is carried out to assure the quality and reliability of the software. In order to find the defect as soon as possible, the testing activities should start early, that is in the Requirement phase of SDLC and continue till the end of the SDLC. In the Coding phase various testing activities take place. Based on the design, the developers start coding the modules. Static and dynamic testing is carried out by the developers. Code reviews and code walkthroughs are conducted by the team. Once the coding is complete, then comes the Validation phase, where different phases or forms of testing are performed: Unit Testing: This is the first stage of testing in the SDLC. This is performed by the developer to check whether the developed code meets the stated functionality. If there are any defects found during this testing then the defect is logged against the code and the developer fixes it. The code is retested and then moved to the testers after confirming the code without any defects for the purpose of functionality. This phase may identify a lot of code defects which reduces the cost and time involved in testing the application by testers, fixing the code, and retesting the fixed code. Integration Testing: This type of testing is carried out between two or more modules or functions together with the intention of finding interface defects between them. This testing is completed as a part of unit or functional testing and, sometimes, becomes its own standalone test phase. On a larger scale, integration testing can involve putting together groups of modules and functions with the goal of completing and verifying that the system meets the system requirements. Defects found are logged and later fixed by the developers. There are different ways of integration testing such as top-down and bottom-up. The Top-Down approach is intended to test the highest level of components and integrate first to test the high level logic and the flow. The low level components are tested later. The Bottom-Up approach is exactly opposite to the top-down approach. In this case the low level functionalities are tested and integrated first and then the high level functionalities are tested. The disadvantage of this approach is that the high level or the most complex functionalities are tested later. The Umbrella approach uses both the top-down and bottom-up patterns. The inputs for functions are integrated in the bottom-up approach and then the outputs for functions are integrated in the top-down approach. System Testing: This type of testing compares the system specifications against the actual system. The system test design is derived from the system design documents and is used in this phase. Sometimes system testing is automated using testing tools. Once all the modules are integrated, several errors may arise. Testing done at this stage is called system testing. Defects found in this type of testing are logged by the testers and fixed by the developers. Regression Testing: This type of testing is carried out in all the phases of the testing life cycle, once the defects logged by the testers are fixed by the developers or if any new functionality changes due to the defects logged. The main objective of this type of testing is testing with the intention of determining if bug fixes have been successful and have not created any new defects. Also, this type of testing is done to ensure that no degradation of baseline functionality has occurred and to check if any new functionality that was introduced in the software caused prior bugs to resurface. Types of testing Visual Studio provides a range of testing types and tools for testing software applications. The following are some of those types: Unit test Manual test Web Performance Test Coded UI Test Load Test Generic test Ordered test In addition to these types there are additional tools provided to manage, order the listing, and execution of tests created in Visual Studio. Some of these are the Test View, Test List Editor, and Test Results window. We will look at the details of these testing tools and the supporting tools for managing testing in Visual Studio 2010. Unit test Unit testing is one of the earliest phases of testing the application. In this phase the developers have to make sure the code is producing the expected result as per the stated functionality. It is extremely important to run unit tests to catch defects in the early stage of the software development cycle. The main goal of unit testing is to isolate each piece of the code or individual functionality and test if the method is returning the expected result for different sets of parameter values. A unit test is a functional class method test which calls a method with the appropriate parameters, exercises it, and compares the results with the expected outcome to ensure the correctness of the implemented code. Visual Studio 2010 has great support for unit testing through the integrated automated unit test framework, which enables the team to write and run unit tests. Visual Studio has the functionality to automatically generate unit test classes and methods during the implementation of the class. Visual Studio generates the test methods or the base code for the test methods but it remains the responsibility of the developer or the team to modify the generated test methods and to include the code for actual testing. The generated unit testing code will contain several attributes to identify the Test Class, Test Method, and Test Project. These attributes are assigned when the unit test code is generated from the original source code. Here is a sample of the generated unit test code. A Unit test is used by developers to identify functionality change and code defects. We can run the unit test any number of times and make sure the code delivers the expected functionality and is not affected by new code change or defect fix. All the methods and classes generated for the automated unit testing are inherited from the namespace Microsoft.VisualStudio.TestTools.UnitTesting. Manual test Manual testing is the oldest and the simplest type of testing but yet very crucial for software testing. The tester would be writing the test cases based on the functional and non-functional requirements and then testing the application based on each test case written. It helps us to validate whether the application meets various standards defined for effective and efficient accessibility and usage. Manual testing comes to play in the following scenarios: There is not enough budget for automation The tests are more complicated or too difficult to convert into automated tests Not enough time to automate the tests Automated tests would be time consuming to create and run The tested code hasn't stabilized sufficiently for cost effective automation. We can create manual tests by using Visual Studio 2010 very easily. The most important step in a Manual test is to document all the required test steps for the scenario with supporting information, which could be in a separate file. Once all the test cases are created, we should add the test cases to the Test Plan to be able to run the test and gather the test result every time we run the test. The new Microsoft Test Manager tool helps us when adding or editing the test cases to the Test Plan. The following are additional Manual testing features that are supported by Visual Studio 2010: Running the Manual test multiple times with different data by adding parameters Create multiple test cases using an existing test case to get the base test case first and then customize or modify the test Sharing test steps between multiple test cases Remove test cases from the test if not required Adding or copying test steps from Microsoft Excel or Microsoft Word or any other supported tool There are a lot of other manual testing features that are supported in Visual Studio 2010.  
Read more
  • 0
  • 0
  • 2513
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 $19.99/month. Cancel anytime
article-image-drupal-6-attachment-views-page-views-and-theming
Packt
24 Feb 2010
9 min read
Save for later

Drupal 6: Attachment Views, Page Views, and Theming

Packt
24 Feb 2010
9 min read
Looking at just about anything worth doing, a question will often arise beginning with the words, "How do I." Often the challenge can seem daunting. Then, one finally intuits, discovers or otherwise stumbles upon the answer and simultaneously is offered several alternative opinions, each being offered as the best way to accomplish the same goal. This is the case whether planning a vacation route, taking a photograph, or creating part or all of an application. There are a number of ways to accomplish what we will be doing in the article. If you spend any time on the Drupal IRC (Internet Relay Chat) channels, you will most likely receive varying opinions as to the best approach and, perhaps, come away more confused than when you started. Sometimes, there is no clear answer. One approach would be to write custom code. Another might be to use the Panels module. Each approach is valid, and has different pros and cons in terms of features, effort, learning curve, and time. Here, we're going to face each challenge in the same way, with attachment views, which means less coding, less time, and a smaller learning curve. A view is originally a relational database term, referring to a temporary arrangement of information in the database so that it can be presented in a meaningful way which is different than the underlying table layout. The Views module accomplishes the same thing, and provides the glue to tie itself in to the rest of Drupal and, especially, the ability to theme the result with templates. In other words, it gives you the ability to look at Drupal content in a way you would otherwise be unable to (without custom code). What is an Attachment view? A view is the dynamic display of one or more pieces of related content based on one or more criterion. What does that mean in practice? Let's consider a simple example. Let's say we have created a number of nodes of the content type 'Story' and assign one or more taxonomy terms to each. Having done that, we want to be presented with a list of teasers for each Story that has 'travel' as one of its taxonomy terms. It's a fairly common requirement. If you're familiar with Joomla!, for example, it could be accomplished by means of a Section or Category Blog page. The fact, though, is that the architecture that makes Drupal so extensible results in there being no manner in which to accomplish this using a core module. Enter the Views module, which will allow us to specify that we want a page on which we want to view x number of nodes, their selection based on certain criteria, which in this case will be nodes containing the taxonomy term 'travel'. That, in a nutshell, describes views at their simplest. Now, how about Attachment views? Well, to continue using the same example, let's say that our requirement has changed, and we don't always want a page based on every node having to do with travel, but want to be able to select destinations from a list of regions shown on the same page, as illustrated in the following figure. The box on the left shows the available travel regions, each of which is a taxonomy term, with Asia having been chosen. The boxes on the right are node teasers, each of which has Asia among its taxonomy terms. How can we accomplish this? One method would be to code a custom page in PHP and display it. That would work, but it would also set the page in stone to some extent, bypassing the flexibility that Drupal provides. We could also create a menu of destination regions and put it in the sidebar as a block. That would work too, but the menu would not be dynamic, and would have to be edited each time a region was added, changed, or removed. One further option would be to have two separate views. How can we have two views though? We could create one as a block, but let's say that the design calls for the selection choices to be in the content area of the page. So, that means we need to find a way to have both views as content. Enter Attachment views. Reviewing the view requirements The business for which our website is being built is a commercial builder's. As with most construction businesses, subcontractors represent the major source of labor. On this site, Subcontractors will be the user type that will need to register, in order to subsequently review jobs and bid for them. There will be other authenticated user types, such as management, job supervisors and admin, but they will have user records created for them and will not need to register. Customers will be anonymous users. To that end, a custom profile has been created for subcontractors, to capture the necessary information. We're using the content_profile module so that each subcontractor profile will be a node. We are going to have a menu from which the user will select a contractor for which the details will be displayed. For a given view, we can create various displays. A view to be displayed like a node will have a Page display—'Page' can be thought of as a web page—and one that is to be displayed as a block will have a Block display. Considering our menu of subcontractors, and the display of a subcontractor's details, in conjunction with the terms 'Page display' and 'Attachment display', the reasonable inference is that the Attachment view will be the menu-style list of subcontractors, and the Page display will be the subcontractor details, the page being larger than an attachment, and the details being larger than the menu. However, that's not necessarily the case, and in subsequent examples we'll invert that assignment of content to display. The description of the subcontractor list may bring the thought 'Block' to mind. Often a block can be used in place of an Attachment display, and in fact, the option to create a Block display in the view is just one selection away from the Attachment type. We're using Attachment displays rather than Block displays because Attachments are not as entity-like in their construction, and are easier to place anywhere within the page content than Blocks, which are more easily placed in regions adjacent to the content area. Attachment views do not include paging as do Page views. We are only going to be showing one subcontractor's details at a time, so there is no paging issue there. However, when we list the subcontractors to select from, there could be dozens, or even hundreds, and that will require us to have paging available for that display, so the Page display for our view will be the subcontractor list. We'll build that first. Activity 2-1–Subcontractor page view The Subcontractor page will allow the user to view the details of a subcontractor chosen from a dynamic list. That is, the list of subcontractors will not be something separate that requires editing whenever a subcontractor is added or removed, and the list will be in the content area of the page and not in a navigational menu. Let's create a new view. We're going to create a node view named subs, as shown in the following screenshot: Click Next and the Views panel is presented. The panel will allow us to customize the view settings. We'll start by creating a Page display for the view. The Views page will always attempt to provide you with a real-time preview based on your settings. Often, the settings are being established in an order that is not conducive to creating the preview, because some information is missing. In that event, you will see a pink warning about this, for example, Fields is the display type but no fields have been chosen. Use the warnings as a way to tweak your memory about what you have left to do, but don't worry about them, as long as there are none remaining when you think you're done. We'll click on Title and change the view title, as shown in the following screenshot. Click Update default display when you are finished. Let's look at some of the other configuration options in Basic Settings. Leave the style settings as it is. A style plugin isn't needed, because the view will eventually be themed, and since it will only be showing one record it doesn't require a table or grid. We'll also leave the Row style set as Fields, as we want the profile data to be displayed as a vertical list of fields. Again, changes can be made when the view is themed. We won't use AJAX at this time. We do want to use paging with this display. It's likely that the subcontractor list will be large, and so we'll only want a small amount being shown at one time. We'll change the Use pager setting to "yes", and from the config options choose Mini pager. Leave the More link setting at no, we don't need a More link, and likewise, since each record is a separate subcontractor node, we're not concerned about unique records. As this view is meant only for use by the management of Guild Builders, we'll want to restrict access to it. Change the Access setting to restrict access to a specific role. A role called management has already been created for use by the management staff of Guild Builders. There will probably be more roles added later, such as one for staff and another for the subcontractors themselves. We'll assign access to the management role. We won't be caching the view, nor exposing the form in a block, so we'll leave the settings caching at one and expose form in block at no. There will be a page header and footer, but they can be added later. Empty text won't be an issue, because the node selection will come from a list based on existing nodes. That takes us to the end of the Basic Settings pane. Let's move on to Sort criteria.
Read more
  • 0
  • 0
  • 2513

article-image-methods-animation-effects-jquery-14
Packt
29 Jan 2010
6 min read
Save for later

Methods for Animation Effects with jQuery 1.4

Packt
29 Jan 2010
6 min read
Some of the examples in this article use the $.print() function to print results to the page. Pre-packaged effects These methods allow us to quickly apply commonly-used effects with a minimum of configuration. .show() Display the matched elements. .show([duration][, callback]) Parameters duration (optional): A string or number determining how long the animation will run callback (optional): A function to call once the animation is complete Return value The jQuery object, for chaining purposes. Description With no parameters, the .show() method is the simplest way to display an element. $('.target').show(); The matched elements will be revealed immediately with no animation. This is roughly equivalent to calling .css('display', 'block'), except that the display property is restored to whatever it was initially. If an element has a display value of inline, then is hidden and shown, it will once again be displayed inline. When a duration is provided, .show() becomes an animation method. The .show() method animates the width, height, and opacity of the matched elements simultaneously. Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The 'fast' and 'slow' strings can be supplied to indicate durations of 200 and 600 milliseconds, respectively. If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but this is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole. We can animate any element, such as a simple image: <div id="clickme">Click here</div><img id="book" src="book.png" alt="" width="100" height="123" /> With the element initially hidden, we can show it slowly. $('#clickme').click(function() {$('#book').show('slow', function() {$.print('Animation complete.');});}); .hide() Hide the matched elements. .hide([duration][, callback]) Parameters duration (optional): A string or number determining how long theanimation will run callback (optional): A function to call once the animation is complete Return value The jQuery object, for chaining purposes. Description With no parameters, the .hide() method is the simplest way to hide an element. $('.target').hide(); The matched elements will be hidden immediately, with no animation. This is roughly equivalent to calling .css('display', 'none'), except that the value of the display property is saved in jQuery's data cache so that display can later be restored to its initial value. If an element has a display value of inline, and then is hidden and shown, it will once again be displayed inline. When a duration is provided, .hide() becomes an animation method. The .hide() method animates the width, height, and opacity of the matched elements simultaneously. When these properties reach 0, the display style property is set to none to ensure that the element no longer affects the layout of the page. Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The 'fast' and 'slow' strings can be supplied to indicate durations of 200 and 600 milliseconds, respectively. If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but this is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole. We can animate any element, such as a simple image: <div id="clickme">Click here</div><img id="book" src="book.png" alt="" width="100" height="123" /> With the element initially shown, we can hide it slowly. $('#clickme').click(function() {$('#book').hide('slow', function() {$.print('Animation complete.');});}); .toggle() Display or hide the matched elements. .toggle([duration][, callback]).toggle(showOrHide) Parameters (first version) duration (optional): A string or number determining how long the animation will run callback (optional): A function to call once the animation is complete Parameters (second version) showOrHide: A Boolean indicating whether to show or hide the elements Return value The jQuery object , for chaining purposes. Description With no parameters, the .toggle() method simply toggles the visibility of elements: $('.target').toggle(); The matched elements will be revealed or hidden immediately with no animation. If the element is initially displayed, it will be hidden; if hidden, it will be shown. The display property is saved and restored as needed. If an element has a display value of inline, then is hidden and shown, it will once again be displayed inline. When a duration is provided, .toggle() becomes an animation method. The .toggle() method animates the width, height, and opacity of the matched elements simultaneously. When these properties reach 0 after a hiding animation, the display style property is set to none to ensure that the element no longer affects the layout of the page. Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The 'fast' and 'slow' strings can be supplied to indicate durations of 200 and 600 milliseconds, respectively. If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but this is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole. We can animate any element, such as a simple image: <div id="clickme">Click here</div><img id="book" src="book.png" alt="" width="100" height="123" /> We will cause .toggle() to be called when another element is clicked. $('#clickme').click(function() {$('#book').toggle('slow', function() {$.print('Animation complete.');});}); With the element initially shown, we can hide it slowly with the first click: A second click will show the element once again: The second version of the method accepts a Boolean parameter. If this parameter is true, then the matched elements are shown; if false, the elements are hidden. In essence, the following statement $('#foo').toggle(showOrHide); is equivalent to: if (showOrHide) {$('#foo').show();}else {$('#foo').hide();} There is also an event method named .toggle().
Read more
  • 0
  • 0
  • 2512

article-image-master-virtual-desktop-image-creation
Packt
11 Sep 2013
11 min read
Save for later

Master Virtual Desktop Image Creation

Packt
11 Sep 2013
11 min read
(For more resources related to this topic, see here.) When designing your VMware Horizon View infrastructure, creating a Virtual Desktop master image is second only to infrastructure design in terms of importance. The reason for this is simple; as ubiquitous as Microsoft Windows is, it was never designed to be a hosted Virtual Desktop. The good news is that with a careful bit of planning, and a thorough understanding of what your end users need, you can build a Windows desktop that serves all your needs, while requiring the bare minimum of infrastructure resources. A default installation of Windows contains many optional components and configuration settings that are either unsuitable for, or not needed in, a Virtual Desktop environment, and understanding their impact is critical to maintaining Virtual Desktop performance over time and during peak levels of use. Uninstalling unneeded components and disabling services or scheduled tasks that are not required will help reduce the amount of resources the Virtual Desktop requires, and ensure that the View infrastructure can properly support the planned number of desktops even as resources are oversubscribed. Oversubscription is defined as having assigned more resources than what is physically available. This is most commonly done with processor resources in Virtual Desktop environments, where a single server processor core may be shared between multiple desktops. As the average desktop does not require 100 percent of its assigned resources at all times, we can share those resources between multiple desktops without affecting the performance. Why is desktop optimization important? To date, Microsoft has only ever released a version of Windows designed to be installed on physical hardware. This isn't to say that Microsoft is unique is this regard, as neither Linux and Mac OS X offers an installation routine that is optimized for a virtualized hardware platform. While nothing stops you from using a default installation of any OS or software package in a virtualized environment, you may find it difficult to maintain consistent levels of performance in Virtual Desktop environments where many of the resources are shared, and in almost every case oversubscribed in some manner. In this section, we will examine a sample of the CPU and disk IO resources that can be recovered were you to optimize the Virtual Desktop master image. Due to the technological diversity that exists from one organization to the next, optimizing your Virtual Desktop master image is not an exact science. The optimization techniques used and their end results will likely vary from one organization to the next due to factors unrelated to View or vSphere. The information contained within this article will serve as a foundation for optimizing a Virtual Desktop master image, focusing primarily on the operating system. Optimization results – desktop IOPS Desktop optimization benefits one infrastructure component more than any other: storage. Until all flash storage arrays achieve price parity with the traditional spinning disk arrays many of us use today, reducing the per-desktop IOPS required will continue to be an important part of any View deployment. On a per-disk basis, a flash drive can accommodate more than 15 times the IOPS of an enterprise SAS or SCSI disk, or 30 times the IOPS of a traditional desktop SATA disk. Organizations that choose an all-flash array may find that they have more than sufficient IOPS capacity for their Virtual Desktops, even without doing any optimization. The following graph shows the reduction in IOPS that occurred after performing the optimization techniques described later in this article. The optimized desktop generated 15 percent fewer IOPS during the user workload simulation. By itself that may not seem like a significant reduction, but when multiplied by hundreds or thousands of desktops the savings become more significant. Optimization results – CPU utilization View supports a maximum of 16 Virtual Desktops per physical CPU core. There is no guarantee that your View implementation will be able to attain this high consolidation ratio, though, as desktop workloads will vary from one type of user to another. The optimization techniques described in this article will help maximize the number of desktops you can run per each server core. The following graph shows the reduction in vSphere host % Processor Time that occurred after performing the optimization techniques described later in this article: % Processor Time is one of the metrics that can be used to measure server processor utilization within vSphere. The statistics in the preceding graph were captured using the vSphere ESXTOP command line utility, which provides a number of performance statistics that the vCenter performance tabs do not offer, in a raw format that is more suited for independent analysis. The optimized desktop required between 5 to 10 percent less processor time during the user workload simulation. As was the case with the IOPS reduction, the savings are significant when multiplied by large numbers of desktops. Virtual Desktop hardware configuration The Virtual Desktop hardware configuration should provide only what is required based on the desktop needs and the performance analysis. This section will examine the different virtual machine configuration settings that you may wish to customize, and explain their purpose. Disabling virtual machine logging Every time a virtual machine is powered on, and while it is running, it logs diagnostic information within the datastore that hosts its VMDK file. For environments that have a large number of Virtual Desktops, this can generate a noticeable amount of storage I/O. The following steps outline how to disable virtual machine logging: In the vCenter client, right-click on the desktop master image virtual machine and click on Edit Settings to open the Virtual Machine Properties window. In the Virtual Machine Properties window, select the Options tab. Under Settings , highlight General . Clear Enable logging as shown in the following screenshot, which sets the logging = "FALSE" option in the virtual machine VMX file: While disabling logging does reduce disk IO, it also removes log files that may be used for advanced troubleshooting or auditing purposes. The implications of this change should be considered before placing the desktop into production. Removing unneeded devices By default, a virtual machine contains several devices that may not be required in a Virtual Desktop environment. In the event that these devices are not required, they should be removed to free up server resources. The following steps outline how to remove the unneeded devices: In the vCenter client, right-click on the desktop master image virtual machine and click on Edit Settings to open the Virtual Machine Properties window. In the Virtual Machine Properties window, under Hardware , highlight Floppy drive 1 as shown in the following screenshot and click on Remove : In the Virtual Machine Properties window, select the Options tab. Under Settings , highlight Boot Options . Check the checkbox under the Force BIOS Setup section as shown in the following screenshot: Click on OK to close the Virtual Machine Properties window. Power on the virtual machine; it will boot into the PhoenixBIOS Setup Utility . The PhoenixBIOS Setup Utility menu defaults to the Main tab. Use the down arrow key to move down to the Legacy Diskette A , and then press the Space bar key until the option changes to Disabled . Use the right arrow key to move to the Advanced tab. Use the arrow down key to select I/O Device Configuration and press Enter to open the I/O Device Configuration window. Disable the serial ports, parallel port, and floppy disk controller as shown in the following screenshot. Use the up and down arrow keys to move between devices, and the Space bar to disable or enable each as required: Press the F10 key to save the configuration and exit the PhoenixBIOS Setup Utility . Do not remove the virtual CD-ROM device, as it is used by vSphere when performing an automated installation or upgrade of the VMware Tools software. Customizing the Windows desktop OS cluster size Microsoft Windows uses a default cluster size, also known as allocation unit size, of 4 KB when creating the boot volume during a new installation of Windows. The cluster size is the smallest amount of disk space that will be used to hold a file, which affects how many disk writes must be made to commit a file to disk. For example, when a file is 12 KB in size, and the cluster size is 4 KB, it will take three write operations to write the file to disk. The default 4 KB cluster size will work with any storage option that you choose to use with your environment, but that does not mean it is the best option. Storage vendors frequently do performance testing to determine which cluster size is optimal for their platforms, and it is possible that some of them will recommend that the Windows cluster size should be changed to ensure optimal performance. The following steps outline how to change the Windows cluster size during the installation process; the process is the same for both Windows 7 and Windows 8. In this example, we will be using an 8 KB cluster size, although any size can be used based on the recommendation from your storage vendor. The cluster size can only be changed during the Windows installation, not after. If your storage vendor recommends the 4 KB Windows cluster size, the default Windows settings are acceptable. Boot from the Windows OS installer ISO image or physical CD and proceed through the install steps until the Where do you want to install Windows? dialog box appears. Press Shift + F10 to bring up a command window. In the command window, enter the following commands: diskpart select disk 0 create partition primary size=100 active format fs=ntfs label="System Reserve" quick create partition primary format fs=ntfs label=OS_8k unit=8192 quick assign exit Click on Refresh to refresh the Where do you want to install Windows? window. Select Drive 0 Partition 2: OS_8k , as shown in the following screenshot, and click on Next to begin the installation: The System Reserve partition is used by Windows to store files critical to the boot process and will not be visible to the end user. These files must reside on a volume that uses a 4 KB cluster size, so we created a small partition solely for that purpose. Windows will automatically detect this partition and use it when performing the Windows installation. In the event that your storage vendor recommends a different cluster size than shown in the previous example, replace the 8192 in the sample command in step 3 with whatever value the vendor recommends, in bytes, without any punctuation. Windows OS pre-deployment tasks The following tasks are unrelated to the other optimization tasks that are described in this article but they should be completed prior to placing the desktop into production. Installing VMware Tools VMware Tools should be installed prior to the installation of the View Agent software. To ensure that the master image has the latest version of the VMware Tools software, apply the latest updates to the host vSphere Server prior to installing the tools package on the desktop. The same applies if you are updating your VMware Tools software. The View Agent software should be reinstalled after the VMware Tools software is updated to ensure that the appropriate View drivers are installed in place of the versions included with VMware Tools. Cleaning up and defragmenting the desktop hard disk To minimize the space required by the Virtual Desktop master image and ensure optimal performance, the Virtual Desktop hard disks should be cleaned of nonessential files and optimized prior to deployment into production. The following actions should be taken once the Virtual Desktop master image is ready for deployment: Use the Windows Disk Cleanup utility to remove any unnecessary files. Use the Windows Defragment utility to defragment the virtual hard disk. If the desktop virtual hard disks are thinly provisioned, you may wish to shrink them after the defragmentation completes. This can be performed with utilities from your storage vendor if available, by using the vSphere vmkfstools utility, or by using the vSphere storage vMotion feature to move the virtual machine to a different datastore. Visit your storage vendor or the VMware vSphere Documentation (http://www.vmware.com/support/pubs/vsphere-esxi-vcenter-server-pubs.html) for instructions on how to shrink virtual hard disks or perform a storage vMotion.
Read more
  • 0
  • 0
  • 2512

article-image-testing-camel-application
Packt
30 Sep 2013
5 min read
Save for later

Testing a Camel application

Packt
30 Sep 2013
5 min read
(For more resources related to this topic, see here.) Let's start testing. Apache Camel comes with the Camel Test Kit: some classes leverage testing framework capabilities and extend with Camel specifics. To test our application, let's add this Camel Test Kit to our list of dependencies in the POM file, as shown in the following code: <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-test</artifactId> <version>${camel-version}</version> </dependency> At the same time, if you have any JUnit dependency, the best solution would be to delete it for now so that Maven will resolve the dependency and we will get a JUnit version required by Camel. Let's rewrite our main program a little bit. Change the class App as shown in the following code: public class App { public static void main(String[] args) throws Exception { Main m = new Main(); m.addRouteBuilder( new AppRoute() ); m.run(); } static class AppRoute extends RouteBuilder { @Override public void configure() throws Exception { from("stream:in") .to("file:test"); } } } Instead of having an anonymous class extending RouteBuilder, we made it an inner class. That is, we are not going to test the main program. Instead, we are going to test if our routing works as expected, that is, messages from the system input are routed into the files in the test directory. At the beginning of the test, we will delete the test directory and our assertion will be that we have the directory test after we send the message and that it has exactly one file. To simplify the deleting of the directory test at the beginning of the unit test, we will use FileUtils.deleteDirectory from Apache Commons IO. Let's add it to our list of dependencies: <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-io</artifactId> <version>1.3.2</version> </dependency> In our project layout, we have a file src/test/java/com/company/AppTest.java. This is a unit test that has been created from the Maven artifact that we used to create our application. Now, let's replace the code inside that file with the following code: package com.company; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.BeforeClass; import org.junit.Test; import java.io.*; public class AppTest extends CamelTestSupport { static PipedInputStream in; static PipedOutputStream out; static InputStream originalIn; @Test() public void testAppRoute() throws Exception { out.write("This is a test message!n".getBytes()); Thread.sleep(2000); assertTrue(new File("test").listFiles().length == 1); } @BeforeClass() public static void setup() throws IOException { originalIn = System.in; out = new PipedOutputStream(); in = new PipedInputStream(out); System.setIn(in); FileUtils.deleteDirectory(new File("test")); } @After() public void teardown() throws IOException { out.close(); System.setIn(originalIn); } @Override public boolean isCreateCamelContextPerClass() { return false; } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new App.AppRoute(); } } Now we can run mvn compile test from the console and see that the test was run and that it is successful: Some important things to take note of in the code of our unit test are as follows: We have extended the CamelTestSupport class for Junit4 (see the package it is imported from). There are also classes that support TestNG and Junit3. We have overridden the method createRouteBuilder() to return RouteBuilder with our routes. We made our test class create CamelContext for each test method (annotated by @Test) by making isCreateCamelContextPerClass return false. System.in has been substituted with a piped stream in the startup() method and has been set back to the original value in the teardown() method. The trick is in doing it before CamelContext is created and started (now you see why we create CamelContext for each test). Also, you may see that after we send the message into the output stream piped to System.in, we made the test thread stop for couple of seconds to ensure that the message passes through the routes into the file. In short, our test running suite overrides System.in with a pipe stream so we can write into System.in from the code and deletes the directory test before the Test class is loaded. After the class is loaded and right before the testAppRoute() method, it creates CamelContext, using routes created by the overridden method createRouteBuilder(). Then it runs the test method which sends bytes of the message into the piped stream so that it gets into System.in where it is read by the Camel (note the n limiting the message). Camel then does what is written in the routes, that is, creates a file in the test directory. To be sure it's done before we do assertions, we make the thread executing the test sleep for 2 seconds. Then, we assert that we do have a file in the test directory at the end of the test. Our test works, but you see that it already gets quite hairy with piping streams and making calls to Thread.sleep()—and that's just the beginning. We haven't yet started using external systems, such as FTP servers, web services, and JMS queues. Another concern is the integration of our application with other systems. Some of them may not have a test environment. In this case, we can't easily control the side effects of our application, messages that it sends and receives from those systems; or how the systems interact with our application. To solve this problem, software developers use mocking. Summary Thus we learned about testing a Camel application in this article. Resources for Article: Further resources on this subject: Migration from Apache to Lighttpd [Article] Apache Felix Gogo [Article] Using the OSGi Bundle Repository in OSGi and Apache Felix 3.0 [Article]
Read more
  • 0
  • 0
  • 2511
article-image-ibm-rational-team-concert-team-collaboration
Packt
07 Feb 2011
9 min read
Save for later

IBM Rational Team Concert: Team Collaboration

Packt
07 Feb 2011
9 min read
  IBM Rational Team Concert 2 Essentials Improve team productivity with Integrated Processes, Planning, and Collaboration using Team Concert Enterprise Edition Understand the core features and techniques of Rational Team Concert and Jazz platform through a real-world Book Manager Application Expand your knowledge of software development challenges and find out how Rational Team Concert solves your tech, team, and collaboration worries Complete overview and understanding of the Jazz Platform, Rational Team Concert, and other products built on the Jazz Platform Explore out-of-the-box projects with the 'Sandbox' feature of the Jazz Platform, even before you install Rational Team Concert A practical guide by a Rational Team Concert expert, with a simple, step-by-step approach to solve your team management and collaboration worries         Read more about this book       (For more resources on IBM, see here.) Software development involves people, knowledge, technique, tools, methodologies, and more. Managers, software architects, developers, and quality assurance teams have many challenges to deal with, particularly with the increasing geographic dispersion of software services teams across the entire globe. A lot of focus in the software industry has been on improving the productivity of these global teams, with particular emphasis in recent years on giving teams a seamless experience in collaboration. Consider some of the problems we normally encounter when we communicate and collaborate with colleagues on a software development effort: When you need to see if a colleague has arrived at work, you actually go to their desk and see if they're there. When you want to talk to a colleague about an issue, you meet in person or make a telephone call to discuss. Information on an employee's absence, such as when he is on vacation, is often stored in a shared spreadsheet, which may not be properly kept updated and may not be integrated with the project plan. Because you don't know everyone's vacation schedule, you may be waiting for a response from a colleague, only to learn afterwards he is out of the office. Likewise, part-time consultants may have irregular schedules that change, making it difficult to know when they are available for work. Regular updates to the team on the project's progress requires status meetings, which may require gathering everyone into one place, and take time. Software development tools are designed to help some aspects of managing a team, but they also introduce some challenges: Tools designed to facilitate tasking, such as issue trackers and requirements management tools, are separate from the coding environment, causing a disconnect between the coding change and the impetus for the change. Instant messaging such as Google IM is very effective for communication. However, they too are disconnected from the coding environment, meaning context is lost when messages are sent about bugs and requirements. Likewise, they are one-on-one communication, so there is no sense of communicating with a team this way. E-mail is of course a great way to communicate with both, whole teams and individuals, but the same problems persists—no context between the mention of a bug ticket and the code the developer will change as a result. Neither e-mails nor IM integrate with the bug trackers, and discussion on these items between developers, managers, and end users can be lost or misfiled, or stored in a decentralized manner, in the inboxes of those who participated in the discussion but are not visible to the entire team. All of these add up to one main problem—it is not elegant to see all the team activity on a project. On one extreme, there are too many disconnected tools; on the other, too many manual processes—both lead to reductions in team productivity. They are all challenges related to collaboration. The following is the Wikipedia definition of collaboration: Collaboration is a recursive process where two or more people or organizations work together in an intersection of common goals. For example, an intellectual endeavor that is creative in nature, by sharing knowledge, learning, and building consensus. In this article, we will see how Rational Team Concert takes care of these collaboration challenges. Rational Team Concert integrates many useful tasks into the client, giving a seamless tool integration experience. A focus of software development is to manage the requirements and bugs of a project. Sometimes, developers spend time manually associating code changes with the tracked bugs, introducing a myriad of problems to deal with. There are many benefits to integrating the issues and bug management into the development environment. Any software system's health and quality can be quickly accessed by looking at the bugs and issues. When the issue and bug management system is integrated into the development environment, issues can be linked with the source code and other related artifacts. By providing an integrated view, you can efficiently keep track of all the work your team needs to complete, which makes it easier to decide on the health of your process. Team Collaboration allows us to exchange information with other team members in the context of the work being done. When you talk about a bug, you can make sure that everyone sees the same bug description and preserve the discussion summary on the bug for any future reference. In the coming sections we will see specific topics that improve your daily experience as a software developer, manager, architect, QA engineer, or a project stakeholder. Collaboration can be seen as an ingredient in the global software development context. In such a case, the interaction of a developer in setting up a project, working in the source code editor, work items, plans, and releases become a part of the collaboration. In this article, we focus on the specific tools of the collaboration that help and facilitate improving the productivity of teams. Work Environment In the global workforce scenario, the challenge is to use various information attributes such as the location and time zone of the team member, the capacity of a team member to work on a project, and the work schedule. We would like to know if a team member in a different time zone has arrived to work or if he is on vacation. Work Environment is a collaboration aspect of the Rational Team Concert that helps you specify several information attributes in a convenient user interface. Team members and managers can make use of this information for planning and scheduling purposes. Rational Team Concert gives you the ability to enter the schedule information in the client as well as web UI. From the Eclipse client, you can open the complete overview of a user from Team Organization view, right-click on the user, and select Open. From this interface you can configure the Work Environment, Scheduled Absences, and Mail Configuration as shown in the following screenshot: (Move the mouse over the image to enlarge it). In the Overview tab of the editor, you can view and modify the important information about the user such as the username, e-mail address, team areas he belongs to, workdays and hours he normally works, and scheduled absences. Repository permissions are allocated to users using group designations in Repository Groups. Remember that at this time, you will not see the repository groups as we initially configured the users to be in the External Non-LDAP User Registry. If you are using a WebSphere application server, users are assigned to repository groups at the time of user creation by your administrator. Unless users are configured to be on Tomcat or on LDAP, repository groups are not visible in the Rational Team Concert client or web UI. In the Work Environment tab, you can enter your Work Location and Work Days, which will help other team members to know the availability of a team member to plan and schedule meetings. You can also edit your work days and number of hours of work that you would put in. This information on the work week and hours of work is used in scheduling, planning, and burn down charts. This also gives you the opportunity to adjust the percentage effort dedicated to each team or project in case you are assigned to multiple projects, as shown in the following screenshot: In the above example, the user Trebor (tfenstermaker) edited the details relevant for him. He changed the Time Zone to US/Eastern and changed his time of availability and work hours using this editor. Notice that this user has changed the work hours from 40 hours a week to 32 hours a week. This information is extremely useful for the project manager or project administrator who wants to schedule work, or who wants to know the availability of team members for meetings or to get a quick response via instant messaging. Throughout this article, unless otherwise stated, we use the admin user account in Rational Team Concert. Scheduled Absences In many projects, team members use versioned or shared spreadsheets to store their vacation schedules. Project managers often have to remind people to keep these updated, and team members may or may not do so. The manager must find these spreadsheets, hope they're correct, and compile the information from them manually to determine the available work hours and properly schedule work. Rational Team Concert has the ability to capture all the team member related vacation time so that it can be used for planning, reporting, and other tasks. The Scheduled Absences tab lets you to enter the vacation time, where it is stored in the Team Repository for further use. The following screenshot shows the vacation entered by the user Trebor (tfenstermaker) and will be affected in the Team Load calculations for a specific project:
Read more
  • 0
  • 0
  • 2510

article-image-android-database-programming-binding-ui
Packt
07 Jun 2012
6 min read
Save for later

Android Database Programming: Binding to the UI

Packt
07 Jun 2012
6 min read
(For more resources on Android, see here.) SimpleCursorAdapters and ListViews There are two major ways of retrieving data on Android, and each has its own class of ListAdapters, which will then know how to handle and bind the passed-in data. The first way of retrieving data is one that we're very familiar with already – through making queries and obtaining Cursor objects. The subclass of ListAdapters that wrap around Cursors is called CursorAdapter, and in the next section we'll focus on the SimpleCursorAdapter, which is the most straightforward instance of CursorAdapter. The Cursor points to a subtable of rows containing the results of our query. By iterating through this cursor, we are able to examine the fields of each row. Now we would like to convert each row of the subtable into a corresponding row in our list. The first step in doing this is to set up a ListActivity (a variant of the more common Activity class). As its name suggests, a ListActivity is simply a subclass of the Activity class which comes with methods that allow you to attach ListAdapters. The ListActivity class also allows you to inflate XML layouts, which contain list tags. In our example, we will use a very bare-bones XML layout (named list.xml) that only contains a ListView tag as follows: <?xml version="1.0" encoding="utf-8"?><LinearLayout android_orientation="vertical" android_layout_width="fill_parent" android_layout_height="wrap_content" > <ListView android_id="@android:id/android:list" android_layout_width="fill_parent" android_layout_height="wrap_content" /></LinearLayout> This is the first step in setting up what's called a ListView in Android. Similar to how defining a TextView allows you to see a block of text in your Activity, defining a ListView will allow you to interact with a scrollable list of row objects in your Activity. Intuitively, the next question in your mind should be: Where do I define how each row actually looks? Not only do you need to define the actual list object somewhere, but each row should have its own layout as well. So, to do this we create a separate list_entry.xml file in our layouts directory. The example I'm about to use is the one that queries the Contacts content provider and returns a list containing each contact's name, phone number, and phone number type. Thus, each row of my list should contain three TextViews, one for each data field. Subsequently, my list_entry.xml file looks like the following: <?xml version="1.0" encoding="utf-8"?><LinearLayout android_orientation="vertical" android_layout_width="fill_parent" android_layout_height="wrap_content" android_padding="10dip" > <TextView android_id="@+id/name_entry" android_layout_width="wrap_content" android_layout_height="wrap_content" android_textSize="28dip" /> <TextView android_id="@+id/number_entry" android_layout_width="wrap_content" android_layout_height="wrap_content" android_textSize="16dip" /> <TextView android_id="@+id/number_type_entry" android_layout_width="wrap_content" android_layout_height="wrap_content" android_textColor="#DDD" android_textSize="14dip" /></LinearLayout> So we have a vertical LinearLayout which contains three TextViews, each with its own properly defined ID as well as its own aesthetic properties (that is, text size and text color). In terms of set up – this is all we need! Now we just need to create the ListActivity itself, inflate the list.xml layout, and specify the adapter. To see how all this is done, let's take a look at the code before breaking it apart piece by piece: public class SimpleContactsActivity extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list); // MAKE QUERY TO CONTACT CONTENTPROVIDER String[] projections = new String[] { Phone._ID, Phone.DISPLAY_NAME, Phone.NUMBER, Phone.TYPE }; Cursor c = getContentResolver().query(Phone.CONTENT_URI, projections, null, null, null); startManagingCursor(c); // THE DESIRED COLUMNS TO BE BOUND String[] columns = new String[] { Phone.DISPLAY_NAME, Phone.NUMBER, Phone.TYPE }; // THE XML DEFINED VIEWS FOR EACH FIELD TO BE BOUND TO int[] to = new int[] { R.id.name_entry, R.id.number_entry, R.id.number_type_entry }; // CREATE ADAPTER WITH CURSOR POINTING TO DESIRED DATA SimpleCursorAdapter cAdapter = new SimpleCursorAdapter(this, R.layout.list_entry, c, columns, to); // SET THIS ADAPTER AS YOUR LIST ACTIVITY'S ADAPTER this.setListAdapter(cAdapter); }} So what's going on here? Well, the first part of the code you should recognize by now – we're simply making a query over the phone's contact list (specifically over the Contact content provider's Phone table) and asking for the contact's name, number, and number type. Next, the SimpleCursorAdapter takes as two of its parameters, a string array and an integer array which represent a mapping between Cursor columns and XML layout views. In our case, this is as follows: // THE DESIRED COLUMNS TO BE BOUNDString[] columns = new String[] { Phone.DISPLAY_NAME, Phone.NUMBER, Phone.TYPE };// THE XML DEFINED VIEWS FOR EACH FIELD TO BE BOUND TOint[] to = new int[] { R.id.name_entry, R.id.number_entry, R.id.number_type_entry }; This is so that the data in the DISPLAY_NAME column will get bound to the TextView with ID name_entry, and so on. Once we have these mappings defined, the next part is to just instantiate the SimpleCursorAdapter, which can be seen in this line: // CREATE ADAPTER WITH CURSOR POINTING TO DESIRED DATASimpleCursorAdapter cAdapter = new SimpleCursorAdapter(this, R.layout.list_entry, c, columns, to); Now, the SimpleCursorAdapter takes five parameters – the first is the Context, which essentially tells the CursorAdapter which parent Activity it needs to inflate and bind the rows to. The next parameter is the ID of the R layout that you defined earlier, which will tell the CursorAdapter what each row should look like and, furthermore, where it can inflate the corresponding Views. Next, we pass in the Cursor, which tells the adapter what the underlying data actually is, and lastly, we pass in the mappings. Hopefully, the previous code makes sense, and the parameters of SimpleCursorAdapter make sense as well. The result of this previous Activity can be seen in the following screenshot: Everything looks good, except for these random integers floating around under the phone number. Why are there a bunch of 1s, 2s, and 3s at the bottom of each row where the types should be? Well, the phone number types are not returned as Strings but are instead returned as integers. From there through a simple switch statement, we can easily convert these integers into more descriptive Strings. However, you'll quickly see that with our very simple, straightforward use of the built-in SimpleCursorAdapter class, there was nowhere for us to implement any "special" logic that would allow us to convert such returned integers to Strings. This is when overriding the SimpleCursorAdapter class becomes necessary, because only then can we have full control over how the Cursor's data is to be displayed in each row. And so, we move onwards to the next section where we see just that.
Read more
  • 0
  • 0
  • 2505

article-image-authoring-enterprisedb-report-report-builder-20
Packt
07 Oct 2009
4 min read
Save for later

Authoring an EnterpriseDB report with Report Builder 2.0

Packt
07 Oct 2009
4 min read
{literal} Overview The following steps will be followed in authoring an Intranet report using Postgres Plus as the backend database. Creating an ODBC DSN to access the data on Postgres Plus Creating a report with Report Builder 2.0 Configuring the data source for the control Configuring the report layout to display data Deploying the report on the Report Server The categories table in the EnterpriseDB shown will be used to provide the data for the report. The categories table is on the PGNorthwind database on the EnterpriseDB Advanced Server 8.3 shown in the next figure. Creating an ODBC DSN to access the data on Postgres Plus Click on Start | Control Panel | Administrative Tools | Data Sources (ODBC) to bring up the ODBC Data Source Administrator window. Click on Add.... In the Create New Data Source window scroll down to choose EnterpriseDB 8.3 under the list heading Name as shown. Click Finish. The EnterpriseDB ODBC Driver page gets displayed as shown. Accept the default name for the Data Source(DSN) or, if you prefer, change the name. Here the default is accepted. The Database, Server, User Name, Port and the Password should all be available to you. If you click on the option button Datasource you display a window with two pages as shown. Make no changes to the pages and accept defaults but make sure you review the pages. Click OK and you will be back in the EnterpriseDB Driver window. If you click on the option button Global the Global Settings window gets displayed (not shown). These are logging options as the page describes. Click Cancel to the Global Settings window. Click on the Test button and verify that the connection was successful. Click on the Save button and save the DSN under the list heading User DSN. The DSN EnterpriseDB enters the list of DSN's created as shown here.      Creating a report with Report Builder 2.0 It is assumed that the Report Builder 2.0 is installed on the computer on which both EnterpriseDB's Advanced Server 8.3 as well as the Reporting Services / SQL Server 2008 are installed. To proceed further the SQL Server 2008 Database Engine and the Reporting Services must have started and running. Start | All programs | Microsoft SQL Server 2008 Report Builder 2.0 will bring up the following display. Click on Report Builder 2.0. The Report Builder 2.0 gets displayed as shown. Double click the Table or Matrix icon. This displays the New Table or Matrix window as shown. Configuring the data source for the control Click on the New... button. This brings up the Data Source Properties window as shown. Click on the drop-down handle for "Select connection type:" as shown, scroll down and click on ODBC Click on the Build... button. This brings up the Connection Properties window as shown. Click on the option "Use user or system data source name" and then click on the drop-down handle. In the list of ODBC DSN's on this machine which gets displayed in the list click on EnterpriseDB as shown. Enter credentials for the EnterpriseDB as shown. Test the connection with the Test Connection button. A Test Results message will be generated displaying success if the connection information provided is correct as shown Click OK to the two open windows. This will bring you back to the Data Source Properties window displaying the connection string in the window. Click on navigational link Credentials on the left which opens the "Change the credentials used to connect to the data source". Make note that the credentials you supplied earlier have arrived at this page. If you need to be prompted you may check this option. Herein no changes will be made. Click on the OK button. In the New Table or Matrix window DataSource1 (in this report) will be high lighted. Click on the Next button. This brings up the "Design a query" window as shown. In the top pane of the query window type in the SQL Statement as shown. You may also test the query by clicking on the (!) button and the query result will appear in the bottom pane as shown.
Read more
  • 0
  • 0
  • 2505
article-image-cooking-xml-oop
Packt
23 Oct 2009
9 min read
Save for later

Cooking XML with OOP

Packt
23 Oct 2009
9 min read
Formation of XML Let us look at the structure of a common XML document in case you are totally new to XML. If you are already familiar with XML, which we greatly recommend for this article, then it is not a section for you. Let's look at the following example, which represents a set of emails: <?xml version="1.0" encoding="ISO-8859-1" ?><emails> <email> <from>nowhere@notadomain.tld</from> <to>unknown@unknown.tld</to> <subject>there is no subject</subject> <body>is it a body? oh ya</body> </email></emails> So you see that XML documents do have a small declaration at the top which details the character set of the document. This is useful if you are storing Unicode texts. In XML, you must close the tags as you start it. (XML is more strict than HTML, you must follow the conventions.) Let's look at another example where there are some special symbols in the data: <?xml version="1.0" encoding="ISO-8859-1" ?><emails> <email> <from>nowhere@notadomain.tld</from> <to>unknown@unknown.tld</to> <subject>there is no subject</subject> <body><![CDATA[is it a body? oh ya, with some texts & symbols]]></body> </email></emails> This means you have to enclose all the strings containing special characters with CDATA. Again, each entity may have some attributes with it. For example consider the following XML where we describe the properties of a student: <student age= "17" class= "11" title= "Mr.">Ozniak</student> In the above example, there are three attributes to this student tag—age, class, and title. Using PHP we can easily manipulate them too. In the coming sections we will learn how to parse XML documents, or how to create XML documents on the fly. Introduction to SimpleXML In PHP4 there were two ways to parse XML documents, and these are also available in PHP5. One is parsing documents via SAX (which is a standard) and another one is DOM. But it takes quite a long time to parse XML documents using SAX and it also needs quite a long time for you to write the code. In PHP5 a new API has been introduced to easily parse XML documents. This was named SimpleXML API. Using SimpleXML API you can turn your XML documents into an array. Each node will be converted to an accessible form for easy parsing. Parsing Documents In this section we will learn how to parse basic XML documents using SimpleXML. Let's take a breath and start. $str = <<< END<emails> <email> <from>nowhere@notadomain.tld</from> <to>unknown@unknown.tld</to> <subject>there is no subject</subject> <body><![CDATA[is it a body? oh ya, with some texts & symbols]]></body> </email></emails>END;$sxml = simplexml_load_string($str);print_r($sxml);?> The output is like this: SimpleXMLElement Object( [email] => SimpleXMLElement Object ( [from] => nowhere@notadomain.tld [to] => unknown@unknown.tld [subject] => there is no subject [body] => SimpleXMLElement Object ( ) )) So now you can ask how to access each of these properties individually. You can access each of them like an object. For example, $sxml->email[0] returns the first email object. To access the from element under this email, you can use the following code like: echo $sxml->email[0]->from So, each object, unless available more than once, can be accessed just by its name. Otherwise you have to access them like a collection. For example, if you have multiple elements, you can access each of them using a foreach loop: foreach ($sxml->email as $email)echo $email->from; Accessing Attributes As we saw in the previous example, XML nodes may have attributes. Remember the example document with class, age, and title? Now you can easily access these attributes using SimpleXML API. Let's see the following example: <?$str = <<< END<emails> <email type="mime"> <from>nowhere@notadomain.tld</from> <to>unknown@unknown.tld</to> <subject>there is no subject</subject> <body><![CDATA[is it a body? oh ya, with some texts & symbols]]></body> </email></emails>END;$sxml = simplexml_load_string($str);foreach ($sxml->email as $email)echo $email['type'];?> This will display the text mime in the output window. So if you look carefully, you will understand that each node is accessible like properties of an object, and all attributes are accessed like keys of an array. SimpleXML makes XML parsing really fun. Parsing Flickr Feeds using SimpleXML How about adding some milk and sugar to your coffee? So far we have learned what SimpleXML API is and how to make use of it. It would be much better if we could see a practical example. In this example we will parse the Flickr feeds and display the pictures. Sounds cool? Let's do it. If you are interested what the Flickr public photo feed looks like, here is the content. The feed data is collected from http://www.flickr.com/services/feeds/photos_public.gne: <?xml version="1.0" encoding="utf-8" standalone="yes"?><feed > <title>Everyone's photos</title> <link rel="self" href="http://www.flickr.com/services/feeds/photos_public.gne" /> <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/"/> <id>tag:flickr.com,2005:/photos/public</id> <icon>http://www.flickr.com/images/buddyicon.jpg</icon> <subtitle></subtitle> <updated>2007-07-18T12:44:52Z</updated> <generator uri="http://www.flickr.com/">Flickr</generator> <entry> <title>A-lounge 9.07_6</title> <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/dimitranova/845455130/"/> <id>tag:flickr.com,2005:/photo/845455130</id> <published>2007-07-18T12:44:52Z</published> <updated>2007-07-18T12:44:52Z</updated> <dc:date.Taken>2007-07-09T14:22:55-08:00</dc:date.Taken> <content type="html">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/dimitranova/&quot; &gt;Dimitranova&lt;/a&gt; posted a photo:&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/dimitranova/845455130/ &quot; title=&quot;A-lounge 9.07_6&quot;&gt;&lt;img src=&quot; http://farm2.static.flickr.com/1285/845455130_dce61d101f_m.jpg &quot; width=&quot;180&quot; height=&quot;240&quot; alt=&quot; A-lounge 9.07_6&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content> <author> <name>Dimitranova</name> <uri>http://www.flickr.com/people/dimitranova/</uri> </author> <link rel="license" type="text/html" href="deed.en-us" /> <link rel="enclosure" type="image/jpeg" href="http://farm2.static.flickr.com/1285/ 845455130_7ef3a3415d_o.jpg" /> </entry> <entry> <title>DSC00375</title> <link rel="alternate" type="text/html" href="http://www.flickr.com/photos/53395103@N00/845454986/"/> <id>tag:flickr.com,2005:/photo/845454986</id> <published>2007-07-18T12:44:50Z</published>...</entry></feed> Now we will extract the description from each entry and display it. Let's have some fun: <?$content = file_get_contents( "http://www.flickr.com/services/feeds/photos_public.gne ");$sx = simplexml_load_string($content);foreach ($sx->entry as $entry){ echo "<a href='{$entry->link['href']}'>".$entry->title."</a><br/>"; echo $entry->content."<br/>"; }?> This will create the following output. See, how easy SimpleXML is? The output of the above script is shown below: Managing CDATA Sections using SimpleXML As we said before, some symbols can't appear directly as a value of any node unless you enclose them using CDATA tag. For example, take a look at following example: <?$str = <<<EOT<data> <content>text & images </content></data>EOT;$s = simplexml_load_string($str);?> This will generate the following error: <br /><b>Warning</b>: simplexml_load_string() [<a href='function.simplexml-load-string'> function.simplexml-load-string</a>]: Entity: line 2: parser error : xmlParseEntityRef: no name in <b>C:OOP with PHP5Codesch8cdata.php</b> on line <b>10</b><br /><br /><b>Warning</b>: simplexml_load_string() [<a href='function.simplexml-load-string'> function.simplexml-load-string</a>]: &lt;content&gt;text &amp; images &lt;/content&gt; in <b>C:OOP with PHP5Codesch8cdata.php</b> on line <b>10</b><br /><br /><b>Warning</b>: simplexml_load_string() [<a href='function.simplexml-load-string'> function.simplexml-load-string</a>]: ^ in <b>C:OOP with PHP5Codesch8cdata.php</b> on line <b>10</b><br /> To avoid this problem we have to enclose using a CDATA tag. Let's rewrite it like this: <data> <content><![CDATA[text & images ]]></content></data> Now it will work perfectly. And you don't have to do any extra work for managing this CDATA section. <?$str = <<<EOT<data> <content><![CDATA[text & images ]]></content></data>EOT;$s = simplexml_load_string($str);echo $s->content;//print "text & images"?> However, prior to PHP5.1, you had to load this section as shown below: $s = simplexml_load_string($str,null,LIBXML_NOCDATA);
Read more
  • 0
  • 0
  • 2504

article-image-drag-and-drop-yui-part-3
Packt
30 Nov 2009
6 min read
Save for later

Drag-and-Drop with the YUI: Part-3

Packt
30 Nov 2009
6 min read
Visual Selection with the Slider Control So far in this chapter we've focused on the functionality provided by the Drag-and-Drop utility. Let's shift our focus back to the interface controls section of the library and look at one of the components which is related very closely to drag-and-drop—the Slider control. A slider can be defined using a very minimal set of HTML. All you need are two elements: the slider background and the slider thumb, with the thumb appearing as a child of the background element: <div id="slider_bg" title="the slider background"><div id="slider_thumb" title="the slider thumb"><img src="images/slider_thumb.gif"></div></div> These elements go together to form the basic Slider control, as shown in below: The Slider control works as a specific implementation of DragDrop in that the slider thumb can be dragged along the slider background either vertically or horizontally. The DragDrop classes are extended to provide additional properties, methods, and events specific to Slider. One of the main concepts differentiating Slider from DragDrop is that with a basic slider, the slider thumb is constrained to just one axis of motion, either X or Y depending on whether the Slider is horizontal or vertical respectively. The Slider is another control that can be animated by including a reference to the Animation control in the head of the page. Including this means that when any part of the slider background is clicked on, the slider thumb will gracefully slide to that point of the background rather than just moving there instantly. The Constructor and Factory Methods The constructor for the slider control is always called in conjunction with one of the three factory methods, depending on which type of slider you want to display. To generate a horizontal slider the YAHOO.widget.Slider.getHorizSlider is called, with the appropriate arguments. To generate a vertical slider, on the other hand, the YAHOO.widget.Slider.getVertSlider would instead be used. There is also another type of slider that can be created—the YAHOO.widget.Slider.getSliderRegion constructor and factory method combination creates a two-dimensional slider, the thumb of which can be moved both vertically and horizontally. There are a range of arguments used with the different types of slider constructor. The first two arguments are the same for all of them, with the first argument corresponding to the id of the background HTML element and the second corresponding to the id of the thumb element. The type of slider you are creating denotes what the next two (or four when using the SliderRegion) arguments relate to. With the horizontal slider or region slider the third argument is the number of pixels that the thumb element can move left, but with the horizontal slider it is the number of pixels it can move up. The fourth argument is either the number of pixels which the thumb can move right, or the number of pixels it can move down. When using the region slider, the fifth and sixth arguments are the number of pixels the thumb element can move up and down, so with this type of slider all four directions must be specified. Alternatively, with either the horizontal or vertical sliders, only two directions need to be accounted for. The final argument (either argument number five for the horizontal or vertical sliders, or argument number seven for the region slider) is optional and refers to the number of pixels between each tick, also known as the tick size. This is optional because you may not use ticks in your slider, therefore making the Slider control analogue rather than digital. Class of Two There are just two classes that make up the Slider control—the YAHOO.widget.Slider class is a subclass of the YAHOO.util.DragDrop class and inherits a whole bunch of its most powerful properties and methods, as well as defining a load more of its own natively. The YAHOO.widget.SliderThumb class is a subclass of the YAHOO.util.DD class and inherits properties and methods from this class (as well as defining a few of its own natively). Some of the native properties defined by the Slider class and available for you to use include: animate—a boolean indicating whether the slider thumb should animate. Defaults to true if the Animation utility is included, false if not animationDuration—an integer specifying the duration of the animation in seconds. The default is 0.2 backgroundEnabled—a boolean indicating whether the slider thumb should automatically move to the part of the background that is selected when clicked. Defaults to true enableKeys—another boolean which enables the home, end and arrow keys on the visitors keyboard to control the slider. Defaults to true, although the slider control must be clicked once with the mouse before this will work keyIncrement—an integer specifying the number of pixels the slider thumb will move when an arrow key is pressed. Defaults to 25 pixels A large number of native methods are also defined in the class, but a good deal of them are used internally by the slider control and will therefore never need to be called directly by you in your own code. There are a few of them that you may need at some point however, including: .getThumb()—returns a reference to the slider thumb .getValue()—returns an integer determining the number of pixels the slider thumb has moved from the start position .getXValue()—an integer representing the number of pixels the slider has moved along the X axis from the start position .getYValue()—an integer representing the number of pixels the slider has moved along the Y axis from the start position .onAvailable()—executed when the slider becomes available in the DOM .setRegionValue() and .setValue()—allow you to programmatically set the value of the region slider's thumb More often than not, you'll find the custom events defined by the Slider control to be most beneficial to you in your implementations. You can capture the slider thumb being moved using the change event, or detect the beginning or end of a slider interaction by subscribing to slideStart or slideEnd respectively. The YAHOO.widget.SliderThumb class is a subclass of the DD class; this is a much smaller class than the one that we have just looked at and all of the properties are private, meaning that you need not take much notice of them. The available methods are similar to those defined by the Slider class, and once again, these are not something that you need to concern yourself with in most basic implementations of the control.
Read more
  • 0
  • 0
  • 2502
Modal Close icon
Modal Close icon