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

How-To Tutorials

7018 Articles
article-image-easy-install-gentoo-bling-bling-no-other-one
Packt
19 Mar 2010
13 min read
Save for later

The easy to install Gentoo with bling-bling. No, the other one!

Packt
19 Mar 2010
13 min read
The easy to install Gentoo with bling-bling. No, the other one! Gentoo is a source-based Linux distribution that helps users put together a streamlined custom system. But Linux users spoiled by the see-before-you-try Live CDs would often shy from Gentoo. Then along came Kororaa. Kororaa is a pre-configured binary Live CD for Gentoo Linux that also features an installer. Kororaa's package selection not only makes it an all-round Linux desktop, but has also ruffled feathers of Linux kernel developers. Kororaa's developer Chris Smart probably had the best tutors introduce him to Linux, including Andrew Tridgell, the author of Samba file server. In this discussion with Chris, he talks about why he developed Kororaa, why people interested in learning Linux should use Gentoo, and his new project to help users make the move to Free and Open Source software. Mayank Sharma: Chris tell us a little about yourself? How did you get started on computers? What drew you towards FOSS? Chris Smart: My name is Chris Smart and I live in Canberra, the capital of Australia. My Father was a computer teacher and so I grew up with computers and developed a talent for using them. Over the years through high school I was often fixing friends' computers and this has pretty much continued ever since (although I now only touch open source). When I left high school I deferred University deciding instead to work in the IT industry and in 1999 I started working for a local Internet service provider. At the time certain people were working for a company called "LinuxCare" who were on the same floor in our building. One of these people was Andrew Tridgell (of samba, rsync, etc fame) and it was here I first learned about Linux. Spending time with these fantastic guys gave me perhaps the best introduction to Linux I could have possibly had and I simple fell in love with open source software. Tridge set me up with RedHat 5.2 and I remember him fixing my screen resolution for me in X so that it would work nicely on my 19" CRT monitor. Those were the days :) From there I tried various Linux distributions, moving on from Red Hat and the 'RPM hell' I found myself constantly falling into. It was the year 2000 that I discovered Gentoo and from there I never really looked back. MS: So you had the best tutors. Over to Kororaa and the million dollar question -- Why Kororaa? What hole does it plug? CS: I used Gentoo for many years and over time got tired of the time consuming install process. I also had friends that I wanted to move over to Linux but I found myself spending hours and hours installing their own custom Gentoo for them. This was when Kororaa was born. I wanted a way to easily install a Gentoo system on other computers. At the time there was no installer for Gentoo and so initially my mate Matt and I set out to write an installer for the distro. Not long after however, the "Gentoo Linux Installer" project was launched. This made Kororaa switch focus towards a more custom 'install method' for Gentoo. We wrote our installer and released our first version of Kororaa, which was essentially a pre-configured Gentoo system which installed binary packages onto a computer and automated most of the configuration tasks. MS: Share some of Kororaa's highlights, the High-points, etc. CS: The biggest highlight of Kororaa was when it shot to fame as the first Linux distro to showcase Xgl on a live CD. We had hundreds of thousands of downloads and I think, from memory, we shot up the Distrowatch.com rankings to number 25. Even today, Kororaa is still known as the 'Xgl live CD', even though that was really just a side project to the main aspect which was having a binary install for Gentoo. Even before we released the Xgl live CD however, we were number 100 on the rankings and our Gentoo installer was doing quite well in its own right. MS: But you had trouble with the Xgl Live CD as well. What was that all about? CS: One fine day while we were basking in the success of the Xgl live CD, I received an email from a kernel developer who claimed that distributing the NVIDIA and ATI drivers with the Linux kernel was a breach of the GPL license that the kernel is under. He stated that the drivers were derived works of the kernel and therefore had to be under the GPL license. Either I had to stop distributing the drivers, or stop distributing the Linux kernel. Obviously I couldn't stop using the Linux kernel, but the greater issue for me was "what was the right thing to do?". I spent months and months researching the topic and gathering information to support both sides. In the end I found there was no actual answer and so it came down to a moral judgement more or less. I decided that if it could not be shown that distributing the drivers with the kernel was perfectly legal, then I should be giving the Linux developers the benefit of the doubt and not distribute the drivers. In the end this is what I did. MS: From what I know, you got little help from the community, legal and otherwise. Did the whole episode discourage you? CS: I didn't get much real legal help from the community, just a lot of opinions. You think you have it worked out and then someone from the other side makes a point and then it turns it on its head again. The bottom line for is that there is currently no legal precedence for this issue. As such that makes it hard to find the legal rights and wrongs. I think most people would know that distributing these drivers against the license of the Linux kernel, that's why no-one was doing it for so long. But, because there is this grey area, people convince themselves they are able to do it because no-one can say it's wrong. What's the answer? Legally, I'm not sure. But the Kernel is GPL and so all drivers distributed with the Linux kernel MUST be GPL, that part is very simple and everyone understands that. It becomes grey area when people say that the NVIDIA drivers aren't a derived work of the kernel and therefore don't need to be GPL. But seeing as that is hard to proveeither way, then what we do know is that we are distributing a video card driver for Linux that is not GPL and that to me seems like the wrong thing to do. What I found discouraging was the lack of real answers. Of course there was flaming from both sides with very, very passionate Linux-using people (often without much clue) weighing into the argument with their flaming 2 cents. People told me 'this is why they hate Linux and everyone should use BSD', others telling me to 'grow some balls' and all that sort of junk. But I tried to filter out those and gather information from reputable people, specifically those who could back up their arguments. In the end, removing the drivers killed the popularity of Kororaa, but that is something I was prepared to accept. Still, even now I'm happy that I felt I did the right thing, which was what it was all about in the first place. MS: Hmm. But why did you choose to base it on Gentoo? Any particular reasons, advantages? CS: Because Gentoo is source based, our goal was to quickly replicate a Gentoo system without having to compile packages to do so. Had we been using a different Linux distribution this would not have been necessary. Gentoo gave me the flexibility to build a binary system exactly the way I wanted to and then Kororaa made that easily installable. Originally Kororaa was a great way (well I think anyway) to install Gentoo without having to build it manually yourself. I selected specific packages that I felt fulfilled a certain purpose and this meant that the end user didn't need to know how Gentoo worked, nor what packages they needed. They could simply install Kororaa and have a pre-configured Gentoo system out of the box from where they could begin to learn Gentoo through using and maintaining it. MS: So initially Kororaa had features that Gentoo lacked. But now when Gentoo too sports an installer, is available on installable Live CD and Live DVD versions, where does Kororaa fit in? CS: You are right. Now that Gentoo has their own (working) installer and a live CD as their default environment I'm not sure what role Kororaa can fill, or whether it needs to continue at all. I think Kororaa still is a more customised and simplified system, whereas Gentoo still gives you a lot of flexibility during install time. We also clean up the system andadded our own artwork, attempting to make it look pretty out of the box whereas Gentoo generally just uses the defaults. Still, this might not be enough to warrant the continuation of Kororaa and with the popularity of other Gentoo based distros such as Sabayon, I think Kororaa has reached the end of its usefulness (unless we find some other hole we can fill in Gentoo land). MS: Was Gentoo your first distro? What sort of computer user would you suggest Gentoo as their first Linux distro? CS: I fell in love with Gentoo the first time I installed it. The ability to customise your Linux system beyond just choosing the packages to install was incredible and for the first time I felt in control of my computer. That's a pretty powerful thing and no other Linux distribution has ever given me that same feeling. Gentoo is great for people who have a desire to learn about Linux and their computer. I believe it is fantastic for 'newbies' so long as they have patience and the motivation to stick through the problems they will encounter. With Gentoo you can build your very own system unique to you and your wants, so along the way you will need to do a LOT of reading and research. The Gentoo forums are one of the best online communities I've ever been involved in and are the best resource to start with. For users who just want a system to work and want to do very little customisation and maintenance, Gentoo is probably not the right choice. Although it can be a high maintenance distribution, it doesn't have to be. When all is said and done though, if the idea of building your own kernel freaks you out then maybe you should stick with a binary distro ;) MS: On to your other initiative. Tell us a little about 'Make The Move'. CS: 'Make The Move' project was born out of my desire to promote Linux and free, open source software. Discussions with other members of the Canberra Linux User Group spurred me into action and the website was born. I launched it on the 1st January this year and since then it has had some 50,000 unique visitors. The website is designed to be a resource to explain what free software is about and how people can 'make the move'. I am using everyday language to convey technical ideas which will hopefully help to get an understanding of free software out into the general community. Over time I intend to build upon the content that is there and improve the quality of the site. This will require updating it as Linux and technology changes so that is relevant to systems of the day. So if you have friends, colleagues and family members who you are trying to get onto free software, point them to the site! It is a great research for those who often find themselves explaining what free software is about and why people should care. Just memorise the URL and forward it to everyone on your contact list, http://makethemove.net :) MS: So how's the FOSS scene in your part of the woods? Do people around you talk about it? Do the local papers mention it often? How's your LUG?CS: Being upside-down does make it tricky using computers at times, but nevertheless overall I think Australia has quite a good base of open source developers and the community here is quite strong. Rarely is FOSS in the news here however and that is something I am hoping to help change through the 'Make The Move' project. Many everyday people here have no idea about what free software is or what it can do for them. Slowly though more and more people are starting to hear about Linux. As this happens I hope that Make The Move can help to steer people in the right direction and not scare them away from what they might not yet understand. Australia also hosts one of the most popular open source conferences in the world, Linux Conference Australia, which attracts many prominent open source figures from all over the globe. MS: Last time I checked, a couple of sections on MTM were still awaiting content. If you have any calls for collaboration, either with MTM or Kororaa, feel free to enlist here. CS: I really desperately need some XHTML/CSS experts to fix issues with the site, so if there are people out there willing to help throw a few ideas around I would be most grateful! I am actually hoping to get a new, updated design happening soon. The site does not scale well and is not great under Internet Explorer (I know, every developer's favourite topic) but unfortunately these need to be fixed as our target market is most likely using Windows and Internet Explorer. We need to save them!! Actually, according to my web statistics, about 75% of people visiting the site are using Windows while only 20% are using Internet Explorer (70% are using Firefox). The other thing I need for the site are more translations! I would like translations into any and every language we can. Currently there are 7 translations active on the site with another 5 or so on the way, but there are many more languages out there. Through translations we can hopefully utilise this central website to expand the knowledge of free software into many more countries around the world. MS: Any upcoming Kororaa developments we should keep an eye out for? Any more projects in the pipeline? CS: At the moment my priority is to fix up the Make The Move website and release a new version as soon as I can. I have many content changes and updates that need to go live but I am holding off on until the new design is complete. Other than that there is not a lot new happening, although I did recently start a new job :) I have also begun writing some reviews for Distrowatch.com and might continue to work on that area as I do enjoy writing. We'll see :) 
Read more
  • 0
  • 0
  • 2630

article-image-how-choose-open-source-content-management-system
Packt
19 Mar 2010
10 min read
Save for later

How to Choose an Open Source Content Management System

Packt
19 Mar 2010
10 min read
I want to define a couple of important concepts before going into the detail of this topic. What is a Content Management System (CMS)?A CMS is a system that manages a website's content, without requiring any HTML knowledge, to link pages and to control how the pages look. A CMS makes it much easier for users to create, edit, and publish the content on a website. What is the scope of the document that covers CMS?CMS is available in commercial and Open Source licenses. It can be written using different languages such as PHP, Perl, ASP, JSP, etc. To help limit the scope of this document, I will only cover open source CMS that are written in PHP. What is the definition of content?Content can mean different things to different people. It can mean news, articles, Blogs, Wikis, forum posts, picture galleries, source codes, file managements for download, product for e-commerce and so on. And finally... How do I choose the best Open Source CMS for me?With my observations from the many people that visit opensourceCMS.com, the "How to choose an Open Source CMS" question is the most frequently asked, however there is no single simple answer! Below are my recommendations on the processes that I would normally use in selecting an Open Source CMS. Your criteria:One of the most basic steps involved in a CMS selection effort is to determine your requirements.  The following bullet points may assist you in the determination process. Content or Purpose: Defining the purpose of your content is just as important as defining the content itself. Is your content tailored for interaction, forums or for you to express yourself like Blogs and articles? Entry format: Content includes text, images, video; audio, XML, PDF, HTML, spreadsheets, etc. How should the content be stored: In flat files or in databases? Support: For open source projects, the community support is very important. How helpful is it? How active is it? Add-ons: There is rarely a CMS available that will match exactly what you need, so it is very important to have as many add-on options available for your chosen CMS as possible. Hands-on:With the above understanding of your requirements, this is where the rubber hits the road, so to speak. The fun begins with some hands-on experimenting with Content Management Systems, and oodles of research. opensourceCMS.com is the only site of its class that lets you play with a whole array of open source CMS with full administrator privileges before you do the installation on your own site. There are several categories of CMS at the site to choose from: Portal, Blogs, e-Commerce, Groupware, Forums, e-Learning, Image Galleries, Wiki, Lite and Miscellaneous. As you are experimenting with different CMS packages you might notice each has its own strengths and weaknesses. Some might prefer PHP-Nuke style, some might like the Mambo way of managing articles using section and category, others might love the way Drupal uses the concept of Taxonomy to organize information amongst others like Wiki, Blogs etc. You will also find CMS like eZ Publish and Xaraya, which comes with choices of multiple personalities for you to choose when you do the install. The most important thing is choosing a CMS package that fits the way you want to organize your content. It might take you a little bit of effort to learn how a particular CMS works. For example, when I started out learning about CMS I cut my teeth with PHP-NUKE and learned the way it organizes information using the concept of modules and blocks. I later learned about how insecure it is; our site was hacked and defaced a few times. So we set out to look for another CMS and found PHPWebSite; it looks very nice and it works similarly to PHP-NUKE but it didn't perform to our expectation on the version that we looked at, so we were forced to start our search again for another suitable CMS. This time we tried Mambo. Mambo does things different from PHP-NUKE and PHPWebSite. It took me a few weeks of reading forum posts, news, and articles to learn the way Mambo organizes things. Once we got the basics understanding of Mambo, we started customizing just as easy as PHP-NUKE, or even better! Research:Where should I begin? Read as much as you can on the forum posting of your particular chosen CMS at opensourceCMS.com or at the CMS project home site.  Comparison. You can visit CMSMatrix.com do a comparison on features of different CMS packages that you tentatively want to take a look at. CMS Rating  As I was doing research on different CMS packages, I figured that I would need some way to give me a starting point to determine where to start. That is when I decided to develop a dynamic list of CMS ratings based on visitors' ratings, voted for by visitors of opensourceCMS. I created a composite of all the ratings into a list sorted by category and by rating score in a descending order. You can find the CMS rating list here. CMS top hits.  One other tool that I use to help me decide on which CMS to choose is by looking at the hits statistics on a particular CMS demo at the opensourceCMS.com site. So I decided to develop a CMS Top Hits list.  This list is a dynamic collection of the statistics of the daily hits counted by the visitors to the CMS demo. One other figure that I found very useful beside the hits count is the 'Ratio'.  The Ratio is calculated based on this formula: Ratio = (number of hits) / (number of days since this CMS was listed at the site).  By using this indicator all CMS has a fair chance comparing to other CMS that might be listed at the site for a longer time.  You can find the CMS Top Hits list here How about other kind of CMS? As I was studying the world of CMS I found that there are many CMS packages available out there on the net.  Beside the usual category that you might find at opensourceCMS.com, there are: CMS Framework, KMS, Directory, Calendar, etc.  There are too many to name here!  You can find a collection of my research on different kinds of CMS from my site at OngETC.com Is it secure? You might want to visit www.osvdb.org to see how much vulnerabilities your chosen CMS had and how quickly it was patched.  You might not want to pick a particular CMS that it is particularly insecure. Try again? You might have discovered that you sometimes have to abandon the CMS you have chosen for some reason(s) and go back to the hands-on point and try out a different CMS.  Plug-ins:Next, decide what features and functions you would like to use on your site.  The following questions might help you to decide: Do you want to store your content in flat files or databases?  Will there be a need for an event calendar?  Will there be a need for an upload/download area?  What about an image gallery?  How about a poll or survey tool?  Will you be needing multi language support or translation function?  How about WYSIWYG (What You See Is What You Get) editor for content? Is security and permission important to you?  How do you want to set permission and assign access to your content? Components and modules are "plug-ins" that typically provide add-ons to the core system.  Sometimes there are presets of add-ons installed as a part of the base system and sometimes you will have to install them separately.  This can vary greatly from one system to the next.  More established systems like Mambo will have a lot of community support which translates to a wide variety of components, modules and plug-ins.  You will soon find out that some of the features you want, might not be available as part of the core or add-ons.  You might have to buy a commercial add-on product, pay a 3rd party developer to do it for you or learn enough to develop your own. It helps to list all the things you need and use that as your shopping list to test against and to experiment with.  The key word here is experiment because that's the best way to understand how useful it might be. The LookLastly, once you determine the base system and the add-on features to use, it is time to decide on how your site will look.  Most systems utilize templates or skin and CSS (cascading style sheets) that allow you to tailor the look of your site.  It's up to your imagination!  Even if you are not a graphic or template designer, there are many free or commercial templates that you can acquire and tailor to fit your taste. You can download these and add them to your site which can really give it a complete makeover.  Some of the CMS have a "template chooser" that lets you pick different "skins" for your site.  At last...In Summary, this article started out by defining 'what is a CMS?'  'What is the scope of this article?'  'How content definition could be differed in people mind?' 'How do you decide which CMS is best for you?' We also looked at what criteria to use to define your requirements.  With your tentative set of requirements, this article suggests where to go to do some hands-on experiments to gain more understanding about different choices of CMS, and how to fine tune or expand your criteria.  We also shared a little of our experience when we went through the process of choosing a CMS. Once you identify a CMS that you like, then it would be worth while to do a lot of reading regarding your choices, whether at opensourceCMS.com, or at the CMS project home site and any additional affiliate sites that you can find.  You might consider doing a search on Google about your particular CMS to see what else you might find.  The point is doing as much reading as you can afford! With knowledge from all the reading you have done, it is time to decide on what additional feature-sets you want and find out whether it is available on the core system; pre-built plug-ins, and freely available open source or commercial plug-ins. Finally you will need to decide on a template for your site.  You might develop yourself, download some open source templates, or buy from a professional commercial template designer. That should give a good overview of the whole lifecycle in choosing an open source CMS and give a brief glimpse into some things for consideration.  Now is the time to load your content to your site and ready for the debut to the world! By Chanh Ong Chanh Ong is a Computer Specialist. Chanh has many years experience in various computer platforms and operating system, programming languages, system administration, DBA and etc.     Content Management Books from Packt Packt publishes a range of books on various Open Source Content Management Systems, including Joomla!, Mambo, Plone, TYPO3, DotNetNuke, OpenCMS, XOOPS and many more. For more information, please visit: www.PacktPub.com/content-management  
Read more
  • 0
  • 0
  • 7295

article-image-roles-alfresco-14
Packt
19 Mar 2010
9 min read
Save for later

Roles In Alfresco 1.4

Packt
19 Mar 2010
9 min read
Roles in Alfresco 1.4   The article explains the basics involved in understanding Alfresco authorization and the means to extend its functionality, for example, to adapt it for any special requirements through configuration files. The concepts explained in the article will be useful for anyone who has started working with Alfresco code. In addition to this, a little step-by-step example towards the end helps you extend the initial Alfresco roles. Read out more in the article written by Alfonso Martin. Once you have started with Alfresco, you will realize that you need to create or expand the default roles included with Alfresco. This task (at this moment) must be done manually through configuration files. Before diving into the Alfresco.war file to search for the property configuration files, you will need to understand a few concepts. This article will introduce you to the basics in Alfresco's role policy. The basic concept in action authorization in Alfresco is that of permission. Permissions dictate when an action can be executed on an object by a user. Key concepts in defining authorization policy in Alfresco are: PermissionSets PermissionGroups Permissions GlobalPermissions Such elements are declared in the permissionDefinitions.xml file, located in WEB‑INF/classes/alfresco/model inside the Alfresco.war file. PermissionSet Collections of permission groups, permissions, and dynamic authorities with common attributes: type: (Mandatory) PermissionSet is defined over a type or aspect. If it is defined over a type, then it is applicable for all objects of that type; if it is defined over an aspect, then it is applicable for all objects that have the same aspect. expose: (Optional) This attribute restricts the domain of Type. If the value is all, it is allowed to apply a PermissionSet to objects, which have a parent that satisfies the Type attribute. Otherwise, if the value is selected, the set is only applied to objects that satisfy Type attribute. All is assumed, if the attribute is undefined. PermissionGroup PermissionGroup defines its behaviour through several attributes: name: (Mandatory) Group identifier. type: (Optional) Same as in permissionSet. extends: Determines if the permissionGroup extends the definition of a previous group with the same name. If undefined, default value is false. expose: Restricts the domain of type, and if true, the permissionGroup will be applied to objects (and derivatives) that satisfy the attribute type. If it is undefined, then false is assumed. allowFullControl: If true, group has all privileges, else the privileges are to be assigned. requiresType: If false, permissionGroup can be applied to any object, otherwise only to objects that satisfies type. If undefined, the default value is true. PermissionGroup can be composed by several permissionGroups, whose sub groups will be identified by name and type. If type is omitted, the parent’s type will be used. Permission A permission is the minimal unit to represent an authorization of an action on an object. It is defined by: name: Permission identifier expose: If true, the permission can be applied to derivative objects, otherwise only to objects defined in a permissionGroup context. Default value is false requiresType: If true, a permission can only be applied to objects defined by its group context. If it is omitted, default is false A permission can require the authorization of other permissions, such permissions are identified by: name type on: Specifies where the permission is required—node, parent, or children. implies: If true, the required permission grants itself the parent’s permission. There can be only one required permission with attribute implies equal to true. If omitted, the default value is false. Inside the permission are the declarations of the permissionGroups that contain said permission. These declarations require existent permissionGroups, and can optionally specify the node types where the permission will be applied will be applied to all nodes. GlobalPermission These kinds of permissions are defined outside a permissionSet, and are applied to all nodes in the hierarchy (irrespective of its type and related aspects). This kind of permission prevails over other permission types. Roles Roles in Alfresco are a special type of permission group, concretely permissionGroups, which are defined in permissionSets applied to nodes of type content. To use these roles in the Alfresco GUI, it is necessary to create appropriate tags in the internationalization files, more specifically, the webclient.properties (this file can vary in function of language/country) and is typically located in WEB‑INF/classes/alfresco/messages Predefined Roles Alfresco defines a few basic roles in the permissionDefinitions.xml. These roles are defined in an incremental manner. First, it creates a Consumer role and then defines the rest of the roles, adding functionality to the Consumer role. Predefined roles are: Consumer: Allows read properties, content, and children of a node. Editor: Adds to consumer privileges the ability to write nodes (properties, content, and children) and execute CheckOuts in nodes with aspect lockable. Contributor: Adds to consumer privileges the possibility of adding children and execute CheckOuts in nodes with aspect lockable. Collaborator: This role has the same capabilities as Contributor and Editor. Coordinator: This role has all privileges including the possibility of taking ownership of nodes, and changing its owner. Administrator: Same as Coordinator, it is defined for backward compatibility. Default Permission Policy After a first check out of the permissionDefinitions.xml file in Alfresco 1.4, you will find five major PermissionSets. These sets establish node permissions across the Content Model hierarchy: It starts with base type, which defines basic low-level permissions. The next set defines permissions for the cmobject node types, which at this level are defined in the permissionGroups and later will be extended by roles. Content nodes have a set, which defines the available roles. In addition to these sets, the permissionDefinitions.xml file includes two other sets. One of these sets is for nodes that have the aspect ownable, and the other is for nodes that have the aspect lockable. The permissions defined in such sets allow the execution of typical specialised actions with these kinds of nodes—Check In, Check Out, Take Ownerships, Change owner, Lock, and Unlock. After PermissionSets, the configuration file declares GlobalPermissions. These permissions will be applied to all nodes, and they have priority over other permission types. At the moment, these permissions are: FullControl: Allows users who have any of these roles—ROLE_ADMINISTRATOR or ROLE_OWNER. Unlock, CheckIn and CancelCheckOut: All these allow users who have their role defined as ROLE_LOCK_OWNER New role definition example: This example is based on ideas explained in one of the Alfresco forums. The case study is the typical context, where three specialized folders are needed—Drafts, Pending approval and Published. Drafts: Stores actual working documents. Pending approval: This folder contains documents whose author(s) has/have requested approbation. Published: Stores final versions of documents. Preconditions There exist two differentiated user groups—Creators and Approvers. Creators have full access to folder Drafts and read access in Published; Approvers have full access to Pending approval and Published. Creators need to move documents from Drafts to Pending approval, but cannot see the folder files. To model this situation, we create two user groups called Creators and Approvers. Then create three spaces Drafts, Pending approval and Published. Each space will have the following configuration: Drafts: Uncheck Inherit Parent Space Permissions checkbox. Invite group Creators with role Collaborator. Pending approval: Uncheck Inherit Parent Space Permissions checkbox. Invite group Approvers with role Coordinator. Published: Uncheck Inherit Parent Space Permissions checkbox. Invite group Approvers with role Coordinator. But as you can see, with this configuration there exists a situation with the prerequisite: Creators need to move documents from Drafts to Pending approval, but cannot see the folder or files. Alfresco does not include any role that satisfies this. So, it lets you create it. Open the permissionDefinitions.xml file. First define a low level permissionGroup called CreateNodes, this group should be defined inside permissionSet with type base; in other words, available for all kinds of nodes. Also inside this set we need to declare the permissions that compose this permission group: In our case only the permission _CreateNodes. ...   <permissionSet type="sys:base" expose="all"> .../p>   <permissionGroup name="CreateNodes" expose="true"   allowFullControl="false"/> ...   <permission name="_CreateChildren" expose="false">     <grantedToGroup permissionGroup="CreateChildren"/>     <grantedToGroup permissionGroup="CreateNodes"/> <!-- New -->   </permission> ...   <permissionSet/> Then we need to define a role called Writer (remember, in set with type content), this role extends the behavior of a permission role declared in the set with type cmobject. The permissionGroup, Writer will include previously defined CreatedNode. ...   <permissionSet type="cm:cmobject" expose="selected"> ...     <permissionGroup name="Writer" allowFullControl="false"                                                        expose="true">       <includePermissionGroup type="sys:base"                                       permissionGroup="CreateNodes"/>     </permissionGroup> ...     <permissionSet/>   <permissionSet type="cm:content" expose="selected"> ...     <permissionGroup name="Writer" extends="true" expose="true"/> ... With these additions, we have created a new role called Writer that will solve our little situation. To be allowed to use it in the Alfresco GUI we need only to add a properly internationalization tag in webclient.properties: Writer=Writer role [...] Writer= OurWriter role And now we can invite the Creators group to the Pending approval space with the Writer role. The creators will be able to move documents from Drafts to Pending approval, but they will not be able to read the folder. The last operation is to add a rule called Request approval in the space Drafts that moves documents from Drafts to the space Pending approval. This is a trivial example for homework where you can try to add rules  in spaces with simple workflows to formalize the process  of  approbations and rejections.
Read more
  • 0
  • 0
  • 2334

article-image-making-complete-yet-small-linux-distribution
Packt
19 Mar 2010
9 min read
Save for later

Making a Complete yet Small Linux Distribution

Packt
19 Mar 2010
9 min read
Making a complete yet small Linux distribution There's an endless list of actively maintained Linux distributions on (Distrowatch). With modern Open Source applications demanding more and more resources, the most popular Linux distros are also the most resource hungry. Zenwalk (http://www.zenwalk.org/) and Vector Linux (http://vectorlinux.com/) are two Linux distros that promise the ease-of-use of a modern desktop Linux distro but keep the resource utilization in check. So how do they do it? In this discussion with Jean-Philippe Guillemin of Zenwalk and Robert Lange of Vector Linux, I try to understand what it takes to make a distro that's equally capable of running on the first generation of Pentiums as well as the latest. Mayank Sharma: Any advantages of choosing Slackware ( http://www.slackware.com/) as base? [Both distros are based on Slackware Linux.] Robert Lange: I think slackware gives you the ideal base to work from. The most note-worthy advantages are simplicity of design, lack of dependency hell and easy configuration.Jean-Philippe Guillemin: There are some advantages, and also some disadvantages. Of course it depends on the goals of a project, so what I'm going to tell you applies to Zenwalk but may not apply to other projects. Let's begin with goals, then we'll talk about advantages, and finally about disadvantages. The main goal of the Zenwalk project is to build a "rational GNU/Linux operating system". That means that the system is designed to be very simple and responsive, with one application for a given task. The main advantage of Slackware as a starting point to build a GNU/Linux OS with this kind of objective is that Slackware is a pure Linux/Unix system, without bloated subsystems, very simple and flexible. It is one of the last systems of this kind. You can guess that such a "pure" system is ideal when you want to build your own vision of desktop, hardware management and administration tools. The main disadvantage of Slackware as a base system is implied by the main advantage. It is the amount of work needed to transform it into a desktop OS. With most other "major" Linux systems , 80% of the work is already done. It seems simpler to me to build a desktop derivative from one of these big Linux distributions because the desktop system is already nearly finished, but it would give less freedom.   MS: Talking of Slackware, do you contribute upstream? Any changes you'd like to see up there? RL: The short answer is no. Slackware really doesn't appreciate so called forks in its design philosophy so even if offered I highly doubt that there would be any level of acceptance. However, we make the changes that we apply to the system available in our FTP repository. JP: Not really. I sometimes contact Patrick Volkerding [Slackware maintainer] when I need information about something I don't understand in Slackware or to get some news about him. I also ask for his opinion when I am about to decide for a structural change in Zenwalk. I want Zenwalk to remain Slackware compatible, although the fork is really huge now. The only contribution to Slackware was Zenwalk's Xorg 7.X system that Pat plans to use as a base to build his own version. At the moment, Pat is working to update the base toolchain (glibc, gcc, etc). When he has finished this on Slackware's side, we will have to rebuild nearly everything in Zenwalk on this new environment. Apart from this awaited modernization of the toolchain, I wouldn't change anything in Slackware as that's not really important for Zenwalk. We are independent now and the only important condition is to maintain application compatibility between the two projects. MS: Any new distribution that you think would make a good base, if you were to start afresh today? Any particular reasons? RL: There is at least to my knowledge nothing new in what I call the absolute base in a linux distro. 99% percent are based on Debian, Redhat/Fedora, Gentoo and Slackware. The exception being Linux from Scratch (http://www.linuxfromscratch.org/). I don't think I would make any different choice today then I made almost nine years ago. JP: Easy question. To start a new project I would not use anything else than Slackware. At least Linux From Scratch (http://www.packtpub.com/article/Linux_From_Scratch) would be an option, or maybe Zenwalk itself ;). MS: What's the lowest hardware configuration that people have managed to run Vector on? What would you suggest as the minimum config for a usable system? RL: It depends on what version of Vector you are talking about. Our very early versions would run on an i486 machine with 32 MB RAM although X, the Graphical User Interface (GUI) would be pretty slow. Todays 5.x versions have run on Pentium 166's with 128 megs of RAM. To have a pleasant experience we suggest at least a Pentium 2 with 128 megs of RAM. The X GUI is the system hog. If you want to run a console based system a Pentium 100 with 24 MB of RAM would probably work. JP: Zenwalk can be run on a Pentium 2 processor, assuming that you have enough RAM to support X window applications. 256MB is enough to drive such an old box with acceptible usability. The minimum recommended configuration for true responsiveness is a Pentium III system with 512MB RAM.  MS: What other software are essential? I mean components like Window Managers, multimedia players, office applications, etc. Which are the ones that you've included and how have they helped you with your purpose? RL: We try to give our users the basics from most computing categories. The Window Manager we liked the most up till recently was IceWM in combination with the roxfiler system, which allowed for a very light weight X system with much of the same functionality that say Windows 98 users were used to. We have recently jumped on the Xfce 4 bandwagon as its the perfect desktop for lower spec computers but still offers many of the configuration options that only GNOME and KDE users were able to get. The browser market has always been a problem for old computers. Mozilla, Opera and Firefox are RAM eaters, but we offer dillo as an alternate and it does a reasonable job. Office chores are handled by Abiword, which is a great program for low spec machines. Xmms has been our mutimedia player along with Mplayer and GMplayer. JP: The Window Manager and file browser are essential and mandatory parts of the desktop system. We use a customized version of XFCE along with the Thunar file manager. We provide one mainstream application for each task with the Zenwalk desktop. Quoting my friend Claus Futtrup, our Zenwalk columnist, as late as December 2005 the most critical applications for a desktop user were : No 1 : Email client, rated critical by 62% of users, No 2 : Productivity, rated critical by 51%, and No 3 : Web browser, rated critical by 50%. Apart from the applications, one very important aspect is "Desktop integration". All applications should use the same widgets, same color theme, same icons, etc. This is important because icons and windows layout must be consistent to keep the usability as smooth as possible, especially widgets layout and icons. We achieve this by providing exclusively GTK+2 (http://en.wikipedia.org/wiki/GTK+) based applications. MS: I'd appreciate if you could list or briefly explain some of the key issues of assembling a distro that's capable of running on slower hardware. Do you strip kernels, or use the stock ones? RL: The key is to keep things as simple as possible. The less background processes you have running the more memory is required for executing programs. We use a very vanilla kernel with as much modularized as possible to keep its resident size to a minimum. Compile code optimized for i586 that seems the best for compatibility and speed on a wide range of hardware. Pay attention to the init process since you want as much control as possible over what does and does not get loaded and pass this on to the user. JP: Let me first clarify that Zenwalk is not designed for use on old hardware (for example there is no ISA (Industry Standard Architecture) bus support in Zenwalk). Zenwalk is designed to provide the optimal responsiveness that you can expect from a GNU/Linux operating system. The entire system is tuned towards this target. The kernel is configured in a very uncommon way as would be in an embedded system with preemptive processus and IO schedulers, installed libraries are kept to a minimum. We also use only one graphical toolkit for this particular reason, GTK+2. We avoid using bloated subsystems and prefer simple low level systems like udev or inotify for devices polling - we developed our own alternative automount system. Using Xfce, which is a feature-rich yet light desktop environment with its Thunar file manager also helps to improve the responsiveness. There are many other enhancements, but I can't sum three years of research here in a few lines :) MS: How long has it been since you've been rolling out the distros? Why do you think people still use them, despite hardware becoming cheaper? RL: Its been eight or nine years now. I think its the simplicity and speed that keeps them coming back for more. We have also developed a substantial online user community that is second to none in being a friendly place that new users can join the Linux ranks without fear. JP: The project started three years ago. Our user base really began to grow significantly one year ago. At that time the project was mature enough to compete with major GNU/Linux distributions. I really believe that our user base is growing because people find something unique in Zenwalk. For example, in as little as 20 minutes utilizing a very easy setup, the users obtain a true modern working environment ready to use with only the best application for each need. Thus, Zenwalk is usually considered as one of the fastest GNU/Linux systems available. People can run it with blazingly good performance on modern, and also semi-modern computers.
Read more
  • 0
  • 0
  • 2853

article-image-starting-windows-workflow-foundation
Packt
19 Mar 2010
5 min read
Save for later

Starting with Windows Workflow Foundation

Packt
19 Mar 2010
5 min read
Installing WinFX A successful installation of .NET Framework 2.0 is the first thing we need to use Windows WF. You need to have the latest version, because older ones don't work with the latest bits. On http://msdn.microsoft.com/winfx/, click Get the Beta. You need at least, the WinFX Runtime Components along with the Visual Studio 2005 Extensions for Windows WF. Of course, for the latest item you must have a running Visual Studio installation (Express editions won't work). These extensions to the integrated development environment (IDE) are necessary because, although it is possible to create the workflow in code, it makes easier to manage the XML and code-behing files Windows WF uses for its work.Downloading the entire Windows SDK to check other new technologies such asWindows Presentation or CommunicationFoundations is also suggested (formerly known as Avalon and Indigo, respectively). Why Workflows? Until now, flowcharts and process schemes were done separately from code, just as a way to organize ideas before writing the actual code. But when the task was finished, the scheme remained just as documentation. Also, the capacity of older computers made impossible to retain all the information of a workflow in memory, and it was difficult totranslate from an easy-readable format for human to machine code. Windows WF tries to solve all these problems, making workflow technology available to every single programmer that uses the .NET Framework, and thereby making it general enough to be used in different situations. That seems the natural step from the interoperability concepts in the Framework; if it can execute code written in a bunch of languages, then why not have a tool that translates a conceptual idea of how a work is to be done in real, compliable code? Windows WF can be used for document management (for that special task it will be integrated into Office12), business cycles, or page flow (by making use of ASP.NET). There are lots of reasons as to why a developer would choose writing a workflow instead of writing the code. First of all, for programmers, workflows are easier to understand than code, because workflows provide a visual representation of the process. Consequently, code becomes harder to maintain and adapt to new areas. For example, adding a step in the middle of a scheme because we need to have an additional agreement with the user because of newer laws can be real pain for coders, but an easy step forworkflow users. In addition, Windows WF provides a way to extend existing workflows without need of recompiling, so general frameworks can be developed and then customized to fit in different areas. Basic Concepts Layers in Windows WF: The first one is the code that uses the workflow, because a workflow is not an application, but instead a set of actions that is executed asynchronously by the engine provided by Windows WF. That's the key to being able to use a workflow in such a variety of scenarios. The interface that allows communication between that engine and the executing process is called the Hosting Layer, which provides some extra services apart from Communication (send an receive events and data from and to the workflow), like Persistence (which allows saving the state of the workflow in a storage media to restore it later) or Tracking (so the actual code running the workflow can log the execution of it). Finally, we find the Runtime Layer, which actually executes the workflow and manages the core services. One different with the other two layers is that Runtime Layer is not extensible, while more services can be added to the Hosting Service. Apart from these layers, Windows WF comes with an integrated designer that by default integrates smoothly in Visual Studio 2005, but which can be used outside it, so any developer could add drag-and-drop support to its own application. Activities and the minimal units in Windows WF: Each activity receives some parameters from the developer, executes it actions, and then the flow is transferred to the next activity. Some examples are Code or IfElse activities. As developers, we can create new activities and use it in our own code or create an ActivityLibrary for selling. We can get new activities at no cost on its official website www.windowsworkflow.net. There are two main kinds of workflows: 1.       Sequential: Its actions are executed in some predefined order with a beginning and an end. Examples of sequential workflows may include installations. 2.       State machines: These workflows don't have a path, but it's represented as a set of states and transitions between states. Examples are a web shop: you may need approval for mailing, the user could pay via credit card or with a cheque, and each user is in one state and may go to any order depending on previous questions.
Read more
  • 0
  • 0
  • 2875

article-image-best-way-create-round-cornered-boxes-css
Packt
19 Mar 2010
5 min read
Save for later

The Best Way to Create Round Cornered Boxes with CSS

Packt
19 Mar 2010
5 min read
The best way to create round cornered boxes with CSS. Boxes with round corners have become synonymous with WEB 2.0 and the future of website design. Forget AJAX, don’t worry about SEO, put content on the back burner, what really excites people is nice rounded boxes. Why is this so? I’ll tell you why… When website layout was done purely with nested tables, creating a box of content with curved corners was tricky. Not impossible, but perhaps more effort than could be justified (or charged for). Using tables, the curved box would be sliced and diced into many smaller images with a top-left corner image, a top-right corner image and so on until you had a perfectly rectangular space in the middle of the clutter of tiny images where the content would sit. It would be at this point that the client would ask for corners with a larger radius, or in a slightly different shade and the whole image slicing would start again. And don’t even talk about drop shadows. CSS did bring some relief from the slicing of images. With CSS you can assign a whole image as a background to an area of content, and position the content nicely on top of it. The background image could of course be an image of a box with rounded corners. Perfect? Well not quite. If you had fixed size content then a fixed size background image would be fine, but content never stays the same for long. Words are altered, font sizes are changed and before you know it the content exceeds the length of the beautifully rounded box it is sitting on. Yuck. There have been some inspired, yet ridiculous methods of overcoming the problems of changing content size within a rounded box, some of which create the corners with client-side code, adding a new DIV to the DOM for every pixel in a mathematically calculated corner. Clever? Yes. Bloated, slow and somewhat ridiculous? Yes to that too. What is needed is the neatest, fastest, most flexible way of creating rounded boxes that can hold varying amounts of content. And this is where I offer my most elegant of solutions. To achieve such simplicity and elegance there is one small prerequisite, and that is that our box is of fixed width. This is no great trouble because it is very sensible to allow boxes to grow vertically rather than horizontally. Columns and vertical scrolling are good practice. Rows and horizontal scrolling are a big no no. And so to the method of creating the easiest and most efficient rounded boxes. Step 1 In Photoshop or your favourite graphics editing package, create the round cornered box you need making it the exact required width and any average height. You should now have an image that looks like figure (a). Notice the shading and drop shadow too. Figure (a) Step 2 Divide the image into 2 parts, a top and a bottom, making the top part as tall as any title line you way want to add to the box. Your 2 images will look like figure (b). Figure (b) Step 3 Increase the canvas size of the bottom portion of the box to a large value making sure it is tall enough to cope with any content it may need to hold. Don’t worry that the bottom image looks far larger than you will need most of the time. Your 2 images will now look like figure (c). Figure (c) That’s all there is to do on the graphics side, now on to the CSS. On your webpage add this HTML: {literal} <div id=box1> <div class=boxtop> <div class=topcontent>My First Box</div> </div> <div class=boxbottom> <div class=maincontent>With some content</div> </div> </div> And to your CSS file add these definitions, obviously changing style parameters to suit your requirements: .boxtop{ /*make this the same size as the top image*/ display:block; width:267px; height:48px; /*set the image as a background*/ background-position:left top; background-repeat:no-repeat; background-image:url(images/top.gif); } .topcontent{ /*set the font style for the box title*/ font-family:arial; font-size:16pt; color:white; /*shift the title down a bit and center it*/ padding-top:10px; text-align:center; } .boxbottom{ /*make this the same width as the bottom image*/ /*don’t set the height as this needs to be flexible*/ display:block; width:267px; /*set the image as a background*/ background-position:left bottom; background-repeat:no-repeat; background-image:url(images/bottom.gif); } .maincontent{ /*set the font style for the main content*/ color:white; font-family:arial; font-size:12pt; display:block; /*align the main content nicely*/ padding-left:20px; padding-bottom:40px; padding-right:30px; } {/literal} Incredibly, that’s all there is to it. You now have a rounded box with shading and a drop shadow that only uses 2 images and a small amount of CSS, and the whole thing is wonderfully cross-browser compatible. To see the final effect take a look at this page here www.eveshamsolutions.co.uk/cornersdemo.html. Feel free to view the source code and pinch the images to play with. If you use this technique don't forget to mention where you found it, if only in the source code :-)
Read more
  • 0
  • 0
  • 1809
Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €18.99/month. Cancel anytime
article-image-alfresco-enterprise-content-management-author-interview
Packt
19 Mar 2010
10 min read
Save for later

Alfresco Enterprise Content Management - Author Interview

Packt
19 Mar 2010
10 min read
  Hello Munwar. Thank you for taking time off your busy schedule to answer some of our questions. 1.      From specializing in Digital Electronics and Advanced Communications to authoring Alfresco Enterprise Content Management Implementation – talk us through the journey! Though I completed my masters in digital electronics, my work has been always with software engineering. I worked as the chief architect and manager of engineering teams for 15 years in the areas of system software and Internet applications for customers in the United States, Japan, Germany, and India. For the past ten years, I have been implementing various content management systems. I started with multi-million dollar implementations of proprietary software and faced all kinds of challenges including vendor lock-in, rigid code base and expensive upgrades. I co-founded CIGNEX in 2000 with an idea of making open source work for the enterprises. Since then, we have successfully delivered more than 50 CMS applications using various open source technologies and got featured in IDC. Unlike most other open source CMS which offered only the web content management, Alfresco provided a wide range of solutions to Enterprise customers with an impressive roadmap. This excited us a lot and we started implementing Alfresco in many enterprises. As part of our implementation we also train our customers so that they are equipped with all the information required to manage their systems. I have trained many users, administrators, and developers in Alfresco.  I decided to author a book on Alfresco, based on the requests I have received from David Barnes of Packt Publishing and John Powell, CEO of Alfresco. 2.      How is Alfresco different from Documentum and some other Enterprise Content Management systems? What does the Alfresco team mean when they say that Alfresco aspires to be "Documentum fast and free"? Alfresco is unique and different. It is the first new Enterprise Content Management system built in over five years, based on open source and open standards. There are literally hundreds of open source content management systems on the market, but none address the requirement of enterprises small, medium and large to manage, share, control and reuse content across the company. Alfresco is different when compared to other ECM systems with the following specification: Enterprise features (scalability, security and failsafe plus the power to manage any form of unstructured data not just web content) Super fast Simple (to install, to use, to customize) With low costs John Newton who is the co-founder of Alfresco, was the co-founder of Documentum who knows this space pretty well.  His goal is to build a real Open Source ECMS that is 10 times faster and free.  I think he and his team achieved the goal pretty successfully.  3.      Tell us something about CIGNEX and Mike Walker and their contributions towards writing of the book. CIGNEX is the leading provider of open source Enterprise Content Management (ECM) solutions for businesses and government agencies.  Mike is the Vice President, in-charge of consulting at CIGNEX.  His organization is among the very first to successfully deliver ECM projects using Alfresco. Our consulting team at CIGNEX presented me the various flavors of Alfresco implementations that I would not have possible imagined, with real-life examples as they work on the Production projects. Mike (reviewer of the book) made sure that the information in the book is relevant to someone who is seriously considering Alfresco to deploy an ECM application. Starting from our CEO, Navin to a developer at CIGNEX, everyone contributed to the book one way or the other. My sales and presales team at CIGNEX, Amit, Candace, Harish, and Jarred helped me understand what customers are looking at.  I have learnt a lot through numerous discussions with them. I am thankful to my team at CIGNEX.   4.      At CIGNEX you have trained many users, administrators, and developers in Alfresco. How much has training helped you in writing this book? In June 2006, I have spent significant time creating Alfresco training for Users and Administrators. The training material had about 325 PAGES and 48 LAB EXERCISES, covering the latest features of Alfresco. I have got a good feedback from the attendees and over a period of time the quality of the training material improved. Thanks to Dr. Paul Holmes-Higgin (VP of Engineering, Alfresco) for his idea of running Portable Alfresco on a USB Drive.  I created and delivered the training material in a keychain (1 GB USB drive) which attracted many attendees as they do not have to install it on their computers. Training also helped me to define my writing style. I started by showing the reader how to do something - a step-by-step example. I explained how that process worked. Then, I explained what other options are available, and how they fit into the overall picture. I hope this helps the reader "generalize" from this example. Now, at CIGNEX we offer 4 various training programs in Alfresco (a) Foundation training for the beginners (b) Developer training (c) Workflow and Customization and (d) Web Content Management   5.      John Powell, CEO Alfresco has written a foreword acknowledging your book. Were you in touch with the engineers and developers at Alfresco during the writing of this book? John Powell was kind enough to write a foreword for this book. Everyone who read it enjoyed it. You must read it to know how big minds (John Powell-CEO and John Newton-CTO of Alfresco) think and create world's most successful companies. The good decision I made when I started writing the book during August 2006 is to work on the upcoming version of Alfresco (1.4 then).  This requires significant amount of understanding of the upcoming features which are not completely documented (as the Alfresco engineering team was developing it).  Thanks to Alfresco team who helped me getting the documentation and updating the Alfresco wiki. Alfresco released 2.0 beta recently with web content management features.  Due to the extra care we took in planning the book, the content of the book is relevant to the recent latest release. 6.      Who is the book aimed at? This book is designed for content managers, system administrators or developers who want to install and use Alfresco in their teams or businesses. Because Alfresco is free many teams can install and experiment with its ECM features without any upfront cost, often without management approval. This book also aimed at business users to make decisions to migrate from the existing proprietary ECM to standards based open source ECM. This book is particularly suitable for IT consultants who want or need to set up a flexible enterprise content management system for their clients, be that for demonstration, development, or as a mission-critical platform. This book gets you to that result quickly and effectively. 7.      Which chapter of the book did you enjoy writing the most? Which one do you think is most exciting? I enjoyed writing all the chapters and the most exciting one is Chapter 13, Implementing Imaging and Forms processing. This chapter helps you to implement an end-to-end solution by collecting the paper documents, and forms; transforming them into accurate, retrievable information; and delivered into an organization's business applications. The information then, is full-text searchable, and goes through the various approval workflows, based on the organization's defined business process management. By the end of this chapter you will have learned how to: Connect scanner to network drive, and map it to the Alfresco's space Specify a business rule to automatically extract metadata from the scanned document Define and execute a workflow process for scanned documents Bulk upload scanned documents into the Alfresco repository Integrate OCR utilities such as Kofax and eCopy into Alfresco This chapter provides solutions closer to your business requirements such as Order fulfillment, Claims processing, Underwriting, Loan origination, Contracts management, Accounts payable managing checks and invoices. 8.      Can you install Alfresco both on Windows as well as Linux Operating Systems? Have you explained the installation techniques in the book? You can install Alfresco both on Windows as well as Linux operating systems.  You can install Alfresco to use a wide range of databases such as Oracle, MySQL, Microsoft SQL Server.  You can install on variety of application servers such as Tomcat, JBoss. I have dedicated a chapter (Chapter 2. Installation) and included the information about the architecture, various installation options, and the key terminologies used. By reading this chapter you will be well equipped with the information to make a choice on the suitable operating system, database, application server, and other software required for your installation. 9.      In Chapter 3: Planning, you talk about Follow Best Practices to implement a project using open-source software. Give us a sneak preview about it. Most of the Enterprise Content Management projects fail not because of technology, but because of lack of proper planning. Planning is the most critical phase of any implementation project. During this phase, most of the decisions are made to customize specific features in a particular way. You define the security framework, custom-content types, folder structure, categories, workflow, reporting, business rules, and collaboration. During planning phase, you will scope your implementation, prioritize the requirements, and finalize the project plan. This chapter provides you information required for your planning exercise before implementing your system using Alfresco. 10.  Can you explain in brief Roles in Alfresco and its importance? Alfresco security model is flexible and allows you to choose either built-in security or external security model defined by your organization via systems such as LDAP and Active Directory.  The following is the list of default roles supported out-of-the-box by Alfresco: Consumer: Read spaces and content Editor: Consumer + edit existing content Contributor: Consumer + add new content Collaborator: Editor + Contributor Coordinator: Full Control Apart from knowing the roles, the most important thing to know is the methods to extend the security model and to provide effective collaborative spaces.  There is a full chapter in the book dedicated to this Security Model. 11.  When can we expect yet another book from Munwar Shariff? This is my second book. My first book is Plonelive, a python-based open source content management system called Plone. When I was writing Plonelive, I never imagined that I am going to write another book.  Book writing is a very involved exercise and requires a lot of discipline. I have a full-time job as a CTO and VP of Business Development at CIGNEX and I have two kids at home with whom I spend lot of time.  I am also contributing to the book's blog site http://alfrescobook.blogspot.com. >Whenever we (as a company) feel there is big need for "documentation" for a specific open source content management system or an open source enterprise portal, we might consider writing a book. I never know when that is going to happen. Thanks Munwar! I would also take this opportunity to congratulate you on the release of Alfresco Enterprise Content Management Implementation.   Share This Article Save to del.icio.us      
Read more
  • 0
  • 0
  • 1594

article-image-alfresco-web-content-management-wcm-20-part-two
Packt
19 Mar 2010
6 min read
Save for later

Alfresco Web Content Management (WCM) 2.0 Part Two

Packt
19 Mar 2010
6 min read
The Web Forms space holds forms that define content templates. For example, we may want press release to be a content type for the web site. A press release may contain a title, an abstract, a location, and several paragraphs in the body. These content elements can be defined in an XML schema file. Alfresco WCM uses the information in the schema file to automatically create a form which can be used for creating XML content for press releases. Once this content is created it can be published to multiple channels –web site, plain text, and wireless devices such as cell phones, for example. The publishing conversion for each channel can be defined using transformations which are specified using XSL, among other options. Content templates can be shared across multiple web sites. The following figure illustrates how a content item for a content type is created and published for multiple channels. Creating Content and Publishing on Multiple Channels for One Content Type Once the space for web site and the web forms (content templates) have been set up, we need to set up users with appropriate content development roles. For example, different users may play roles such as Content Publisher, Content Reviewer, and Content Manager in the content creation process. Further, a Web Developer role may perform the necessary setup needed prior to content creation. Alfresco supports the concepts of change set and sandbox described earlier. Each user gets a separate sandbox, which is an isolated view of the web site. Each user’s sandbox shows only that user’s changes on top of the existing approved content. Similarly, when a user needs to approve a set of changes only those changes need to be visible on top of the approved content. A change set is a set of changes that move together in a workflow. The following screenshot shows user sandboxes and the staging sandbox which contains the currently approved content. The Modified Items link shows the content items the user is currently working on. Staging and User Sandboxes Note how each of the sandboxes allows a separate preview of the website incorporating the changes present in that sandbox. The preview of staging sandbox consists of only the approved content. Alfresco WCM 2.0 includes a virtualization mechanism for supporting in-context web site previews. For example, the following screen shows a preview of the Staging Sandbox web site. Note that there is one approved press release. A Published Press Release in Preview Another, very useful feature of Alfresco WCM 2.0 is snapshots. A snapshot captures the complete state of the web site at a given point in time – it can also be thought of as a version of the web site. Alfresco allows reverting back to an older snapshot with just one click. The figure below shows how easy it is to revert to an older snapshot – version 8 was created by clicking on Revert in the row for version 4.   Reverting to a Prior Web Site Snapshot In version 4, the news story shown earlier had not been approved. Previewing the web site for Staging Sandbox now shows no press release in the screenshot below. Previewing the Staging Sandbox after Reverting to an Old Snapshot Note that security and workflow capabilities are part of the core Alfresco platform and are utilized by WCM 2.0. The features discussed above focus on the core development process where content is created via web forms and goes through the approval process, allowing site preview at every point. However, Alfresco WCM 2.0 architecture is versatile enough to allow content creation through standard interfaces such as WebDAV and CIFS (Common Internet File System). Further, it allows content delivery to multiple sites and supports multiple web application technologies. The following figure illustrates these capabilities of the Alfresco architecture. Source: Alfresco WCM Webinar, March 2007 Note that the terms Dev, Preview and Live in the figure above represent the creation of code, content, and media and their movement through the approval process. The Alfresco server shown in the middle is one production environment. In reality, you would need one or two additional environments for performing configurations and customizations in a separate environment which will not accidentally bring your production system down. For example, you should rehearse the space structure setup, security setup, custom rules and configurations in a development environment. Ideally, you would replicate the setup in a QA environment where the configurations/customizations can be tested before applying to the production environment. The development environment remains the playground for trying out any new configuration or customization. The environment concerns described above are not unique for Alfresco WCM 2.0 – there are fairly similar concerns in other WCM systems. What is really pleasant about Alfresco is that it is lightweight enough to run on a single physical machine for dev and QA purposes. On the other hand, production can be set up in truly sophisticated configurations to handle performance, availability, and disaster recovery requirements. Further, Alfresco’s ability to use various commercial components (database, application servers, etc.) as well as popular robust open-source alternatives liberates customers by giving them back the power and freedom to choose what is best for their technical environment.   Conclusion Web Content Management is one of the most popular applications of Enterprise Content Management. There is a wide range of WCM products available in a spectrum ranging from open-source products to completely proprietary offerings. Alfresco WCM 2.0 is a recent release which makes secure content management in a team environment a breeze. It offers exciting features which enable content managers to review, approve, and roll back business or application-level features. This is a huge improvement over managing content, media, and code at an individual file level. The Alfresco WCM 2.0 architecture takes the pain out of adding content from various sources as well as delivering content to multiple channels. The underlying Alfresco architecture puts the power and freedom of choice back in the customer’s hands by liberating them from vendor lock-in. By building upon robust open-source technologies Alfresco leaves more cash in the customers’ pockets for completing their strategic content management initiatives successfully.   References and Resources   Alfresco 2.0 Web Content Management Product Evaluation Guide Book – Alfresco Enterprise Content Management Implementation Alfresco WCM Webinar, March 2007 Alfresco 2.0.1 and 2.1.0 Update Alfresco.com
Read more
  • 0
  • 0
  • 1720

article-image-using-moodle-integrate-foreign-language-course-secondary-school
Guest Contributor
18 Mar 2010
11 min read
Save for later

Using Moodle to integrate a Foreign Language Course in Secondary School

Guest Contributor
18 Mar 2010
11 min read
This article is written by Mariella Proietta. Introduction: technology and the learning process Researchers and practitioners, both agree on the essential role played by technology in the learning process. Yet the discussion on the changes brought about by the adoption of ICT is still controversial. An emerging topic is the importance of technology in motivating students. Academic motivation is a critical need to address, especially in high school education, since motivational features change and can significantly influence the engagement, learning, achievement, and future aspirations and intentions of students (Deci and Ryan 1985; Hardré and Reeve 2003; Pintrich and Schunk 1996). Motivation is a result of interaction between external and internal factors. It depends on individual differences, influence of outside experiences, and from interactions with teachers and peers in school. Different studies have shown the use of technological tools to increase motivation and Computer Assisted Learning (CAL) has been encouraged and developed in every field. The use of Computer Assisted Language Learning (CALL) has produced a great deal of literature from perspectives such as cognitive psychology, constructivism, psycholinguistics and has undertaken different phases from behaviouristic to integrative or integrated. Bax (2003) talks about approaches from restricted CALL, open CALL to integrated CALL. He describes them concluding that teachers’ aim should be to attain a state of 'normalisation' in which the technology is invisible and truly integrated. The expectation that teachers would adopt ICT and change their practices in particular ways has been recently questioned by research which indicates that teachers have not changed in the ways expected and researchers try to understand why. J. Orlando(2009) explores the existing literature on the matter stating that effective practices include frequency of use for knowledge construction, using ICT to enhance teaching efficiency and to extend and transform learning teachers’ practices. She notes that there is a common assumption that teachers move along and complete a determined path of change caused by the ‘techno-centric’ expectation of immediacy of change in their practices as a result of the use of ICT. She proposes a different design considering research as an evolving process, fashioned over the course of the study. This change may produce new data. But the change with ICT is distinctive and complex mainly because ICT resource innovations are continuously and rapidly changing. A new perspective helps to understand how and why changes in teaching practices mediated by ICT occur and contribute to understand the phenomenon of ICT and the impact it is having on teaching practices. Improvement and integration of the learning process in foreign language teaching Recent studies explore the increasing role of educational activities outside the classroom in the teaching and learning of foreign languages by means of hybrid learning arrangements and the integration of e-learning with classical classroom instruction. Bärenfänger (2005) explores the studies on the subject and introduces the elements of resulting pedagogic arrangements such as online references, asynchronous web-based learning, email, online assessment and testing, mentoring and tutoring. The study includes portals, synchronous web-based learning, electronic performance support systems, simulations, knowledge management, self-paced CD-ROM based content, communities of practice, video broadcasts, virtual labs and chat rooms. The author notes that these new tools satisfy the needs of learners, improve the quality of the learning experience, decrease the time a learner needs to achieve a learning goal, improve quality of the learning content and materials, improve re-usability of the learning content and materials. Among the advantages these tools also reduce cost of program delivery, allow a more effective map learning components to objectives and reduce cost of program development. Other studies have shown that distant or blended courses do not interfere with oral proficiency and interaction. According to Blake and others ‘many teachers still harbour deep-seated doubts as to whether or not a hybrid course, much less a completely distance-learning class, could provide L2 learners with a way to reach linguistic proficiency, especially with respect to oral language skills’ (Blake et al., 2008). In their study, they show that classroom, hybrid, and distance L2 learners reach comparable levels of oral proficiency during their first year of study. The Italian context In most Italian secondary schools the language course takes place mainly in the classroom (often three hours a week) with students having the opportunity to practice the four skills in a more conventional way. Some schools offer additional hours in which students are asked to work in the school multimedia laboratory, and integrate their language abilities with ICT. The majority of Italian secondary school students have, at home, a personal computer and an easy access to the web, but most of their time is spent chatting in their mother tongue and using a social network. When they are asked to visit foreign websites, find information in English or other foreign languages, do online language practice or similar activities, only a few of them are capable to accomplish the task, while the remaining students want to do the activities at school under the supervision of the teacher. The result is that most of the time is spent doing, at schools, activities that could be easily done at home. Moreover, very few students write and speak in English to communicate, apart from the simulations during the lesson, and their listening practice is mainly with songs. The procedure planned here tries to solve these problems and aims to improve and integrate the learning process with online activities. Using the platform Moodle to integrate the textbook Second language teachers can find a help to create engaging online language learning activities using the Moodle platform in different web sites, and a recent book has been written by J. Stanford for teachers, trainers, and course planners, with little or no experience of Moodle, who want to create their own language learning activities (Stanford 2009). It offers plenty of suggestions and examples for adapting classroom activities to the virtual learning environment and the author has also created a demo site http://moodleforlanguages.co.uk). What we are trying here is slightly different: we try to use the platform Moodle to support and integrate conventional class language activities. Creating learning tasks with Moodle The tools provided by Moodle can be used to integrate any level course, provide additional work outside the class and experience cooperative learning. According to Brandl ‘as a courseware package and learning System, Moodle has great potential for supporting conventional classroom instruction, for example, to do additional work outside of class, to become the delivery System for blended (or hybrid) course formats, or even to be used as a standalone e-learning platform’ (Brandl, 2005). Moodle and its platform can thus be used to integrate the school course, inviting the students to join the modules and try the new experience. They can be asked by the teacher to attend the platform and receive credits or marks, which will contribute to the end-of-year evaluation. The result of this kind of experience may contribute to support the use of new technologies in secondary schools, and increase foreign language proficiency. Preparing the platform Teachers or instructors should first prepare the platform and its parts before starting the activities, caring that each language skill could be exploited, and then they could invite their students to join the integration course. As regards language learning, among the different features, the quiz-making function has been analysed and used by many instructors and authors. Robb states that Moodle's functions ‘allow you to make different types of quizzes. Quiz types relevant to language teaching are: Multiple choice, True/False, Numerical, Matching, Description, and Cloze. A wide range of options allows you to randomize the questions and multiple-choice items, specify a time frame for availability, choose whether the students receive feedback or not, decide if they are allowed to view the correct answers, and determine how many times they may take the quiz and how it is to be scored (first attempt, highest attempt, average of all attempts or last attempt)’ (Robb, 2004). Planning the procedure Since the intention is not to substitute the textbooks, CDs or CD ROM, but to integrate them with an e-learning environment, the following steps may be followed, to create the module or sections in the platform and provide the interaction needed: The teacher chooses some Units of the textbook (or textbooks) that can be more easily considered as Learning Objects (modular digital resources that are uniquely identified and can be used and reused to support learning. The main idea of 'learning objects' is that educational content is broken down into small chunks that can be reused in various learning environments). Some of the audio material (tracks) on CDs can be saved as audio files in a directory to be used as a resource. Short video sequences can offer dialogues corresponding to the units chosen. Many sites such as the site of the BBC http://www.bbc.co.uk/worldservice/learningenglish and other sites ( e.g. http://www.lingual.net/lingualproductitems/details.php) provide this sort of video material that can be linked or downloaded from the platform. Additional audio material should be prepared, such as listening exercises, whose solutions and answers could be sent via e-mail to the teacher for correction or recorded by the students and put in an area of the platform where other students could access for listening and discussion in a chat room. A particular section of Moodle offers the opportunity to create quizzes of different kinds. Instructors and teachers who are familiar with ‘Macromedia Flash’ or similar programs can also produce interactive web pages with exercises such as drag and drop or true or false. Otherwise, each section could have some links to web sites with plenty of exercises. The teacher has only to take care that there is a great deal of interaction and feedback. Evaluation may be done through different kinds of tests. At the end of each test a mark or score can be given to each student, and added to the general evaluation in the subject. An additional mark may be given to the frequency with which students attend the platform and the areas in which they can swap information. To illustrate the procedure we have created a module choosing some of the contents of Horizons Options pre­intermediate used in Italian secondary schools mostly in the second or third year. The first approach, after the login and the choice of course, may be with a chart similar to figure 1 that can be put in the main frame: The access to each Section can be done either independently or in sequence in the sense that Section 2 can be opened only after having done the main activities in Section 1. The ‘i’ on the right provides general information about the content of the Section. By clicking on one of the titles of the sections, e.g. Clothes and fashion you can open either a frame or a new window similar to the following (figure 2): The exercises provided are mostly interactive and they can be scored independently. A particular area of the platform may be used as a kind of forum where the students write their doubts and the teacher gives explanation. They can also be encouraged to suggest the solution to the questions asked by others. Another area may be used to chat freely in the foreign language. To avoid the unbalance between oral and written skills, particular care should be taken in using tools that allow the recording of the voice and the oral communication. Students could be asked to telephone and record their call or interview a friend and put the recording on the platform. Conclusion The ideas provided in this article are only the starting point for the acquisition of a deeper competence in the use of Moodle for language learning. The choice of the Italian context is influenced by the ongoing experimentation of Moodle in Italian secondary schools, but many suggestions can come only after having used the package and the Learning System for a long time. We should reach what Bax calls normalisation referring ‘to the stage when the technology becomes invisible, embedded in everyday practice and hence ‘normalised’. To take some commonplace examples, a wristwatch, a pen, shoes, and writing - these are all technologies which have become normalised to the extent that we hardly even recognise them as technologies’ (Bax, 2003). What is important, at the moment, is starting to explore new ways of teaching and keeping alive students' interest and motivation using their means of communication.
Read more
  • 0
  • 0
  • 3903

article-image-shipping-taxes-and-processing-orders-wordpress-29-ecommerce
Packt
18 Mar 2010
4 min read
Save for later

Shipping, Taxes, and Processing Orders with WordPress 2.9 eCommerce

Packt
18 Mar 2010
4 min read
  Locations and tax setup There's no doubt that tax law is complicated, but it's a necessity. It's far beyond the scope to discuss tax law in all countries, so be sure to do your own research regarding taxes for your own state, country, and region. For businesses located in the USA, here are a couple of links to get you started: Amazon Sales Tax Info – http://bit.ly/amazon-sales-tax State Tax Info – http://www.business.gov/finance/taxes/state.html Within the USA, most businesses charge state sales tax based on the shipping information that the customer provides. While nine times out of ten a customer's billing and shipping information are the same, the times when the billing and shipping information differ can lead to some interesting scenarios. For example, if your store is based in Kansas, a customer in Kansas who buys a product and ships it to Texas would not have to pay tax on that order at least not to the state of Kansas. On the other hand, a customer in Georgia who buys your product and ships it to Kansas would have to pay tax on the order. Again, tax law is undoubtedly complicated, so be sure to look up any laws specific to your own state. On to business—the first thing to do is to verify that your Base Country/Region is correct. You can find this under the General tab of the WP e-Commerce Plugin Settings, as seen in the following screenshot: Next, verify that the tax percentages are correct for your state or region. This is just underneath the settings for Base Country/Region. Finally, switch to the Checkout tab at the top to consider one more setting. Just, under Checkout Options there is an option to Lock Tax to Billing Country. This is shown in the following screenshot: What this option does, once selected, is lock the billing country to the shipping country. For stores in the USA, it also has the effect of locking the billing state to the shipping state. This certainly simplifies matters, but it doesn't quite solve the tax scenarios outlined earlier in this section. Shipping Options and Calculators Configuring a store's shipping options is potentially one of the most complicated tasks that new store owners face, but it doesn't have to be. Much of it depends on the type of products that you are planning to sell. The absolute simplest scenario involves selling digital downloads only, in which case you don't need to worry about shipping at all. When dealing with tangible goods, one's shipping needs grow increasingly complicated depending on the diversity of the products involved and anticipated location of the customers. For instance, selling books as well as clothing will create different shipping needs than selling only books or clothing. Also, planning to sell to customers worldwide will necessitate more complicated shipping needs than limiting one's customer base to only one or two countries. Unlike creating and modifying a product catalog, configuring shipping settings is a task that only needs to be done once. General Shipping Settings To view and modify your shipping settings, switch to the Shipping tab at the top of the Settings page, as seen in the following screenshot: Under the General Settings, you have the option to globally enable or disable shipping. If your shop is comprised of digital downloads only, then you can safely switch the Use Shipping option to No and rejoice! You no longer have to worry about any shipping confi guration. The following screenshot shows the relevant panel: Those, who do sell tangible items should leave it set to Yes, as shown above. If your store is located in the USA, add the Zipcode for the area from where you will be shipping items. This is really only necessary if you plan to use one of the external shipping calculators (UPS or USPS), but it doesn't hurt to add it anyway. If you subscribe to the third-party Shipwire order fulfillment service (www.shipwire.com), set the Shipwire option to Yes and enter your relevant login information. Shipwire is a service that collects and stores your products for you, shipping them to customers when necessary. While convenient, Shipwire comes with a cost, currently starting at $30 per month. One neat aspect of the e-Commerce plugin is that you can opt to allow for free shipping, provided that the order price is above a certain threshold. At the bottom of the general shipping options is a toggle to Enable Free Shipping Discount, as seen in the following screenshot: Enter a threshold amount of your choice, such as $50, like seen above. Any orders that customers place with a value equal to or higher than that price will automatically qualify for free shipping.
Read more
  • 0
  • 0
  • 4613
article-image-cms-made-simple-16-orders-and-payments-e-commerce-website
Packt
18 Mar 2010
13 min read
Save for later

CMS Made Simple 1.6: Orders and Payments in an E-commerce Website

Packt
18 Mar 2010
13 min read
Module Cart This  module will add simple cart functionality to the Products module. Once installed, the Cart module will be automatically displayed in the detailed view of the product. The visitor of the website will then be able to put one or more products in the basket along with the desired quantity. There are other modules that you can use instead of the Cart module, like GiftBaskets. For our example Shop, it is enough to use the simple functionality of the Cart module. Install the module Cart from the list of available modules in the Module Manager. The admin area of this module will be added to Extensions | Cart in the admin console of CMS Made Simple. Time for action – connecting products and cart If you now look at your Shop page and open a detailed view of any product, you will discover that there is still no cart functionality in it. The reason for it is that the Products module does not know that the Cart module has been installed and is ready for use. Let's connect two modules. Open the admin area of the Products module (Content | Product Manager). Click on the Preferences tab. Select the Cart module from the field Cart Module. Click on Submit and open detailed view of any product. You should see the but on Add to My Cart in the detailed view of the product. If the product has some attributes additionally to the quantity field, then the attributes are displayed in a drop-down field besides it. What just happened? You have told the Products module what module has to be used for cart functionality. Test it and add some products to the cart right now. The products will be added, but there is no possibility to display the content of the cart for the visitor yet. Create a new content page called Cart and add the following Smarty tag as the content of the page: {Cart action="viewcart"} Save the page, then open the admin area for the Cart module (Extensions | Cart) and switch to the Preferences tab. Select the newly created page in the list of pages, so that the visitor is automatically redirected to the page after he has added the product to it. There are four templates that you can customize for the module: Template   Description   AddToCart This template controls how the quantity field, the button Add To My Cart (see the preceding screenshot) and optionally product attributes with price adjustment look like. MyCart This template is used to display the cart status. It is displayed at the place where the Smarty tag {Cart action="mycart"} is placed. It shows the number of items currently saved in the cart and the link to the cart page. Viewcart This template is used for extended display of all products saved in the cart. It shows all products with their quantities and prices and the total order price. Additionally it offers the possibility to start the checkout order process if the module Orders is installed. Product Summary This template is used to format the output used for each product summary in the Viewcart template. It allows customizing the product label based on the attributes, product name, and price. The Smarty tag {Cart action="mycart"} can be added to the navigation of the website, like the link to the Basket in the official shop (http://www.cafepress.co.uk/cmsmadesimple) we are trying to reproduce. It would appear as shown in the following screenshot: There is nothing else you should know about the Cart module. The next step will be to integrate the checkout process. Module Orders This module is designed for processing orders from the cart. This module handles billing and shipping addresses from the customer and either uses an external payment gateway (such as PayPal) to handle the payment process or performs manual e-mail-based invoicing. This module can also optionally collect credit card information and store it in the database for later offline processing. Even if the module offers the possibility, never collect credit card information in a low security shared hosting environment! The Orders module keeps track of all orders, and allows for the specification of items like tracking numbers and confirmation on numbers and sending e-mails to the customers related to a particular order. The functionality of the module can be extended with even more modules that allow configuring different taxes, shipping costs, and promotion actions (like discount or promotion coupons). This module has a lot of dependencies: CGExtensions FrontEndUsers Products CGSimpleSmarty CMSMailer CGPaymentGatewayBase From this list of dependencies, you can learn that it is based on the functionality of the module FrontEndUsers. This means that your website's customers must register before they can start the payment process on your online store. There is no possibility to turn off this registration process and it is required for the checkout step. Install all modules listed in the preceding dependencies list, then install the Orders module. Time for action – adding the checkout step To enable the checkout process provided by the Orders module follow these steps: Create a new content page (Content | Pages | Add New Content) and name it Checkout. Add the following Smarty tag to the Content field of the Checkout page: {Orders} Save and view the page in the browser. This page will display either the billing form if the user is logged in or the warning message if the user is not logged in or does not belong to special user group. To connect the Cart module with the new Checkout page, in the admin console click on Extensions | Cart. Select the tab Viewcart Form Templates and click on the Sample template (or your own template, if you have created one). At the very end of the template in the Template Text field, add the following line of code: {cms_selflink page="checkout"} The parameter page should contain the page alias of the page where the Smarty tag {Orders} has been added to the content. Open your shop and add one or more products to the cart,find a link to the page Checkout at the very bottom of the screen. What just happened? You have connected the module Cart with the module Orders by placing a link from the cart view to the checkout process. To test the link, add some products to the cart and click the Checkout link at the bot  om of the cart view. If you are not logged in, you will see the following message: The user is not logged in (or not a member of the required group) This message can be found in the template of the Orders module. But first, let's see an overview of the templates delivered with this module. In the admin console, click on Content | Order Manager and find the Templates link above the list of orders: Template name Template description Billing Form This template controls the first step in the order processing. It displays the form where the customer can enter billing address and one or more shipping addresses. Payment Form This template controls the second step in the order processing and is used to display the payment form for manual e-mail based checkout process. You will need this template if you do not use any payment services like PayPal, EMoney, EWay, or Authorize.net. Confirm Order This template controls the third step in the order processing and is used to display any information the customer entered in the first and optionally second step, so that the customer can confirm the shipping and invoice addresses or go back and correct them. Invoice This template is used in the admin area of the module Orders to print out the invoice or to send it via e-mail to the customer. Gateway Complete This template is used to display the status message after the payment has been made with any 3rd party service like PayPal, EMoney, EWay, or Authorize.net. User Email This template is used to customize the e-mail with order confirmation sent to the customer when the new order has been submitted. Admin Email This template controls the layout and content of the e-mail that is sent to the authorized administrator of the store when a new order is submitted. Message There is no sample template for the messages. Here you can define your custom e-mail notifications that can be manually sent to the customers from the admin area of the module. An example for such message can be an e-mail notification that is sent when the order is shipped. Now, we know where to start and how to proceed with customizing of the templates according to our requirements and payment configurations. Let's give the customer the possibility to register with or login to the website to be able to complete the checkout process. Integrating the login screen The message that indicates that the customer is not logged in is saved in the template Billing Form (the first step in the checkout process). The user is not logged in (or not a member of the required group). This is not very user friendly. Whether the user is registered or not we should give him a possibility to log in or to register on this page as shown in the following screenshot: The login form for registered customers can be displayed with the module FrontEndUsers. In the admin area of the Orders module, click on the Templates link and create a new template with the name My Shop on the tab. Scroll down to the very bottom of the suggested template text and the last ELSE condition: ... {else} {* user is not logged in, gotta make him *} <h3 style="color: red;">{$Orders >Lang('error_notloggedin')}</h3><br/> {/if} This is the place where the message that the user is not logged in is shown. Replace this section with the login screen of the module FrontEndUsers, as shown in the following code snippet: ... {else} <h1>Already registered?</h1> {FrontEndUsers} {/if} Save the template and do not forget to set it as Default to see changes on the website. Registered customers can now log into start the checkout process. But, what about customers who do not have an account? They should be able to register themselves with our website. As it gets a bit complicated I have created the following flowchart: The billing form checks if the visitor is logged in or not. If yes, he can fill in the billing information; if not, the login form of the FrontEndUsers module (step 3) is displayed. The steps 4 and 5 in the workflow should assist new customers by allowing them to register. These steps can be accomplished with the SelfRegistration module. Read the next section to see how the module can be configured. Before you continue be sure that: The CMSMailer module is configured and is able to send out messages There is a user property of type Email Address in the module FrontEndUsers (Users & Groups | Frontend User Management, tab User Properties). There is a user group that has the above user properties associated as Required (Users & Groups | Frontend User Management, tab Groups). Integrating customer registration This module is designed to allow visitors of the website to register themselves. It optionally sends a confirmation e-mail with an activation link that must be clicked before the registration is complete. Once the registration is complete, a user account is created in the module FrontEndUsers. Install the SelfRegistration module from the list of available modules in the Module Manager. For the registration page, create a new content page Register and add the following Smarty tag into the content of the page: {SelfRegistration group="Customers"} Pay attention to the part in bold in the above code. The value of the parameter group should exactly reflect the name of user group in the module FrontEndUsers (Users & Groups | Frontend User Management, tab Groups). Open the Register page of your website and sign in yourself as a new customer with the SelfRegistration module to see how the module works by default. There are some preferences in the module that can make the registration process user friendly. In the admin area of the Self Registration module (Users & Groups | Self Registration Module), click on the Preferences tab. The SelfRegistration module offers registration with an e-mail verification step or optionally single-step registration without any confirmation. If you do not need the e-mail verificafion, you should deselect the option Require the user to confirm registraion via email on the Preferences tab of the module. The three settings considering the final message work different depending on what registration method you have chosen. Setting With verification Without verification Don't display the final message after registration Prevents the registration form to be replaced by the confirmation message after the form is submitted. Prevents the registration form to be replaced by the final message after the form is submitted. PageID/Alias to redirect to after registration is complete N/A Redirects to the given page, but replaces the whole content of the page with the final message. PageID/Alias to redirect to after verification step is complete Redirects to the given page, but replaces the whole content of the page with the final message. N/A According to the workflow, let's add a link to the registration page for the new customers (step 4). In the billing template of the Orders module, open the template for the Billing Form again, scroll down and add a link to the registration page for the new customers as shown in the following code snippet: ... {else} <h1>Already registered?</h1> {FrontEndUsers} <h1>New Customer?</h1> {cms_selflink page="register"} {/if} Pay attention to the parameter page. It should contain the alias of the page where the registration form is displayed. Customize the Registration Template 1 of the SelfRegistration module that displays the registration form. Generally, there are two templates. The first one is for the registration form and the second one (Post Registration Template) contains the message informing the customer that his registration should be confirmed through a link sent to his e-mail address. Other templates that you can customize are as shown in the following table: Templates   Description   Registration Template 2 This template contains the form where the username, verification code and password will be added to complete registration. Confirmation Email Contains subject of the verification e-mail, the plain text and the HTML version of the e-mail sent out after the customer has registered. Final Message The message is shown to customer after the registration process is completed. To build the workflow suggested above (step 5) add link to the billing form in this template, so that the user can carry on with the checkout process. It is also advisable to tick the option Login user after registration, so that the login step can be skipped after registration. Lost Email This template contains a form for the customers that have registered but did not get verification e-mail. This template is shown at the place where the Smarty tag {SelfRegistration mode="sendmoremail"} is shown.
Read more
  • 0
  • 0
  • 3952

article-image-ms-access-queries-oracle-sql-developer-12-tool
Packt
17 Mar 2010
12 min read
Save for later

MS Access Queries with Oracle SQL Developer 1.2 Tool

Packt
17 Mar 2010
12 min read
In my previous article with the Oracle SQL Developer 1.1, I discussed the installation and features of this stand-alone GUI product which can be used to query several database products. Connecting to an Oracle Xe 10G was also described. The many things you do in Oracle 10G XE can also be carried out with the Oracle SQL Developer. It is expected to enhance productivity in your Oracle applications. You can use Oracle SQL Developer to connect, run, and debug SQL, SQL*Plus and PL/SQL. It can run on at least three different operating systems. Using this tool you can connect to Oracle, SQL Server, MySql and MS Access databases. In this article, you will learn how to install the Oracle SQL Developer 1.2 and connect to an MS Access database. The 1.2 version has several features that were not present in version 1.1 especially regarding Migration from other products. Downloading and installing the Oracle SQL Developer Go to the Oracle site (you need to be registered to download) and after accepting the license agreement you will be able to download sqldeveloper-1.2.2998.zip, a 77MB download if you do not have JDK1.5 already installed. You may place this in any directory. From the unzipped contents, double-click on the SQLDeveloper.exe. The User Interface On a Windows machine, you may get a security warning which you may safely override and click on Run. This opens up the splash window shown in the next picture followed by the Oracle SQL Developer interface shown in the picture that follows. Figure 1 The main window The main window of this tool is shown in the next picture. Figure 2 It has a main menu at the very top where you can access File, Edit, View, Navigate, Run, Debug, Source, Migration, Tools and Help menus. The menu item Migration has been added in this new version. Immediately below the main menu on the left, you have a tabbed window with two tabs, Connections, and Reports. This will be the item you have to contend with since most things start only after establishing a connection. The connection brings with it the various related objects in the databases. View Menu The next picture shows the drop-down of the View main menu, where you can see other details such as links to the debugger, reports, connections, and snippets. In this new version, many more items have been added such as Captured Objects, Converted Objects, and Find DB Object. Figure 3 Snippets are often-used SQL statements or clauses that you may want to insert. You may also save your snippets by clicking on the bright green plus sign in the window shown, which opens up the superposed Save Snippet window. Figure 4 In the Run menu item, you can run files as well as look at the Execution Profile. Debug Menu The debug menu item has all the necessary hooks to toggle break points: step into, step over, step out and step to End of Method, etc., including garbage collection and clean up as shown in the next picture. Figure 5 Tools Menu Tools give access to External Tools that can be launched, Exports both DDL and data, schema diff, etc. as shown in the next picture. Figure 6 Help gives you both full-text search and indexed search. This is an important area which you must visit; you can also update the help. Figure 7 About Menu The About drop-down menu item in the above figure opens up the following window where you have complete information about this product that includes version information, properties, and extensions. Figure 8 Migration Menu As mentioned earlier the Migration is a new item in the main menu and its drop-down menu elements are shown in the next picture. It even has a menu item to make a quick migration of all recent versions of MS Access (97, 2000, 2002, and 2003). The Repository Management item is another very useful feature. The MySQL and SQL Server Offline Capture menu item can capture database create scripts from several versions of MySQL and MS SQL Server by locating them on the machine. Figure 9 Connecting to a Microsoft Access Database If you are interested in Oracle 10G XE it will be helpful if you refresh your Oracle 10G XE knowledge or read the several Oracle 10G XE articles whose links are shown on the author’s blog. This is a good place for you to look at new developments, scripts, UI description, etc. This section, however, deals with connecting to an MS Access database. Click on the "Connections" icon with the bright green plus sign as shown in the next figure. Figure 10 This opens up the next window, New/Select Database Connection. This is where you must supply all the information. As you can see it has identified a resident (that is a local Oracle 10G XE server) Oracle 10G XE on the machine. Of course, you need to configure it further. In addition to Oracle, it can connect to MySQL, MS Access, and SQL Server as well. This interface has not changed much from version 1.1; you have the same control elements. Figure 11 On the left-hand side of this window, you will generate the Connection Name and Connection Details once you fill in the appropriate information on the right. Connection name is what you supply; to get connected you need to have a username and password as well. If you want, you can save the password to avoid providing it again and again. At the bottom of the screen, you can save the connection, test it and connect to it. There is also access to online help. In the above window, click on the tab, in the middle of the page, Access. The following window opens in which all you need to do is to use the Browse button to locate the Microsoft Access Database on your machine (windows default for mdb files is My Documents). Figure 12 Hitting the Browse button opens the window, Open with the default location, My Documents—the default directory for MDB files. Figure 13 Choosing a database Charts.mdb and clicking the Open button brings the file pointer to the New / Select Database Connection in the box to the left of the Browse button. When you click on the Test button if the connection is OK you should get an appropriate message. However for the Charts.mdb file you get the following error. Figure 14 The software is complaining about the lack of read access to the system tables. Providing read access to System tables. There are a couple of System tables in MS Access which are usually hidden but can be displayed using Tools option in MS Access. Figure 15 In the View tab if you place a check mark for System objects then you will see the following tables. The System tables are as shown in the red rectangle. Figure 16 If you need to modify the security settings for these tables you can do so as shown in the next figure by following the trail, Tools  Security User and Group permissions. Figure 17 Click on the User and Group Permissions menu item which opens the next window Users and Group Permissions shown here, Figure 18 For the user who is Admin, scroll through each of the system tables and place a check mark for Read Design and Read Data check boxes. Click on the OK button and close the application. Now you again use the Browse button to locate the Charts.mdb file after providing a name for the connection at the top of the New / Select Database Connection page. For this tutorial MyCharts was chosen as the name for the connection. Once this file name appears in the box to the left of the Browse button, click on the Test button. This message screen is very fast (appears and disappears). If there is a problem, it will bring up the message as before. Now click on the Connect button at the bottom of the screen in the New / Select Database Connection page window. This immediately adds the connection MyCharts to the Connections folder shown in the left. The + sign can be clicked to expand all the objects in the Charts.mdb database as shown in the next figure. Figure 19 You can further expand the Table nodes to show the data that the table contains as shown in the next figure for the Portfolio table. Figure 20 The Relationships tab in the above figure shows related and referenced objects as shown. This is just a lone table with no relationships established and therefore none showing. Figure 21 It may be noted that the Oracle SQL Developer can only connect to MDB files. It cannot connect to Microsoft Access projects (ADP files), or the new MS Access 2007 file types. Using the SQL Interface SQL Statements are run from the SQL Worksheet which can be displayed by right clicking the connection and choosing Open SQL Worksheet item from the drop-down list as shown. Figure 22 You will type in the SQL queries in area below Enter SQL Statement label in the above figure (now hidden behind the drop-down menu). Making a new connection with more tables and a relationship In order to run a few simple queries on the connected database, three more tables were imported into Charts.mdb after establishing a relationship between the new tables in the access database as shown in the following figure. Figure 23 Another connection named, NewCharts was created in Oracle SQL Developer. The connection string that SQL Developer will take for NewCharts is of the following format (some white spaces were introduced into the connection string shown to get rid of MS Word warnings). @jdbc:odbc: Driver= {Microsoft Access Driver (*.mdb)}; DBQ=C:Documents and SettingsJayMy DocumentsCharts.mdb; DriverID=22;READONLY=false} This string can be reviewed after a connection is established in the New / Select Database Connection window as shown in the next figure. Figure 24 A simple Query Let us look at a very simple query using the PrincetonTemp table. After entering the query you can execute the statement by clicking on the right pointing green arrowhead as shown. The result of running this query will appear directly below the Enter SQL Statement window as shown. Figure 25 Just above the Enter SQL Statement label is the SQL Toolbar displaying several icons (left to right) which are as follows with the associated key board access: Execute SQL Statement(F9) ->Green arrow head Run Script(F5) Commit(F11) Rollback(F12) Cancel(CTRL+Q) SQL History(F8) Execute Explain Plan(F6) Autotrace(F10) Clear(CTRL+D) It also displays time taken to execute ->0.04255061 seconds. The bottom pane is showing the result of the query in a table format. If you would run the same query with the Run Script (F5) button you would see the result in the Script Output tab of the bottom pane. In addition to SQL you can also use the SQL Worksheet to run SQL *PLUS and PL/SQL statements with some exceptions as long as they are supported by the provider used in making the connection. Viewing relationship between tables in the SQL Developer Three tables Orders, Order Details, and Products were imported into the Charts.mdb after enforcing referential integrity relationships in the Access database as seen earlier. Will the new connection NewCharts be able to see these relationships? This question is answered in the following figure.   Click on any one of these tables and you will see the Data as well as Relationships tabs in the bottom pane as shown. Figure 26 Now if you click on the Relationships tab for Products you will see the display just showing three empty columns as seen in an earlier figure. However if you click on the Order Details which really links the three tables you will see the following displayed. Figure 27 Query joining three tables The Orders, Order Details, and Products tables are related by relational integrity as seen above. The following query which chooses one or two columns from each table can be run in a new SQL worksheet. Select Products.ProductName,Orders.ShipName,Orders.OrderDate,[Order Details].Quantityfrom Products, Orders, [Order Details]where Orders.OrderID=[Order Details].OrderIDandProducts.ProductID=[Order Details] and Orders.OrdersDate >'12-31-1997' The result of running this query (only four rows of data shown) can be seen in the next figure. Figure 28 Note that the syntax must match the syntax required by the Provider ODBC, date has to be #12-31-1997# instead of ’12-21-1997’. Summary The article described the new version of the stand alone Oracle’s GUI SQL Developer tool. It can connect to couple of databases such MS Access, SQL Server, Oracle and MySQL. Its utility could have been far greater had it provided connectivity to ODBC and OLE DB. I am disappointed it did not, in this version as well. The connection to MS Access seems to bring in not only tables but the other objects except Data Access Pages, but the external applications that you can use are limited to Word, Notepad, IE etc but not a Report Viewer. These objects and their utility remains to be explored.  Only a limited number of features were explored in this article and it excluded new features like Migration and Translation Scratch Editor which translates MS ACCESS, SQL Server and My SQL syntaxes to PL / SQL. These will be considered in a future article.
Read more
  • 0
  • 0
  • 16249

article-image-google-earth-google-maps-and-your-photos-tutorial-part-ii
Packt
17 Mar 2010
19 min read
Save for later

Google Earth, Google Maps and Your Photos: a Tutorial Part II

Packt
17 Mar 2010
19 min read
Part 2: Google Maps Section 1: Introduction to Part 2 When approaching any sufficiently high-level computing topic, it is often true that we need to be familiar with a broad range of underlying and related concepts to establish the foundation necessary to learn the new material. Virtually every technology not only borrows from, but also builds on others. Furthermore, it is often the case with programming projects that the bulk of the work comes at the beginning and involves carefully thinking through the problem, devising a solution, and building those parts of the project that we need to write before we can get to the code we want to write. In the first part of the tutorial we wrote a Perl script which allows us to generate valid KML files from collections of geotagged photos. Using our new tool, we generated a number of files containing all of the data (about our photos) that we'll use to populate our Google Maps. We also looked at the structure of KML, and covered a number of other important topics, which are key to understanding the material presented here. If you have not read part 1, do take the time at least to glance through it to confirm for yourself that you won't have trouble following along with this discussion. Now we turn our attention to Google Maps. After this short introduction we'll handle the tutorial in 3 parts. Part 1: This section discusses the document-object-model (DOM), which is a formal methodology for negotiating XML files, like the KML files we created in part 1. Part 2: Next we'll look at XHTML and the XHTML file we'll use to display our Google Map. As you'll see, the file included with the project is no more than a shell, but it does suffice to allow us to present our map. Furthermore, it affords us an opportunity to talk about integrating XHTML, Javacript, and the Google Maps API. There are a few important things we'll need to understand. Working with a simple page will help us avoid complicating the issues unnecessarily and will make it easy for you to relocate the map to a page of your own (maybe as part of a weblog for example) with a minimum amount of fuss. Part 3: Finally, we'll look at Javascript and the Google Maps API. Before we get to all of that, there are a couple of preliminary topics to talk about: XML We've already looked at XML, describing it as an open, extensible markup language. We've said that XML is a metalanguage which allows us to define other languages with specific syntactic structures and vocabularies tailored to discrete problem domains. Furthermore we've said that KML is one such XML-based language, engineered to address the problem of describing geographical data and the positioning of geographical placemarks and other features to display on a map, among other applications. XHTML We haven't yet talked about XHTML which is a reimplementation of HTML as a standard, XML-based format. HTML (Hypertext Markup Language) has served as the preeminent language for authoring documents on the World Wide Web since the web's inception in the late 1980s and early 1990s. HTML is the markup language1; which makes hypertext2; linking between documents on the web possible and defines the set of tags, i.e. elements and attributes, that indicate the structure of a document using plain-text codes included alongside the content itself. Just as the web was not the first hypertext system3, HTML was not the first markup language, though both have become extremely important. Without delving too deeply into the primordial history of markup, HTML is a descendant of SGML (Standard Generalized Markup Language) which is itself an offspring of GML (Generalized Markup Language). The Wikipedia entry for GML offers this description of the language: GML frees document creators from specific document formatting concerns such as font specification, line spacing, and page layout required by Script. SCRIPT was an early text formatting language developed by IBM, and a precursor to modern page description languages like Postscript and LaTeX, that describe the structure and appearance of documents. Not surprisingly the goal of GML is echoed in the intent of HTML, though the two are far removed from each other. Berners-Lee; considered HTML to be an application of SGML from the very beginning, but with a clear emphasis on simplicity and winnowing down much of the overhead that had always characterized formal markup languages. In the early days, the web had to struggle for acceptance. The birth of the web is a story of humble beginnings4. The significance of the web was by no means a forgone conclusion and early adoption required that the markup syntax of the web be as accessible as possible. After all, more stodgy languages already existed. The simplicity of HTML certainly contributed to the success of the web (among many other factors), but it also meant that the standard was lacking in key areas. As the web gained wider appeal there was a tendency to take advantage of the early permissiveness of the standard. Developers of mainstream web browsers exacerbated the problem significantly by tolerating noncompliant documents and encouraging the use of proprietary tags in defiance of efforts on the part of standards organizations to reign in the syntax of the language. In the short term, this was a confusing situation for everyone and led to incompatibilities and erratic behavior among an ever increasing multitude of documents on the web and the various web browsers available, which differed in their support for, and interpretation of, what were in essence emerging 'dialects' of HTML. These web browsers differed not only from one another, but also frequently from one version to the next of the same application. There was a real need to establish stability in the language. Lack of dependable syntax meant that the job of building a parser capable of adequately adhering to the standards, and at the same time accommodating various abuses of the standard, had become an exercise in futility. Unlike HTML, XHTML must strictly adhere to the XML standard, which means that any compliant XML parser can negotiate properly formatted documents with relative ease. This reliability paves the way for a more efficient and sophisticated web, resulting in not only more consistent rendering of content, but the development of software that is able to differentiate and act on content based on context, and relationships among data. This is one of the primary advantages of XML, as has already been discussed, and this is a key advantage of XHTML as well. Long term, Berners-Lee, who currently serves as the director of the World Wide Web Consortium (W3C); and a senior researcher at MIT's Computer Science and Artificial Intelligence Laboratory (CSAIL), continues to actively pursue the vision of a Semantic Web. That is, a web that can be mined as a rich repository of data by intelligent software agents, which not only present information, perform basic pattern matching, and the like, but are capable of analysing information (in a truer sense—keep this or get rid of it?). From the W3C's Semantic Web Roadmap we have this brief introduction to the concept: The Web was designed as an information space, with the goal that it should be useful not only for human-human communication, but also that machines would be able to participate and help. One of the major obstacles to this has been the fact that most information on the Web is designed for human consumption, and even if it was derived from a database with well defined meanings (in at least some terms) for its columns, that the structure of the data is not evident to a robot browsing the web. Leaving aside the artificial intelligence problem of training machines to behave like people, the Semantic Web approach instead develops languages for expressing information in a machine processable form. Whether this vision accurately predicts the future of the web remains to be seen. At the moment the Semantic Web is a veritable stew of protocols, frameworks, concepts, extensions, namespaces, vocabularies, schema, ontologies, and other components. It is the subject of much debate, virtually all of it far beyond the scope of this tutorial. But this 'brave new web' is not purely academic. The increased emphasis on standards-compliant markup has resulted in developers of web browsers and content creation tools steering their apps toward the standards. This in turn motivates authors to produce compliant documents. In fact the Strict variations of XHTML do not allow for deviation from the standards. Two immediate benefits of this work, whether or not it ultimately leads to some future web, are (1) more consistent document rendering across platforms among mainstream web browsers, (2) and the emergence of the Document Object Model (DOM). We'll look at the DOM shortly. Section 2: Object Models and the DOM An object model is a collection of objects and the typically hierarchical, often complex, relationships among them, where the most generic definition of an object is simply a 'thing'. Object models are all around us and are not limited to programming or the broader topic of computing for that matter. If, for example, you were to describe a car in terms of its object model: You might start by talking about the chassis, or base frame, and then go on to describe the body of the car, its wheels, axles, exhaust system, the drivetrain, etc.; everything that is directly attached to the frame. For each of these you could describe various attributes and elements of that object; for e.g. the body material is an attribute of the body object. The elements may in fact be other objects that collectively comprise those objects within which they are contained. The body of the car contains the engine compartment, passenger compartment, and trunk elements. The engine compartment includes the engine which is itself a collection of smaller objects. The passenger compartment can be described as the collection of front and rear compartment objects, where the front compartment object includes at least a driver side compartment with a steering wheel, instrument panel, etc. These objects have their own attributes and elements perhaps consisting of other objects each of which is an object itself, with a more specific function than the objects in which they are contained. If you've ever put together a toy model of a car you may remember seeing an exploded schematic diagram of the completed model which clearly shows all of the objects from the largest container elements to the smallest ties, screws and other fasteners that hold all of the pieces together. This is a nice way to visualize the object model of the toy car. Of course the object model I have described is only an informal example. It may be fair to dispute the model I've sketched here. As long as you have a better general understanding of what an object model is then this example has served its purpose. Object models are very common within the realms of computer technology, information technology, programming languages, and formal notation. The Document Object Model The Document Object Model (DOM); is a standard object model for describing, accessing and manipulating HTML documents and XML-based formats. The often quoted description of the DOM from the W3C's site dedicated to the specification is: The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents. The document can be further processed and the results of that processing can be incorporated back into the presented page. Remember that XHTML is a special case of XML (i.e. it is an XML based format) and essentially no more than a formalization of HTML. Because it is an XML based format the XML DOM applies. Furthermore, because XHTML describes a single format with a number of required structural elements and only a limited collection of allowable elements and attributes, the HTML DOM has a number of unique objects and methods for acting on those objects that are not available in the more generic XML DOM. Having said that, I want to emphasize the the two are more alike than the are different. Technically we will look at the XML DOM here but nearly everything discussed is applicable to the HTML DOM as well. Though there are differences, some of which we'll encounter later in this tutorial, as an introduction it is appropriate to limit ourselves to fundamental concepts, which the two share in common. We need both. We'll rely on the XML DOM to parse the KML files we generated in part one of the tutorial to populate our Google Map, and the HTML DOM to add the map to our webpage. By the time we've completed this part of the tutorial hopefully you will appreciate just how integral the DOM is for modern web design and development, though we'll only have skimmed the surface of it. The concept of the DOM is actually quite easily understood. It will seem intuitive to anyone who has ever dealt with tree structures (from filesystem hierarchies to family trees). Even if you haven't had any experience with this sort of data structure, you should anticipate being able to pick it up quickly. Under the Document Object Model individual components of the structure are referred to as nodes. Elements, attributes and the text contained within elements are all nodes. The DOM represents an XML document as an inverted tree with a root node at the top. As far as the structure of an actual XML document is concerned, the root is the element that contains all others. In every structure all other nodes are contained within a document node. In the KML files we've generated the Document element is the root element. Every other node is a descendent of Document. We can express the reciprocal relationship by stating that Document is an ancestor of every element other than itself. Relationships among nodes of the document are described in familial terms. Direct descendants are called child nodes or simply children of the their immediate ancestor, referred to as a parent. In our KML files, is the only child of . (It would be just as correct to say that is the parent node of .) Note that there could be more than one Folder node. We could use additional folders to group Placemarks (a) by year, with one folder per year, (b) by event, with each folder dedicated to a single event, or (3) by image gallery so that each folder corresponds  to a discrete image gallery, or maybe some combination of these and other criteria. Furthermore, we can have more than one type of child node under a single parent. For example Placemark is the parent node of , , and in our files. These nodes can all be described as siblings, because they all have the same parent. Also, notice that is a child of , and a grandchild (not a child) of Placemark. We can make a couple of other useful observations about this structure: Every node other than the root has exactly one parent. Parents may have any number of children including zero, though a node without any children won't be referred to as a parent. (A node with no children is called a leaf.) Implicitly there are other familial relationships among nodes. For example, elements with parents that are siblings could be thought of as 'cousins' I suppose, but it is unusual to see these relationships named or otherwise acknowledged. There is one important subtlety. Text is always stored in a text node and never directly in some other element node. For example, the description elements in our KML files contain either plain text or html descriptions of associated Placemarks. This text is not contained directly in the description node. Instead the description node contains unseen text node which contains the descriptive text. So the text is a grandchild of the description node, and a child of a text node, which is the direct descendent of description. Make sure that you understand this before continuing. Because of the inherent structure of XML, we can unambiguously navigate a document without knowing anything else about it, except that it validates. We can move around the tree without being able to name the nodes before we begin. Starting at the root document node, we can traverse that node's children, move laterally among siblings, travel more deeply from parent to child, and then work our way back up the tree negotiating parent relationships. We haven't yet described how we move among siblings. The DOM allows us to treat siblings as a list of nodes, and take advantage of the relationships that exist among elements in any list. Specifically, we can refer to the first (firstChild) and last (lastChild) nodes to position ourselves in the list. Once we are at some location in the list, we can refer to the previous (previousSibling) and next (nextSibling) nodes to navigate among siblings. Programmatically we can use the DOM to treat siblings in a XML data structure as we would any other list. For example, we can loop through sibling nodes working on each node in turn. Keep in mind that we are using generic terminology, not referring to specific node names and we are relying only on the structure of XML which we know must be dependable if the document adheres to the standard. This will work well for our KML files, and it is certainly not limited to KML. There are primarily two techniques we can use to find and manipulate elements in our XML structure using the DOM. Node PropertiesFirstly, we can take advantage of relationships among element nodes as we have been discussing.A number of node properties, some of which have already been mentioned, allow us to move between nodes in the structure. These include: firstChild,lastChild,previousSibling,nextSibling,parentNode If we look at a fragment of KML, similar to the KML files generated in part 1 of the tutorial, starting at the Placemark element... <Placemark>     <name>value</name>     <Snippet maxLines="1">         value     </Snippet>     <description><![CDATA[         value         ]]></description>     <Point>         <coordinates>value</coordinates>     </Point> </Placemark> ...we see a number of these properties: is the firstChild of is the lastChild of The nextSibling of is The previousSibling of is is the parentNode of , , , and getElementsByTagName()Secondly, we can use the method getElementsByTagName() to find any element regardless of the document structure.For example, using the syntax... getElementsByTagName("name") ...we can retrieve all elements as a nodeList from the document which are descendants of the element we are using when we call the method. The following Javascript statement returns a list of all elements in the document and stores that list at the variable list_of_nodes. var list_of_nodes = getElementsByTagName("name"); What is a node list? A node list (NodeList) is an object representing an ordered list of nodes, where each node represents an element in the XML document. The order of the NodeList is the same as the order of the elements in the document. Elements at the top of the document appear first in the list, and the first element returned, i.e. the first position in the list, is numbered 0. Keep in mind that the list includes all <name> elements. If you look at the KML files we've generated you may notice that both <folder> and <placemark> elements contain <name&gt. We need to be aware that getElementsByTagName("name") will return all of these if we are starting at the document root. We can differentiate between these <name> elements in a number of different ways. For example we can insist that the node is a child of a Placemark node to exclude <name> elements that are the children of <folder> elements. We need to be able to refer to various properties of these nodes if we are going to act on them in any reasonable way. The XML DOM exposes several useful node properties incl: nodeName, nodeValue, and nodeType. nodeName: is (quite obviously) the name of the node. What might be less obvious is precisely how the DOM defines nodeName. The tag name is always the name of an element, e.g. 'Placemark' is the name of the <Placemark> elements The attribute name is the nodeName of an attribute, e.g. the name of the maxLines attribute of <Snippet> is 'maxLines' The name of any text node is always the string '#text'. e.g., the plain text or html that we're using as our Placemark descriptions are each contained in a text node, as has already been discussed, and the name of this text node is '#text', and not the name of the element which surrounds the value in the XML document The nodeName of the root document node is always the literal string '#document'. nodeValue: is what you might expect. The value of text nodes is text itself. So the text node of one of our Placemark elements is all of the plain-text or html within the description tags. Again, as far as the DOM is concerned the text is actually contained within a text node which is a child of a description node The value of an attribute node is simply the attribute value. e.g. maxLines="1" has a nodeValue of 1 nodeValue is not defined for the document node and all element nodes. nodeType: is certainly not something you could guess. A specific value is assigned to each of the available types (categories) of nodes. The following is an incomplete list of common node types. Element, type 1 Attribute, type 2 Text, type 3 Comment, type 8 Document, type 9 As I have already said, we will take advantage of the DOM to parse our KML files and populate our Google Maps. Many of the ideas we've seen here will seem much more concrete when we put them to use. Still, this has been a very brief look at an interesting topic that is especially important to web developers and designers. I would recommend that you pick up a book that does a good job of describing the document object model if you are planning on doing any significant amount of that kind of work. This need not be an intimidating topic, though I have found that the majority of books and articles do an inadequate job with it. If you are only interested in following along with this tutorial then this brief treatment of the DOM, the comments in the included source files, and the javascript code itself should be sufficient for you to complete the project.
Read more
  • 0
  • 0
  • 6270
article-image-python-data-persistence-using-mysql-part-iii-building-python-data-structures-upon-unde
Packt
17 Mar 2010
8 min read
Save for later

Python Data Persistence using MySQL Part III: Building Python Data Structures Upon the Underlying Database Data

Packt
17 Mar 2010
8 min read
Using Python Built-in Object Types to Hold Structured Data The most common way to hold structured data in Python is to use built-in object types such as lists, list comprehensions, tuples, and dictionaries. In particular, you may find the above Python types useful when dealing with database data. Dictionaries can be of particular interest to you when you need to represent data stored in a database table that has a primary key column. Turning back to the posts table created and populated with data as discussed in the first article of this series, you might create the following dictionary to represent the records stored in this table: posts = {} posts["Layouts in Ext JS"] = {"guid":"http://www.packtpub.com/article/layouts-in-ext- js","pubDate":"Fri, 28 Nov 2008 10:31:03 +0000"} posts["WordPress Plug-in Development (Beginner's Guide)"] = {"guid":"http://www.packtpub.com/ wordpress-plug-in-development","pubDate":"Fri, 28 Nov 2008 00:00:00 +0000"} For clarity, you manually set up the dictionary here. In reality, though, you would most likely populate it with the data obtained from the database or the Web. In the above example, the posts dictionary uses the values of the title column in the posts table as the dictionary’s keys. The dictionary’s values are also dictionaries each of which represents the rest of a record, containing the guid and pubDate fields. Since the keys within a dictionary cannot be repeated, the above approach guarantees uniqueness of the title field in the posts’ records represented in the dictionary. Now to obtain a certain record, you can use its key like this: rec = posts["Layouts in Ext JS"] print rec This should produce the following output: {'guid':'http://www.packtpub.com/article/layouts-in- ext-js','pubDate':'Fri, 28 Nov 2008 10:31:03 +0000'} If you need to get to a certain field in the obtained record, you could use the following syntax: guid = posts["Layouts in Ext JS"]["guid"] print guid The above should give you the following: http://www.packtpub.com/article/layouts-in-ext-js To iterate over all of the records in the posts dictionary, you could use a for loop. Here is how you could iterate over the guid field, for example: for post in posts.items(): print post[1]['guid'] Note that the value of the first index of the post variable representing a key/value pair of the dictionary is set to 1, meaning you’re interested in the value part of the pair. The above should generate the following output: http://www.packtpub.com/article/layouts-in-ext-js http://www.packtpub.com/wordpress-plug-in-development If you want to iterate over the dictionary keys, you could use the following code: for post in posts.items(): print post[0] This should give you the following lines: Layouts in Ext JS WordPress Plug-in Development (Beginner's Guide) Now that you have an idea of how database data can be represented in Python, let’s look at an example of how you might persist it to a database. Here is a quick example that illustrates how you might persist the posts dictionary to the posts database table. import MySQLdb db=MySQLdb.connect(host="localhost",user="usrsample",passwd="pswd",db="dbsample") c=db.cursor() for post in posts.items(): c.execute("""INSERT INTO posts (title, guid, pubDate) VALUES (%s,%s,%s)""", (post[0], post[1]['guid'], post[1]['pubDate'])) db.commit() db.close() Assuming you have populated the posts dictionary with data as discussed at the beginning of the article, the above code should insert two records into the posts table. Fetching Database Records You typically persist data to the database in order to retrieve it from there later. How can you retrieve data from the posts table? The following script answers this question: import MySQLdb db=MySQLdb.connect(host="localhost",user="usrsample",passwd="pswd",db="dbsample") c=db.cursor() c.execute("SELECT * FROM posts") c.fetchall() The cursor’s fetchall method in the above code fetches all the rows retrieved by the query, making them available as a list of tuples. To iterate over this list, you could use the following loop: for row in c: print row db.close() This should produce the following output: ('Layouts in Ext JS','http://www.packtpub.com/article/layouts-in- ext-js','Fri, 28 Nov 2008 10:31:03 +0000') ("WordPress Plug-in Development (Beginner's Guide)",'http://www.packtpub.com/wordpress-plug- in-development','Fri, 28 Nov 2008 00:00:00 +0000') As you can see, each line in the above output represents a tuple rather than a dictionary. To have a dictionary instead, you will need to obtain the column names along with the rows being fetched. You can do this with the help of the cursor’s description read-only attribute, as illustrated in the updated script below: import MySQLdb db=MySQLdb.connect(host="localhost",user="usrsample",passwd="pswd",db="dbsample") c=db.cursor() c.execute("SELECT * FROM posts") heads = [d[0] for d in c.description] c.fetchall() for row in c: print dict(zip(heads,row)) db.close() The output should give you a set of dictionaries each of which represents a record in the posts table. But how can you get the data so that it is structured as it were in the posts dictionary discussed at the beginning of the article? To do this, you could revise the above script as follows: import MySQLdb db=MySQLdb.connect(host="localhost",user="usrsample",passwd="pswd",db="dbsample") c=db.cursor() c.execute("SELECT * FROM posts") heads = [d[0] for index, d in enumerate(c.description) if index > 0] c.fetchall() print heads posts={} for row in c: posts[row[0]]= dict(zip(heads,[r for index, r in enumerate(row) if index > 0])) print posts db.close() Notice the use of comprehension lists in the above code. First time, you use it to exclude the first column head from the heads list. Then, you use a similar technique to exclude the first field from each row when iterating fetched rows in the loop. As a result, you should have the same posts dictionary as you saw at the beginning of the article. Customizing Built-in Types to Simulate Trigger Functionality In the world of relational databases, triggers are programs stored inside the database, which run implicitly in response to a certain event. For example, you can define a BEFORE INSERT trigger on a certain table, so that it fires just before a new record is inserted into that table. It is interesting to note that triggers can be used in MySQL starting with version 5.0. If you have an older MySQL version, you won’t be able to take advantage of triggers. In that case, though, you still can simulate trigger functionality on the Python side of your application. So, you want to define triggers on the data structures implemented in Python, much like you would do that in the underlying database. To achieve this, you could for example subclass the Python’s dict built-in type, overriding the __setitem__ method so that it takes the appropriate action implicitly whenever a new item is added. Next, you could use this customized dict’s subclass instead of dict. Consider the following example. Suppose you want to implement the BEFORE INSERT trigger functionality on the posts dictionary, so that it restricts inserting new items to those that represent an article from the Packt Article Network. To achieve this, you will need to override the dict’s __setitem__ method so that it checks to see whether the value of the item’s guid includes the following fragment: http://www.packtpub.com/article/. Below, you create the dict’s subclass called artdict, and then use this subclass to create the posts dictionary, populating it with the same data you used at the beginning of the article: class artdict(dict): def __setitem__(self, key, value): x = 'http://www.packtpub.com/article/' if (x in value['guid']): super(artdict, self).__setitem__(key, value) posts=artdict() posts["Layouts in Ext JS"] = {"guid":"http://www.packtpub.com/article/layouts-in-ext- js","pubDate":"Fri, 28 Nov 2008 10:31:03 +0000"} posts["WordPress Plug-in Development (Beginner's Guide)"] = {"guid":"http://www.packtpub.com/ wordpress-plug-in-development","pubDate":"Fri, 28 Nov 2008 00:00:00 +0000"} print posts Although you have tried to insert two records into the posts dictionary, only the first insertion should have succeeded. So the print should generate the following output: {"Layouts in Ext JS":{"guid":"http://www.packtpub.com/article/layouts-in- ext-js","pubDate":"Fri, 28 Nov 2008 10:31:03 +0000"}} The second item, whose title is WordPress Plug-in Development (Beginner's Guide), was excluded because its guid does not include substring http://www.packtpub.com/article/. This is because this item is not associated with an article but the book. Summary As you learned in this article, Python language provides a wide variety of useful tools to deal with structured data. You can utilize lists, tuples, list comprehensions, and dictionaries when it comes accessing and manipulating data stored in the underlying database. You can even customize the above built-in types to meet the requirements of your application.
Read more
  • 0
  • 0
  • 2082

article-image-building-flex-type-ahead-text-input
Packt
15 Mar 2010
7 min read
Save for later

Building a Flex Type-Ahead Text Input

Packt
15 Mar 2010
7 min read
Here is an example of how google.com implements the type-ahead list using DHTML: As you can see, once 'type-ahead' is typed into the text field , the user is given a selection of possible search phrases that google is already aware of. My intention with this article is to build a type-ahead list in Flex. To start, lets narrow down the scope of the application and make it easy to expand on. We'll create an application which is used primarily for searching for fruits. Our basic Fruit Finder application will consist of a form with a TextInput field. The TextInput field will allow the user to type in a fruit name and will automatically suggest a fruit if one is partially found in our list of fruits. 1. Building a Basic Form To start, here is what our form looks like: The XML which creates this user interface is quite simple: <?xml version="1.0" encoding="utf-8"?><mx:Application layout="absolute"><mx:Panel title="Fruit Finder"><mx:Form> <mx:FormHeading label="Fruit Finder"/> <mx:FormItem label="Fruit Name"> <mx:TextInput id="fruit"/> </mx:FormItem> <mx:FormItem> <mx:Button label="Search"/> </mx:FormItem> </mx:Form></mx:Panel></mx:Application> You'll notice the normal xml version declaration, the Application tag, a Panel tag and finally the Form tag. Nothing too complicated so far. If you are unfamiliar with the basics of Flex or Forms in Flex, you should take this opportunity to visit Adobe's website to explore them. This XML code gives up 90% of our GUI. In the coming steps will have to define the elements which will make up the fruit list which will appear as a user is typing. Next, we need to define our list of fruits. 2. Adding Data to Our Type Ahead List Now that we have the beginnings of our GUI, lets start building our fruit list. Thinking ahead for a bit, I know that we will have to display a list of fruits to the user. The simplest Flex control to use for this job is the List Control. We will be dynamically adding the List to the application's display list via ActionScript, but for now we just need to define the data which will be displayed in the list. We will start by creating adding a Script tag and adding an ArrayCollection to it. You will have to use the import statement to make the ArrayCollection class available to you. Our ArrayCollection constructor is passed an array of fruit names. Here is what the code looks like: <mx:Script><![CDATA[ import mx.collections.ArrayCollection; public var fruitList:ArrayCollection = new ArrayCollection(['apple', 'orange', 'banana', 'kiwi', 'avocado', 'tomato', 'squash', 'cucumber']);]]></mx:Script> Normally defining the list of items in this way is not commonly performed. For a real world use, getting this list of items through an XML source is more likely (especially in web applications), but this will work for our demonstration. Now that our fruit list is defined, we just need to connect it to a type-ahead list which we will create in the next step. links:http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_4.htmlhttp://livedocs.adobe.com/flex/3/langref/mx/collections/ArrayCollection.html 3. Triggering the Appearance of Our Type Ahead-List It is common in modern web applications that the type ahead list appear automatically upon the user typing. We will add this functionality to our application by using the KeyUp event. Simply put, when the user begins typing into our TextInput field we will do the following: Determine if the type ahead list is already created. For the first key press, there will be no type-ahead list.  In this case we need to create the list, set it's data provider to fruitList (step 2) and add it to the UI. We will also need to position the type ahead list beneath the TextInput field so that the user is properly cued as to what is happening. To start our implementation of Type-Ahead Text Input, we use the KeyUp event. We change our FormItem tag surrounding the TextInput field to look like this: <mx:FormItem label="Fruit Name" keyUp="filterFruits(event)">We then define a filterFruits function like so:public function filterFruits(event:KeyboardEvent):void{ // if the type ahead list is not present, create it if(typeAheadList==null){ // create the list and assign the dataprovider typeAheadList = new List(); typeAheadList.dataProvider = fruitList; // add the list to the screen this.addChild(typeAheadList); }} In the above code we are programmatically creating a List control. Immediately assign the data provider to it. Lastly, we add the child to the application. Our function does everything that we need it to do for a Type-Ahead Text Input with the exception of positioning the type ahead list in the correct place. Here is what our app currently looks like: We are making progress, but without the correct positioning, our type-ahead list creates a bad user experience. To move this list to the correct location we need to use the localtoGlobal method to translate coordinate systems. This requires a short explanation. Flex has multiple coordinate systems on the Flash stage that you can make use of for making your controls and components position properly. The first is call the global corrdinate system. This system starts at the upper left hand corner of the Flash stage and extends down and out. The second is called the local coordinate system which starts at the upper left hand corner of a component. There is also a content coordinate system which encompasses a components content. For our purposes we only need to focus on the local and global systems. link:http://livedocs.adobe.com/flex/3/html/help.html?content=containers_intro_5.html Our goal here is to place our list directly beneath the fruit TextInput field. To accomplish this, we must first grabs the coordinates of the fruit TextInput field. Here is the code for retrieving them: var p1:Point = new Point(fruit.x,fruit.y); We use the Point type which receives the x and y coordinates of the fruit control. p1 now holds the points in the local coordinate system. You may ask, "what is it local to?". In this case it is local to it's parent container which is the FormItem. In order to convert these points to the global system we need to use to the localToGlobal method: var p2:Point = fruit_form_item.localToGlobal(p1); p2 now contains the converted coordinates. Note, we added the id of fruit_form_item to the FormItem Tag which is the parent of our fruit TextInput. From here we can now place the fruit List in the correct place in our application. typeAheadList.x=p2.x;typeAheadList.y=p2.y + fruit.height; // set the widthtypeAheadList.width=fruit.width; Notice above that we added fruit.height to the y value of the typeAheadList. This is necessary to not block the view TextInput field. We are moving it down by n pixels, where n is the height of the TextInput field. We also set the x coordinate of our list so that it is in the correct place. Here is what the final result for this step look like:
Read more
  • 0
  • 0
  • 2658
Modal Close icon
Modal Close icon