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

7019 Articles
article-image-debugging-and-validation-wordpress-theme-design
Packt
07 Oct 2009
15 min read
Save for later

Debugging and Validation in WordPress Theme Design

Packt
07 Oct 2009
15 min read
As you work on and develop your own WordPress themes, you will no doubt discover that life will go much smoother if you debug and validate at each step of your theme development process. The full process will pretty much go like this: Add some code, check to see the page looks good in Firefox, validate, then check it in IE and any other browsers you and your site's audience use, validate again if necessary, add the next bit of code... repeat as necessary until your theme is complete. Don't Forget About Those Other Browsers and Platforms I'll mostly be talking about working in Firefox and then 'fixing' for IE. This is perhaps, unfairly, assuming you're working on Windows or a Mac and that the source of all your design woes will (of course) be Microsoft IE's fault. You must check your theme in all browsers and if possible, other platforms, especially the ones you know your audience uses the most. I surf with Opera a lot and find that sometimes JavaScripts can 'hang' or slow that browser down, so I debug and double-check scripts for that browser. I'm a freelance designer and find a lot of people who are also in the design field use a Mac (like me), and visit my sites using Safari, so I occasionally take advantage of this and write CSS that caters to the Safari browser. (Safari will interpret some neat CSS 3 properties that other browsers don't yet.) Generally, if you write valid markup and code that looks good in Firefox, it will look good in all the other browsers (including IE). Markup and code that goes awry in IE is usually easy to fix with a work-around. Firefox is a tool, nothing more! Firefox contains features and plug-ins that we'll be taking advantage of to help us streamline the theme development process and aid in the validation and debugging of our theme. Use it just like you use your HTML/code editor or your image editor. When you're not developing, you can use whatever browser you prefer. Introduction to Debugging Have a look at our initial work-flow chart. I was insistent that your work-flow pretty much be as edit -> check it -> then go back and edit some more. The main purpose of visually checking your theme in Firefox after adding each piece of code is so that you can see if it looks OK, and if not, immediately debug that piece of code. Running a validation check as you work just doubly ensures you're on the right track. So, your work-flow really ends up looking something more like this: You want to work with nice, small pieces or 'chunks' of code. I tend to define a chunk in XHTML markup as no more than one div section, the internal markup, and any WordPress template tags it contains. When working with CSS, I try to only work with one id or class rule at a time. Sometimes, while working with CSS, I'll break this down even further and test after every property I add to a rule, until the rule looks as I intend and validates. As soon as you see something that doesn't look right in your browser, you can check for validation and then fix it. The advantage of this work-flow is you know exactly what needs to be fixed and what XHTML markup or PHP code is to blame. All the code that was looking fine and validating before, you can ignore. The recently added markup and code is also the freshest in your mind, so you're more likely to realize the solution needed to fix the problem. If you add too many chunks of XHTML markup or several CSS rules before checking it in your browser, then discover something has gone awry, you'll have twice as much sleuthing to do in order to discover which (bit or bits) of markup and code are to blame. Again, your fail-safe is your backup. You should be regularly saving backups of your theme at good stable stopping points. If you do discover that you just can't figure out where the issue is, rolling back to your last stable stopping point and starting over might be your best bet to getting back on track. Here, you'll primarily design for Firefox and then apply any required fixes, hacks, and workarounds to IE. You can do that for each piece of code you add to your theme. As you can see in the preceding figure, first check your theme in Firefox and if there's a problem, fix it for Firefox first. Then, check it in IE and make any adjustments for that browser. At this point, you guessed it, more than half of the debugging process will depend directly on your own eyeballs and aesthetics. If it looks the way you intended it to look and works the way you intended it to work, check that the code validates and move on. When one of those three things doesn't happen (it doesn't look right, work right, or validate), you have to stop and figure out why. Troubleshooting Basics Suffice to say, it will usually be obvious when something is wrong with your WordPress theme. The most common reasons for things being 'off' are: Mis-named, mis-targeted, or inappropriately-sized images. Markup text or PHP code that affects or breaks the Document Object Model (DOM) due to being inappropriately placed or having syntax errors in it. WordPress PHP code copied over incorrectly, producing PHP error displays in your template, rather than content. CSS rules that use incorrect syntax or conflict with later CSS rules. The first point is pretty obvious when it happens. You see no images, or worse, you might get those little ugly 'x'd' boxes in IE if they're called directly from the WordPress posts or pages. Fortunately, the solution is also obvious: you have to go in and make sure your images are named correctly if you're overwriting standard icons or images from another theme. You also might need to go through your CSS file and make sure the relative paths to the images are correct. For images that are not appearing correctly because they were mis-sized, you can go back to your image editor, fix them, and then re-export them, or you might be able to make adjustments in your CSS file to display a height and/or width that is more appropriate to the image you designed. Don't forget about casing! If by some chance you happen to be developing your theme with an installation of WordPress on a local Windows machine, do be careful with the upper and lower casing in your links and image paths. Chances are, the WordPress installation that your theme is going to be installed into is more likely to be on a Unix or Linux web server. For some darn reason, Windows (even if you're running Apache, not IIS) will let you reference and call files with only the correct spelling required. Linux, in addition to spelling, requires the upper and lower casing to be correct. You must be careful to duplicate exact casing when naming images that are going to be replaced and/or when referencing your own image names via CSS. Otherwise, it will look fine in your local testing environment, but you'll end up with a pretty ugly theme when you upload it into your client's installation of WordPress for the first time (which is just plain embarrassing). For the latter two points, one of the best ways to debug syntax errors that cause visual 'wonks' is not to have syntax errors in the first place (don't roll your eyes just yet). This is why, in the last figure of our expanded work-flow chart, we advocate you to not only visually check your design as it progresses in Firefox and IE, but also test for validation. Why Validate? Hey, I understand it's easy to add some code, run a visual check in Firefox and IE, see everything looks OK, and then flip right back to your HTML editor to add more code. After-all, time is money and you'll just save that validation part until the very end. Besides, validation is just icing on the cake. Right? The problem with debugging purely based on visual output is, all browsers (some more grievously than others) will try their best to help you out and properly interpret less than ideal markup. One piece of invalid markup might very well look OK initially, until you add more markups and then the browser can't interpret your intentions between the two types of markup anymore. The browser will pick its own best option and display something guaranteed to be ugly. You'll then go back and futz around with the last bit of code you added (because everything was fine until you added that last bit, so that must be the offending code) which may or may not fix the problem. The next bits of code might create other problems and what's worse that you'll recognize a code chunk that you know should be valid! You're then frustrated, scratching your head as to why the last bit of code you added is making your theme 'wonky' when you know, without a doubt, it's perfectly fine code! The worst case scenario I tend to see of this type of visual-only debugging is that the theme developers get desperate and start randomly making all sorts of odd hacks and tweaks to their markup and CSS to get it to look right. Miraculously, they often do get it to look right, but in only one browser. Most likely, they've inadvertently discovered what the first invalid syntax was and unwittingly applied it across all the rest of their markup and CSS. Thus, that one browser started consistently interpreting the bad syntax! The theme designer then becomes convinced that the other browser is awful and designing these non-WYSIWYG, dynamic themes is a pain. Avoid all that frustration! Even if it looks great in both browsers, run the code through the W3C's XHTML and CSS validators. If something turns up invalid, no matter how small or pedantic the validator's suggestion might be (and they do seem pedantic at times), incorporate the suggested fix into your markup now, before you continue working. This will keep any small syntax errors from compounding future bits of markup and code into big visual 'uglies' that are hard to track down and troubleshoot. PHP Template Tags The next issue you'll most commonly run into is mistakes and typos that are created by 'copying and pasting' your WordPress template tags and other PHP code incorrectly. The most common result you'll get from invalid PHP syntax is a 'Fatal Error.' Fortunately, PHP does a decent job of trying to let you know what file name and line of code in the file the offending syntax lives (yet another reason why I highly recommend an HTML editor that lets you view the line number in the Code view). If you get a 'Fatal Error' in your template, your best bet is to open the file name that is listed and go to the line in your editor. Once there, search for missing < ?php ? > tags. Your template tags should also be followed with parenthesis followed by a semicolon like ( ) ; . If the template tag has parameters passed in it, make sure each parameter is surrounded by single quote marks, that is, template_tag_name('parameter name', 'next_parameter');. CSS Quick Fixes Last, your CSS file might get fairly big, fairly quickly. It's easy to forget you already made a rule and/or just accidentally create another rule of the same name. It's all about cascading, so whatever comes last, overwrites what came first. Double rules: It's an easy mistake to make, but validating using W3C's CSS validator will point this out right away. However, this is not the case for double properties within rules! W3C's CSS validator will not point out double properties if both properties use correct syntax. This is one of the reasons why the !important hack returns valid. (We'll discuss this hack just a little further down in this article under To Hack or Not to Hack.) Perhaps you found a site that has a nice CSS style or effect you like, and so you copied those CSS rules into your theme's style.css sheet. Just like with XHTML markup or PHP code, it's easy to introduce errors by miscopying the bits of CSS syntax in. A small syntax error in a property towards the bottom of a rule may seem OK at first, but cause problems with properties added to the rule later. This can also affect the entire rule or even the rule after it. Also, if you're copying CSS, be aware that older sites might be using depreciated CSS properties, which might be technically OK if they're using an older HTML DOCTYPE, but won't be OK for the XHTML DOCTYPE you're using. Again, validating your markup and CSS as you're developing will alert you to syntax errors, depreciated properties, and duplicate rules which could compound and cause issues in your stylesheet down the line. Advanced Troubleshooting Take some time to understand the XHTML hierarchy. You'll start running into validation errors and CSS styling issues if you wrap a 'normal' (also known as a 'block') element inside an 'in-line' only element, such as putting a header tag inside an anchor tag (<a href, <a name, etc.) or wrapping a div tag inside a span tag. Avoid triggering quirks mode in IE! This, if nothing else, is one of the most important reasons for using the W3C HTML validator. There's no real way to tell if IE is running in quirks mode. It doesn't seem to output that information anywhere (that I've found). However, if any part of your page or CSS isn't validating, it's a good way to trigger quirks mode in IE. The first way to avoid quirks mode is to make sure your DOCTTYPE is valid and correct. If IE doesn't recognize the DOCTYPE (or if you have huge conflicts, like an XHTML DOCTYPE, but then you use all-cap, HTML 4.0 tags in your markup), IE will default into quirks mode and from there on out, who knows what you'll get in IE. My theme stopped centering in IE! The most obvious thing that happens when IE goes into quirks mode is that IE will stop centering your layout in the window properly if your CSS is using the margin: 0 auto; technique. If this happens, immediately fix all the validation errors in your page. Another big obvious item to note is if your div layers with borders and padding are sized differently between browsers. If IE is running in quirks mode it will incorrectly render the box model, which is quite noticeable between Firefox and IE if you're using borders and padding in your divs. Another item to keep track of is to make sure you don't have anything that will generate any text or code above your DOCTYPE. Firefox will read your page until it hits a valid DOCTYPE and then proceed from there, but IE will just break and go into quirks mode. Fixing CSS Across Browsers If you've been following our debug -> validate method described in the article, then for all intents and purposes, your layout should look pretty spot-on between both the browsers. Box Model Issues In the event that there is a visual discrepancy between Firefox and IE, in most cases it's a box model issue arising because you're running in quirks mode in IE. Generally, box model hacks apply to pre IE 6 browsers (IE 5.x) and apply to IE6 if it's running in quirks mode. Again, running in quirks mode is to be preferably avoided, thus eliminating most of these issues. If your markup and CSS are validating (which means you shouldn't be triggering quirks mode in IE, but I've had people 'swear' to me their page validated yet quirks mode was being activated), you might rather 'live with it' than try to sleuth what's causing quirks mode to activate. Basically, IE 5.x and IE6 quirks mode don't properly interpret the box model standard and thus, 'squish' your borders and padding inside your box's width, instead of adding to the width as the W3C standard recommends. However, IE does properly add margins! This means that if you've got a div set to 50 pixels wide, with a 5 pixel border, 5 pixels of padding, and 10 pixels of margin in Firefox, your div is actually going to be 60 pixels wide with 10 pixels of margin around it, taking up a total space of 70 pixels.. In IE quirks mode, your box is kept at 50 pixels wide (meaning it's probably taller than your Firefox div because the text inside is having to wrap at 40 pixels), yet it does have 10 pixels of margin around it. You can quickly see how even a one pixel border, some padding, and a margin can start to make a big difference in layout between IE and Firefox!
Read more
  • 0
  • 0
  • 2444

article-image-modifying-system-using-microsoft-dynamics-nav-2009-part-3
Packt
07 Oct 2009
6 min read
Save for later

Modifying the System using Microsoft Dynamics Nav 2009: Part 3

Packt
07 Oct 2009
6 min read
Customizing reports In Microsoft Dynamics NAV, reports are used for printing information from the database, and to execute batch jobs (process information in batches). Our focus will stay with the printing part of this definition. Modifying batch jobs requires a lot of programming knowledge, so our story about them ends here. Even though reports are traditionally seen as objects used to print data, reports in Microsoft Dynamics NAV 2009 provide a more versatile functionality: they can print information, process it, or do both simultaneously; or they can present data on screen, or export it to Excel or PDF. To better understand how to create and modify reports in Microsoft Dynamics NAV 2009, we need to do some theory (with a bit of practice as we go). Reporting in the Classic client Reporting in previous versions of Microsoft Dynamics NAV, as well as in 2009's Classic client uses technology based on C/SIDE objects called Reports. Creating reports Creating simple reports is a fairly simple task—all you need to do is click New in the Object Designer within the Reports view, then the New Report wizard takes over. You need to specify the table over which the report will be based, and then decide whether you are in the mood to draw the layout yourself, or you want to have the wizard do the legwork on your behalf. There are three types of layouts the wizard can create: Form type report: For each record in the table, fields will be arranged vertically one below another, and often arranged in two or three columns. For each field, the caption is printed to the left, and the value to the right. Records are arranged vertically with some white space in between. Tabular type report: The report prints a table, where each row represents a record in the underlying table, and each column represents a field. There is also a header row, which displays column captions. This is the most versatile type of report, because it can be used for documents. Label type report: The report is divided into tiles arranged horizontally, then vertically, and each record occupies a single tile. Only values are printed, and captions are omitted: good for printing mailing labels or item barcode stickers. When you specify which table you want to use as your base and make your pick about the report type, clicking the OK button will launch the wizard for the report of the chosen type. Each of the types has its own wizard with a different set of questions asked and steps to follow. Components of a report A report consists of data set definition, report layout, and options page. Now, being proprietary all the way home, all of the folowing three use specific terminology: Data Items: the data set Sections: the layout Request form: the options Data Items Reports need to be connected to some data, which resides in tables. Data items are tables we decided to use in our reports. Data items are also the first thing we see after the New Report wizard has completed its chore. A typical data item looks like the following: You can add as many data items as you need. To add a data item, position the cursor on the first empty line, and start typing the table name (or number) in the DataItem field. Alternatively, you may position the cursor on an existing data item line, then press F3 (or choose New from the Edit menu). This will insert a new line just before the line you selected. When the report is run, data items are executed in sequence, meaning that all the records from the first data item will be processed (and inserted into the report) before the report moves on to the next data item. In most cases, this is not how you want it to be. Data items come with a concept of indenting. By the clicking left and right arrows you can indent a data item to the left or right. This can help establishing a parent-child (or master-detail) relationship between data items, meaning that for each parent (or master) record all its child (or detail) records will be processed before the report moves on to the next master record. Indenting alone has not yet established the parent-child relationship. It has achieved only one thing: it will make the report execute all child records for each of the parent records. To complete the relationship setup, we need to set some data item properties: The most important property is DataItemLink, and we can type in the link setup manually, or we can invoke the DataItem Link editor by pressing F6 or clicking the Assist button. It will open the DataItem Link editor, which is used to establish the mapping between the fields in the child table (Field column) to the equivalent fields in the parent table (Reference Field column). Other than indenting, data items can accomplish a few other things as well, so you will frequently use these properties as well: Sections Data items simply define where the data comes from and what kind of relationships exist between different tables; sections define how this data is going to be laid out on the report. Section Designer is where you do this, and you can invoke it by clicking Sections in the View menu. You'll immediately see that it's no state-of-the-art editor, but it accomplishes its purpose. The folowing is what a typical Section Designer will look like: When you create your report using the wizard, it will create several sections for you, depending on the report type and choices you made. For every data item that you add manually, one section is inserted. A section is a part of a report with specific behavior. This behavior is embedded in the section type, and to see which section types there are, simply press F3, or select New from the Edit menu: This is what they do: In Section Designer, each section is represented by a gray horizontal bar which goes all the way across the screen, and carries a label, such as Sales Header, Body (1). This label is actually an identifier: Sales Header is the name of the data item, Body is the section type, and the number in parentheses is the ordinal number of the section for that data item. If there are several sections for the same data item, they will all be numbered consecutively starting at 1.
Read more
  • 0
  • 0
  • 2729

article-image-transferring-data-ms-access-2003-sql-server-2008
Packt
07 Oct 2009
3 min read
Save for later

Transferring Data from MS Access 2003 to SQL Server 2008

Packt
07 Oct 2009
3 min read
Launching the Import and Export Wizard Click Start | All Programs| SQL Server 2008 and click on Import and Export Data (32 bit) as shown in the next figure. This brings up the - "Welcome to the SQL Server Import and Export Wizard”. Make sure you read the explanation on this window. Connecting to Source and Destination databases You will connect to the source and destination. In this example the data to be transferred is in a MS Access 2003 database. A table in the Northwind.mdb file available in MS Access will be used for the source. The destination is the 'tempdb' database (or the master database). These are chosen for no particular reason and you can even create a new database on the server at this point. Connecting to the Source Click Next. The default window gets displayed as shown. The data source is SQL Server Native Client 10.0. As we are transferring from MS Access 2003 to SQL Server 2008 we need to use an appropriate data source. Click on the drop-down handle for the data source and choose Microsoft Access as shown in the next figure. The 'SQL Server Import and Export Wizard' changes to the following. Click on the Browse... button to locate the Northwind.mdb file on your machine also as shown. For Username use the default 'Admin'. Click the Advanced button. It opens the Data Link properties window as shown. You can test the connection as well as look at other connection related properties using the Connection and Advanced tabs. Click OK to the Microsoft Data Link message as well as to the Data Link Properties window. Click Next. Choose Destination The Choose a Destination page of the wizard gets displayed. The Destination source (SQL Server Native Client 10.0) and the Server name that automatically shows up are defaults. These may be different in your case. Accept them. The authentication information is also correct (the SQL Server is configured for Windows Authentication). Click on the drop-down handle for the Database presently displaying <default> as shown. Choose tempdb and click on the Next button. Choosing a table or query for the data to be transferred You can transfer data in table or tables; view or views by copying them over, or you may create a query to collect the data you want transferred. In this article both options will described. Copying a table over to destination The Specify Table Copy or Query page of the wizard gets displayed as shown. First we will copy data from a table. Later we will see how to write a query to do data transfer. Click Next. The Select Source Tables and Views page gets displayed as shown. When you place a check mark for say, Customers, the Destination column gets an entry for the selection you made. We assume that just this table is transferred. However you can see that you can transfer all of them in one shot. This window also helps you with two more important things. First you can Preview... the data you are transferring. Secondly, you can edit the mappings, the scheme of how source columns go over to destination.
Read more
  • 0
  • 0
  • 7507

article-image-installing-zenoss
Packt
07 Oct 2009
8 min read
Save for later

Installing Zenoss

Packt
07 Oct 2009
8 min read
Installing Zenoss Our first step is to choose one of the three installation methods: virtual appliance, binary installer, or source. The virtual appliance makes a good choice, if we want to evaluate or demonstrate Zenoss. The virtual appliance runs a functional Zenoss system using VMware Player or VMware Server out-of-the-box and needs no Linux knowledge. When run from VMware, the Zenoss virtual appliance may be used to monitor networks with relatively few devices. The binary installer makes a good choice if we want to avoid building Zenoss from source, and we run a supported distribution. The Supported Operating Systems section in this tutorial includes a list of distributions that have binary installation support. We can build from source on a variety of Unix-based environments, like Ubuntu and Mac OS X. A source installation gives us the ability to install Zenoss in the environment of our choice but requires more work. Of the three installation methods, a source install requires the most familiarity with your operating system and presents more points of failure. As we move beyond installing Zenoss to set up, we focus on firewall policies and Simple Network Management Protocol (SNMP) for Linux and Windows systems. Even though Zenoss can use other methods to monitor devices, SNMP is the default monitoring protocol. We are free to change how we monitor and collect information at any time. During the installation and the set up, we work from the command line because it's fast and it's consistent from one distribution to the next. If an error does occur, we can see the error immediately printed to the terminal window. When working from the command line, we assume knowledge of two basic tasks: opening the terminal window and navigating the file structure. For all other tasks, the book provides the exact command to type. After installation and set up, we spend most of our time working with Zenoss through the web interface. Let's get this installation out of the way so we can discover Zenoss. Server Specifications Actual server specifications may vary depending on the amount and frequency of the data you collect. Zenoss Inc. recommends the following hardware specifications as a starting point based on feedback from the community: Network with up to 250 devices: 4 GB RAM Core 2 Duo E6300 1.86/1066 RTL 75 GB disk storage Network with more than 250 devices : 8 GB RAM XEON 5120 DC 1.86/1066/4MB Four 75 GB drives in two RAID-1 pairs Supported Operating Systems Zenoss requires a Unix-based platform and installs on systems capable of running a GNU build environment. However, Zenoss supports only a few distributions with binary installers. The following table shows the available installation options. Installation Type   Platform   Virtual Appliance   Windows Linux   Binary Installer Red Hat Enterprise Linux 5 Fedora Core 6 SUSE   Source Ubuntu FreeBSD Solaris 10 Mac 0S X Other Linux environments   As more binary installers become available, Zenoss posts them to http://www.zenoss.com/download Zenoss Dependencies Virtual appliance users do not need to install any dependencies because they are included in the image. For all other installations, you need to install the following software packages prior to installing Zenoss: MySQL 5.0.22 or higher MySQL development environment Python 2.3.5 or 2.4 Python development environment If you plan to build a Zenoss installation from source code, you need to install the following: SWIG Autoconf GNU build environment Dependent software packages are available via your distribution's normal software package manager. However, the package names and installation commands vary based on distribution. Consult your distribution's documentation for more information. Quick Start with Virtual Appliance If we know how to download and install software in our host environment, we can get a working Zenoss system with the virtual appliance. The Zenoss virtual appliance packages a working Zenoss Core installation inside a Linux guest that can be booted from a host system, including Windows, using VMware's Player, Server, or Workstation programs. The virtual appliance is great for: Users with little or no Linux knowledge Demonstrations and Evaluations Monitoring small networks with a few devices Install Virtual Appliance We will finish the installation as fast as we can download files and install the VMware Player. Let's begin: Download the VMware Player from http://www.vmware.com/player/.Registration is required to complete the download. Install VMware Player according to VMware's installation instructions for your operating system. Download the Zenoss virtual appliance from http://www.zenoss.com/download/ Unzip the Zenoss virtual appliance download file to a working directory in your system. Open VMware Player: On Windows, select Start > Programs > VMware Player. On Linux, select VMplayer from the application menu, or type the command: vmware VMwarePlayer prompts us to load the virtual machine configuration file we previously unzipped, as shown in the following screenshot: Open the Zenoss virtual appliance we unzipped in step 4.   The Zenoss virtual appliance takes a few minutes to load depending on the performance of your system. When the appliance boots, a welcome window opens and displays the IP address of the Zenoss management console and the standard Linux login prompt, as shown in the following screenshot:                 When we connect to Zenoss through our web browser, we use the IP address of the Zenoss management console that displays on the welcome screen (e.g. http://192.168.1.125.8080/). We cannot access our virtualized Zenoss installation by navigating to localhost, which is the host name of the Zenoss virtual appliance. If the IP address of the Zenoss console does not display, we can obtain the IP address using the ifconfig command, as described in the next section: Working with The Virtual Appliance. Zenoss is ready to monitor. Our next step is to set up the servers on our network to be monitored. If you can't wait to see Zenoss in action, feel free to skip the server setup section for now and check out Tutorial 4 for an introduction to web interface. You can come back and set up your servers later.      If this is the first time you are working with VMware or Linux, take a few minutes to get acquainted with the environment.      Working with The Virtual Appliance The Zenoss virtual appliance is a streamlined but functional Linux system, which means we can log in and have access to the underlying Linux environment. Let's cover a few basic tasks.      In order to type inside the virtual appliance window, use the keyboard shortcut: Ctrl + G      To return the cursor to the host desktop, use the keyboard shortcut: Ctrl + Alt      By default, the root login does not have a password assigned. To log in to the virtual appliance, enter the following user name at the login prompt: root   To set a password for the root user, enter the command:      passwd The passwd command prompts us to enter a new password. Assigning a password to the root user makes the system more secure and allows us to connect to the virtual appliance as root via SSH.      The IP address of the Zenoss virtual appliance is displayed at the top of the terminal window when the appliance loads. The most confusing part about using the Zenoss virtual appliance may be picking the correct IP address and port number. We connect to Zenoss on port 8080. So if our virtual appliance has an IP address of 192.168.1.103, then we use http://192.168.1.103:8080/o open the Zenoss login screen. If we use port 8003, we access the rPath management console, which is the underlying system used to build the Zenoss virtual appliance. After login, we can find additional IP configuration as shown in the following screenshot, with the command: ifconfig     To shut down the virtual appliance, select Player > Exit from the VMware Player. We may also use the the command: shutdown -h now If we shut down the virtual appliance, Zenoss no longer monitors the network and the web interface is not accessible.We may now jump ahead to the Server Setup section of this tutorial for help in configuring the servers we wish to monitor. Binary Installation Zenoss provides a binary installer in RPM format for Red Hat Enterprise Linux, which covers CentOS and Fedora Core. Binaries for additional distributions are added by Zenoss as the market demands and as time allows. To install Zenoss and its dependencies on Red Hat: Download the latest RPM for Red Hat Enterprise Linux from http://www.zenoss.com/download/ Open a terminal window and become the root user: su - If you have not yet installed the Zenoss dependencies, run: yum -y install mysql mysql-server net-snmp net-snmp-utils / python python-dev Install the Zenoss RPM by running the following command from the download directory where x.x-x equals the latest version number: rpm -ivh zenoss-2.x.x-x.el5.i386.rpm Start SNMP: service snmp start Start MySQL: service mysqld start Start Zenoss: /etc/init.d/zenoss start Let's test our installation. Open a browser and enter the URL of the Zenoss server, which listens on port 8080 (for example http://192.168.115:8080/ ). A screen appears as shown in the following screenshot.  
Read more
  • 0
  • 0
  • 9064

article-image-getting-jump-start-ironpython
Packt
07 Oct 2009
9 min read
Save for later

Getting a Jump-Start with IronPython

Packt
07 Oct 2009
9 min read
Where do you get it? Before getting started, you’ll need to download IronPython 2.0.1 (though the contents of this article could just as easily be applied to past or even future versions). The official IronPython site is www.codeplex.com/ironpython. Here you’ll find not only the IronPython bits, but also samples, source code, documentation and many other resources. After clicking on the "Downloads" tab at the top you will be presented with three download options: IronPython.msi, IronPython-2.0.1-Bin.zip (the binaries) or IronPython-2.0.1-Src.zip (the source code). If you already have CPython installed—the standard Python implementation—the binaries are probably your best bet. You simply unzip the files to your preferred installation directory and you’re done. If you don’t have CPython installed, I recommend the IronPython.msi file since it comes prepackaged with portions of the CPython Standard Library. Figure 1. IronPython installation directory. There are a few items I would like to highlight in the IronPython installation directory displayed in Figure 1. The first is the FAQ.html file. This covers all of your basic IronPython questions, from licensing questions to implementation details. Periodically reviewing this while you’re learning IronPython will probably save you a lot of frustration. The second item of importance is the two executables, ipy.exe and ipyw.exe. As you probably guessed, these are what you use to launch IronPython; ipy.exe is used for scripts and console applications while ipyw.exe is reserved for other types of applications (Windows Forms, WPF, etc). Lastly, I’d like to draw your attention to the Tutorial folder. Inside the Tutorial folder, you’ll find a Tutorial.html file in addition to a number of other files. The Tutorial.html file is a comprehensive review of what you need to know to get started with IronPython. If you want to be quickly productive, be sure to at least review the tutorial. It will answer many of your questions. Visual Studio or a Text Editor? One thing that neither the ReadMe nor the Tutorial really covers is the tooling story. While Visual Studio 2008 is a viable Python development tool, you may want to consider other options. Personally, I bounce between VS and SciTE, but I’m always watching for new tools that might improve my development experience.  There are a number of IDEs and debuggers out there and you owe it to yourself to investigate them. Sometimes, however, Visual Studio IS the right tool for the job. If that’s the case then you’ll need to install the Visual Studio SDK from http://www.microsoft.com/downloads/details.aspx?FamilyID=30402623-93ca-479a-867c-04dc45164f5b&displaylang=en. Let’s Write Some Code! To get started, let’s create a simple python script and execute it with ipy. In a new file called "sample.py" (Python files are indicated by a ".py" extension), type "print ‘Hello, world’". Open a command window, navigate to the directory where you saved sample.py and then call ipy.exe passing "sample.py" as an argument. Figure 1 displays what you might expect to see in the console window. Figure 2. Executing a script using the comand line Not that executing from the Command Line isn’t effective, but I prefer a more efficient approach.  Therefore I’m going to use SciTE, an editor I briefly mentioned earlier, to duplicate the example in Figure2. Why SciTE? I get syntax highlighting, I can run my code simply by hitting F5 and the stdout is redirected to SciTE’s output window. In short, I never have to leave my coding environment. If you performed the above "hello, world" example in SciTE, the example would look like Figure 2. Figure 3. Executing a script using SciTE Congratulations! You’ve written your first bit of Python code! The problem is it doesn’t really touch any .NET namespaces. Fortunately, this is not a difficult thing to do. Figure 3 shows all the code you need to start working with the System namespace. Figure 4. You only need a single of code to gain access to the System namespace With that simple import statement, we now enjoy access to the entirety of the System namespace. For example, to access the String class we simply would type System.String. That’s great for getting started but what happens when we want to use something like the Regex class? Do we have to type System.Text.RegularExpressions.Regex? Figure 5. Using .NET regular expressions from IronPython No! The first line of Figure 5 introduces a new form of the import statement that only imports the specific items you want. In our case, we only want the Regex class. The code in line 3 demonstrates creating a new instance of the Regex class. Note the lack of a "new" keyword. Python considers "new" redundant since you have to include parentheses anyways. Another interesting note is the syntax—or is it the lack of syntax—for creating a variable. There’s no declaration statement or type required. We simply create a name that we set equal to a new instance of the Regex class. If you’ve ever written any PHP or classic ASP, this should feel pretty familiar to you.  Finally, the print statement on line 6 produces the output shown in Figure 6. Figure 6. Output from the Regex example The last example was easy because IronPython already holds a reference to System and mscorlib. Let’s push our limits and create a simple Windows form. This requires a bit more work. Figure 7. Using the clr module to add a reference A Quick Review of Python Classes Figure 7 introduces the clr module as a way of adding references to other libraries in the Global Assembly Cache (GAC). Once we have a reference, now we can import the Form, TextBox and Button classes so we can start constructing our GUI. Before we do that though, we have a couple of concepts we need to cover. Figure 8. Introducing classes and methods Up until this point, we really haven’t needed to create any classes or methods. But now that we need to create a form we’re going to need both. Figure 8 demonstrates a very simple class and an equally simple method. I think it’s clear that the "class" keyword defines a class and the "def" keyword defines a method. You probably correctly assumed that "(object)" after "MyClass" is Python’s way of expressing inheritance. The "pass" keyword, however, may not be immediately obvious. In Python, classes and methods cannot be empty. Therefore, if you have a class or method that you aren’t quite ready to code yet, you can use the "pass" statement until you are ready. A more subtle characteristic of Figure 8 is the whitespace. In Python we indent the contents of control structures with four spaces. Tabs will also work, but by convention four spaces are used. In our example above, since "my_method" has no preceding spaces, it’s clear that "my_method" is not part of "MyClass". So how would we make "my_method" a class method? Logically, you would think that simply deleting the "pass" statement under "MyClass" and indenting "my_method" would be enough, but that isn’t the case. There’s one more addition we need to make. Figure 9. Creating a class method As Figure 9 demonstrates, we need to pass "self" as a parameter to "my_method". The first—and sometimes the only—parameter in a class method’s parameter list must always be an instance of the containing class. By convention, this parameter should be named "self", though you could call it anything you’d like. Why the extra step? That’s because Python values the explicit over the implicit. Hiding this detail from the developer is at odds with Python’s philosophy. Creating a Windows Form Now that we have an understanding of classes, methods and whitespace, Figure 10 continues our example from Figure 7 by creating a blank form. Figure 10. Creating a blank form The code in Figure 10 should be fairly understandable. We create the "MyForm" class by inheriting from "System.Windows.Forms.Form". We create a new instance of "MyForm" and pass the resulting object to the "Application.Run()" method. The only thing that may give you pause is the "__init__()" method. The "__init__()" method is what’s called a magic method. Magic methods are designated with double underscores on either end of the method name and are rarely called directly. For instance, when the code in Line 10 of Figure 10 executes, the "__init__()" method defined in "MyForm" is actually being called behind the scenes. Figure 11. Populating the form with controls and handling an event handler Figure 11 adds a lot of code to our application, most of which isn’t very interesting. The exception here is the Click event of the goButton. In C#, the method would get passed as an argument in the constructor of a new EventHandler. In IronPython, we simply add a function with the proper signature to the Click event.  Now that we have a button that will respond to a click, Figure 12 shows a modified version of our regular expression sample code from earlier inserted into the click method. Note the "__str__()" magic method is the equivalent of ToString(). Figure 12. Populating click with our regular expression example When we run the code, you should see the form displayed in Figure 13. You can enter dates into the top textbox, press the button and either True or False will appear in the lower textbox indicating the results of the IsMatch() function. Figure 13. Completed form Conclusion During the course of one brief article, you went from knowing little of IronPython to using it to build Windows Forms. We were able to move so quickly because we leveraged your existing .NET knowledge.  We spent most of our time talking about the very intuitive Python syntax. Go through sample or even production code you've written in the past and duplicate it in IronPython. You’ll find working with familiar .NET libraries will speed your learning process, making it more fun. Before you know it, Python will become second-nature!
Read more
  • 0
  • 0
  • 3795

article-image-common-recovery-tools-active-directory-part-1
Packt
06 Oct 2009
8 min read
Save for later

Common Recovery Tools in Active Directory: Part 1

Packt
06 Oct 2009
8 min read
Software for your DCs and administration Although the software packages installed on the DCs might not be a specific recovery step in the true sense, when you are hard-pressed for time you don't want to start looking for tools and programs; you want to have them installed and ready to work on, anywhere you need. There are many tools. Instead of copying the specific executables to your DCs, it is much easier to install the toolkits as part of the deployment when you install a DC. Windows support tools For both Windows 2000 and Windows 2003, the support tools package is a must-have. This is included on the installation CD under Support/Tools, as shown in the following screenshot, which shows the contents of a 64-bit installation CD. The location of Windows 2003 Small Business Server Support Tools is on CD 2 of the SDS CD set. As you can see, what Microsoft considers the most essential tools, namely DcDiag.exe and Repadmin.exe, are available as standalone executables. Among many medium and large-sized organizations, it is considered a best practice to install the support tools on every DC. This is so because the support tools package provides you with essential tools that you can use for troubleshooting when errors appear in the event log, or the DC starts behaving strangely. Once you have the Support Tools installed, you will have an additional entry in your Start menu for Windows support tools, which contains a link to the Help file and a shortcut to the command prompt. Windows Resource Kit tools The Windows Resource Kit traditionally only came as books in the NT 4.0 era. With Windows 2000, Microsoft started making the tools that are included in the Resource Kit available online for free download. You can still purchase the books as well, which are quite useful because they describe each tool and its application in great detail. However, the tools themselves can easily be downloaded. The links are listed here: For Windows 2000 (Server and Advanced Server): http://support.microsoft.com/kb/927229. For Windows Server 2003 32bit: http://www.microsoft.com/Downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en. For Windows Server 2003 64bit, there is no Resource Kit because Microsoft's website clearly states that the tools are not supported on 64-bit platforms. Given that the tools can be run from any XP client as well, this is not much of an issue unless you want to run a complete 64-bit server environment, and would like to distribute the tools with the DCs. One option is to have a virtual DC that runs Windows Server 2003 in 32-bit mode. As only a handful of tools are necessary for Disaster Recovery, and you can run the tools from a client, it does not matter that much. The main point is that the tools should be available somewhere close to the DCs in every location. So, if you run them from a client, it might be a good idea to copy the tools onto the administration PC. A good option is to keep a CD copy of these tools stored with the Disaster Recovery Guide. Adminpack for Windows XP/Vista Clients The Administrative Tools package (Adminpack) is the least-used administrator tool in most organizations. Although it is considered a best practice to install Adminpack onto the administrative PCs or the PCs of the IT department, this is rarely done. In several cases, a lot of the administrative tasks are performed via Remote Desktop, directly on the DCs. This, of course, means that you have to give all of the people who make even small changes in the AD access to log on to the DCs. This might not be a good idea from a security perspective and can lead to actions that could have been prevented, such as downloading things directly to the DC, and installing or copying/modifying settings on the DC directly. As DCs are the heart that make AD work, these machines should be as secure and isolated as possible. The Adminpack is actually a file called adminpack.msi, which can be found in the i386 folder on the 32-bit installation CD of Windows 2000 and Windows server 2003. It is also in the same directory on the 64-bit installation CD, but there it is called wadminpack.msi. The Adminpack contains the necessary snap-ins for the Microsoft Management Console (MMC), and puts them into your Administrative tools folder. These snap-ins are the normal tools you would have on a DC in order to administer the AD (shown in the following screenshot). It is, however, possible to run them directly from your client instead of on the DC. Using the Adminpack also allows you to re-target the tools to different DCs and you don't have to log on every time. Diagnosing and troubleshooting tools In this section we are going through some of the more advanced uses and possibilities of three tools that will undoubtedly be of great help in diagnosing either AD problems or replication problems. The three tools that almost every person who needs to perform troubleshooting on Windows Server 2003 should be familiar with are NetDiag.exe, DcDiag.exe, and Repadmin.exe. All three are command-line utilities, which implies that they can be run from a Windows XP Professional or Windows Vista workstation, and that they are standalone executables that can be copied from one machine to another. A nice feature of these tools is that they connect remotely to the DCs via the Remote Procedure Call service (RPC) and therefore you do not need to log on to the DCs. The only requirement for most of them is that they need to run from a machine that is a member of the domain and has access to the network. DcDiag DcDiag is the domain controller diagnostic utility. It allows you to diagnose a domain controller, and check if everything is ok. If it is not, then the tests will run until failure, and based on which tests fail, you can go about finding the cause. Even though this may sound rather simple, this utility, even if run without any flags or options, will execute a set of very meaningful tests, and based on pass or fail, you will have a very good idea of where to start looking. The tests performed are listed in the following tables: Primary tests Descriptions Connectivity Tests whether or not the DC is connected to the network Replications Tests to ensure replications can be started, and are run on time NCSecDesc Checks that the security descriptors on the naming context heads have appropriate permissions for replication NetLogons Tests if the DC allows the appropriate logons to initiate replication Advertising Tests if the DC can advertise itself (DNS) KnowsOfRoleHolders Tests if the DC knows which servers hold the FSMO roles RidManager Tests if the DC can contact the RidManager Machine Account Tests if the DC has a valid Machine Account Services Tests if the necessary services are running on the DC ObjectsReplicated Tests whether or not the DSA and Machine Account objects have ever been replicated frssysvol Checks if the sysvol share is listed in the File Replication Service (FRS) frsevent Tests if FRS errors have been generated kccevent Tests if KCC errors have been generated systemlog Tests if there are system errors VerifyReferences Tests if AD FRS records are intact and correct for the replication infrastructure DNS Partition tests Descriptions Forest DNS tests CrossRefValidation Checks if the replication cross-references are intact in the forest DNS zone CheckSDRefDom Checks if the Security descriptors for the forest are intact Domain DNS tests CrossRefValidation Checks if the replication cross-references are intact in the domain DNS zone CheckSDRefDom Checks if the Security descriptors for the domain are intact Schema, Configuration, and Enterprise tests Descriptions Schema tests CrossRefValidation Checks if the replication cross-references are intact in the schema itself CheckSDRefDom Checks if the Security descriptors within the schema are intact Configuration CrossRefValidation Checks if the replication cross-references are intact in the current forest configuration CheckSDRefDom Checks if the Security descriptors within the configuration are intact Partition tests CrossRefValidation Checks if the replication cross-references are intact in the current application partition CheckSDRefDom Checks if the Security descriptors for the application partition are intact Enterprise tests Intersite Checks if the inter-site replication can be initiated FSMOCheck Checks that all FSMO roles are assigned and can be contacted As you can see, DCDiag performs a lot of tests. But bear in mind that most of these are run locally on the DC with the data held by that DC. This means that any error in the DNS, Schema, configuration or partition tests can be working on another DC. It is possible that only this particular replica of the DC is malfunctioning.
Read more
  • 0
  • 0
  • 1655
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-data-access-methods-flex-3
Packt
06 Oct 2009
4 min read
Save for later

Data Access Methods in Flex 3

Packt
06 Oct 2009
4 min read
Flex provides a range of data access components to work with server-side remote data. These components are also commonly called Remote Procedure Call or RPC services. The Remote Procedure Call allows you to execute remote or server-side procedure or method, either locally or remotely in another address space without having to write the details of that method explicitly. (For more information on RPC, visit http://en.wikipedia.org/wiki/Remote_procedure_call.) The Flex data access components are based on Service Oriented Architecture (SOA). The Flex data access components allow you to call the server-side business logic built in Java, PHP, ColdFusion, .NET, or any other server-side technology to send and receive remote data. In this article by Satish Kore, we will learn how to interact with a server environment (specifically built with Java). We will look at the various data access components which includes HTTPService class and WebService class. This article focuses on providing in-depth information on the various data access methods available in Flex. Flex data access components Flex data access components provide call-and-response model to access remote data. There are three methods for accessing remote data in Flex: via the HTTPService class, the WebService class (compliant with Simple Object Access Protocol, or SOAP), or the RemoteObject class. The HTTPService class The HTTPService class is a basic method to send and receive remote data over the HTTP protocol. It allows you to perform traditional HTTP GET and POST requests to a URL. The HTTPService class can be used with any kind of service-side technology such as JSP, PHP, ColdFusion, ASP, and so on. The HTTP service is also known as a REST-style web service. REST stands for Representational State Transfer. It is an approach for getting content from a web server via web pages. Web pages are written in many languages such as JSP, PHP, ColdFusion, ASP, and so on that receive POST or GET requests. Output can be formatted in XML instead of HTML, which can be used in Flex applications for manipulating and displaying content. For example, RSS feeds output standard XML content when accessed using URL. For more information about REST, see www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm. Using the HTTPService tag in MXML The HTTPService class can be used to load both static and dynamic content from remote URLs. For example, you can use HTTPService to load an XML fi le that is located on a server, or you can also use HTTPService in conjunction with server-side technologies that return dynamic results to the Flex application. You can use both the HTTPS and the HTTP protocol to access secure and non-secure remote content. The following is the basic syntax of a HTTPService class: <mx:HTTPService id="instanceName" method="GET|POST|HEAD|OPTIONS|PUT|TRACE|DELETE" resultFormat="object|array|xml|e4x|flashvars|text" url="http://www.mydomain.com/myFile.jsp" fault="faultHandler(event);" result="resultHandler(event)"/> The following are the properties and events: id: Specifies instance identifier name method: Specifies HTTP method; the default value is GET resultFormat: Specifies the format of the result data url: Specifies the complete remote URL which will be called fault: Specifies the event handler method that'll be called when a fault or error occurs while connecting to the URL result: Specifies the event handler method to call when the HttpService call completed successfully and returned results When you call the HTTPService.send() method, Flex will make the HTTP request to the specified URL. The HTTP response will be returned in the result property of the ResultEvent class in the result handler of the HTTPService class. You can also pass an optional parameter to the send() method by passing in an object. Any attributes of the object will be passed in as a URL-encoded query string along with URL request. For example: var param:Object = {title:"Book Title", isbn:"1234567890"}myHS.send(param); In the above code example, we have created an object called param and added two string attributes to it: title and isbn. When you pass the param object to the send() method, these two string attributes will get converted to URL-encoded http parameters and your HTTP request URL will look like this: http://www.domain.com/myjsp.jsp?title=Book Title &isbn=1234567890. This way, you can pass any number of HTTP parameters to the URL and these parameters can be accessed in your server-side code. For example, in a JSP or servlet, you could use request.getParameter("title") to get the HTTP request parameter.
Read more
  • 0
  • 0
  • 3037

article-image-development-iphone-applications
Packt
06 Oct 2009
6 min read
Save for later

Development of iPhone Applications

Packt
06 Oct 2009
6 min read
Introduction to iPhone It has been quite some time since Apple launched iPhone mobile and made a big wave across the world. Initially it got introduced in US market and within a year's time it was available all over the world. Though there are many who use iPhone mobile, I feel it is important to have an introduction to the device in general, its capabilities and what potential it has for programmers to get the full value for the money. If you have not held an iPhone, I suggest you should do that first. This will motivate you to know more about the device like how Apple implemented it. Some may like the curves, many would like the way it functions, but for me, its sleek, big yet compact form, touch technology and the biggest screen are some of the really cool things. Everyone knows about the "touch technology” of the device, especially the multi-touch which takes care of two fingers touching the screen at the same time at different places. But there is more to iPhone than touch. Other important features are: Location finding: using GPS it figures out where it is at that point of time in the world Accelerometer and Orientation: which give it the ability to detect motion in three dimensions Programmable Vibrator, Camera, address book Such features make iPhone more than a just a phone. Technically, the iPhone exists in two largely similar versions: the 2007 original release and the 2008 3G release. It is a 4.7- or 4.8-ounce computing device. Each device contains a 620 MHz ARM CPU that has been under clocked to improve battery performance and reduce heat. Both devices include 128 MB of dynamic RAM (DRAM), and from 4 to 16 GB of Flash memory. The primary difference between the two devices centers on the global positioning system (GPS) and networking. Some technical specifications: iPhone is built on Apple’s OS X, which itself is built on Unix. iPhone has 480 x 320 touch screen Supports a mobile version of Safari browser Supports LAN and WAN networking using Wi-Fi Uses GPS over Wi-Fi Programming Basics In 2008, Apple released the iPhone SDK, a developer toolkit that allows programmers to develop iPhone application. iPhone SDK lets you develop two type of applications—Web development and Native iPhone Application development. Web applications primarily run on a browser using HTML, CSS and some programming language that can generate dynamic content (Java, ASP, .NET, JSP, Ruby….). Native applications run on iPhone like any other application on the device. They use iPhone software development kit (SDK) released by Apple with the inbuilt frameworks and other frameworks that it support. Ignoring for a while that web and native applications have vast difference in the way they are build and they look, the fact is, they both can produce similar result and for some users it may not be easy to differentiate between them. Interesting isn’t it? Later in this article we will discuss about native application development using the tools and programming language iPhone supports. iPhone SDK uses the Objective-C language, which is an extension to the C language. Like any other mobile, iPhone too has a different programming platform; Windows Mobile (VB.NET/C#) and Android (Java) use object-oriented languages and are identical in syntax. However, Objective-C takes a totally different approach. Being different it creates a learning barrier especially for beginners dealing with Mac OS for the first time. Objective-C as implemented by Apple is built entirely around Objects. It is used throughout the iPhone OS’s frameworks. Windows, views, buttons, sliders and controllers exchange information with each other in the form of events and actions in order to make the program run. A header file (.h) and a source code (.m) file together represent each object in Objective-C. iPhone OS frameworks provide many standard classes that come with the framework, but sometimes you may have to write your own subclasses. When you do this, you’ll need a new header and source code class together to represent the new subclass in your project. The iPhone OS is divided in to four layers (Cocoa touch, Media, Core Services, Core OS), as represented in the diagram. Each layer contains variety of frameworks that you can use in your application/program. Initially, you would be dealing with the top layer. Cocoa touch - the base framework, that you will deal most of the time. It contains the UI-Kit framework which includes window support, event support and user-interface management. Media – the framework that provide the protocols to deal with audio and video build in iPhone. Core Services – the frameworks used in all applications, data types. Core Operating System – the kernel level software. Dealing with threading, networking, I/O, memory etc… What you need for iPhone Development To get started with iPhone programming, you would need the following: An Intel Mac running Mac OS X Leopard v10.5.4 or higher The iPhone SDK for iPhone OS, which you can download from http://developer.apple.com/iphone. The iPhone SDK contains all the tools and utilities you need to develop iPhone applications. In particular, it comes with Xcode 3.1(the development IDE) and the iPhone Simulator that allows you to test your application without needing a real device. Though, you can test the applications on the simulator, it is a good idea to register yourself on the iPhone developer program with a nominal fee. This registration gets you a secured certificate issued by Apple and can be used to test developed applications on the device itself. Hence, two more things are essential if the application has to be tested on the device iPhone mobile device iPhone develop program registration If you are serious about taking up iPhone development, I suggest that you to go for the registration process first before anything else. The registration process in itself is free, but to get the certificate you may have to pay a nominal fee ($100 for individuals). All this process could take up quite some time and meanwhile, you can gear up with all the skills and know-how to proceed with the first application. For more information, see "Accessing the iPhone Developer Program Portal.” The best way to learn iPhone programming is to get your hands dirty and start coding. To start coding, you’ll need iPhone SDK and XCode IDE that comes along with the SDK. Assuming, you are already done with the installation, you can find XCode application icon in the /developer/applications folder. Before starting with the application, take a second and think what you would like to name the first application, I will call it "FirstApp". This point is important to keep in mind as the name of the application, subsequent to installation on device, appears on the home screen. The purpose of the application could be anything, but what you want to call it and what you want it to appear as on the home screen starts by naming the application.
Read more
  • 0
  • 0
  • 3076

article-image-advanced-collaboration-using-alfresco-share
Packt
06 Oct 2009
5 min read
Save for later

Advanced Collaboration using Alfresco Share

Packt
06 Oct 2009
5 min read
Today, collaboration and team effort have become critical factors, both inside and outside of the workplace. More and more users want simplicity and familiarity with the tools they use day in and day out. They achieve this by searching in Google, reading in Wikipedia, writing on a blog, finding people on Facebook, being notified in a simple RSS reader, viewing friends, activities on Facebook, and bringing all of this together in iGoogle. Alfresco Share delivers all of this functionality to enterprise users, projects, and teams. Imagine a business user, if given the permission, being able to set up their project web site quickly, being able to invite users to the site, and assign permissions to users within that web site. What previously required a customized solution is now offered out of the box by Alfresco Share. Alfresco Share Alfresco Share (referred to simply as Share from now on) is built on the Alfresco enterprise-class document repository, and delivers out of the box collaborative content management. It simplifies the capture, sharing, and retrieval of information across virtual teams. Team members or project members can rapidly find relevant content or excerpts, look at past or similar projects, and stay on top of any relevant changes, in order to make them more efficient. Share is focused on collaboration tasks and includes integration with popular blogging, Wiki, and forum or discussion products, out of the box. It provides a great interface into more traditional document management libraries (think folders) as well. Keep in mind that all of the web site's contents and documents are still stored in the Alfresco repository. Therefore they are secured, versioned, searchable, and auditable. Share is an independent client application that accesses the repository through web scripts. It is built on the Alfresco Surf (referred to simply as Surf from now on) platform. Alfresco Share is a web application that runs on a machine that is separate from that of the repository. Share provides a paradigm for creating collaborative applications by aggregating Surf components, and incorporating new Surf components as they are developed. With Share, users can modify their workspaces to fit their collaborative requirements inside or outside of the organization. Users can invite their peers to share and collaborate on the project and the content. With the addition of Share, Alfresco delivers a Web 2.0 application that leverages Flash and AJAX with a polished interface, which any business person can enjoy. Features like Document Libraries, Search, Activity Feeds, Virtual Teams, personalized dashboard, N-tier Architecture, and draft CMIS support make it a really competent tool for collaborative content management. Share allows you to: Bulk-upload content, select content from thumbnails, and view it in a Flash viewer. The content is automatically generated in Flash format. This allows users to view content regardless of the original format. Search for people and experts to contribute to their projects as easily as searching for content. Share provides updates on what is new in a project, especially details of content that has been added, edited, or commented upon. Share can track deliverables and import the information into your personal calendar by using iCal. Use an interactive interface to configure a customizable dashboard, and sites, based on what is critical to a specific role or project. Share allows you to create a virtual team for projects and communities. Develop applications in an environment that uses lightweight scripting and reusable components, as well as deliver scalability and allow more users to access existing resources. The URL to access the Alfresco Share application is different from the URL used to access Alfresco Explorer. The Alfresco Share application can be launched in the web browser by visiting the URL, http://<server name> /share/ If you have already installed Alfresco in Windows, then you can invoke the Alfresco Share application by selecting the application, as shown in the following screenshot: You need to provide your authentication credentials, which are similar to those used in the Alfresco Share application. For the administrator, the default username and password are both admin. Once you have been authenticated, the Administrator Dashboard will be displayed, as shown in the following screenshot. At the top of the page you will find the application toolbar. This toolbar contains links to the various Share pages. Your Administrator Dashboard will look similar to the following screenshot: These components are as follows: Getting Started: This dashlet displays the instructions for getting started, and provides you with links to perform common tasks My Profile: This dashlet contains a summary of the personal details provided in your user profile Sites: This component displays the Site Finder page, where you can search for specific sites and manage the membership of Share sites People: This component displays the People Finder page, where you search for specific Share users Help: This component displays the online help available for Alfresco Share Logout: This component logs you out of the Alfresco Share application Search: This component enables you to perform a quick search for content in the current site, or across all of the sites
Read more
  • 0
  • 0
  • 2851

article-image-finding-and-fixing-joomla-15x-customization-problems
Packt
06 Oct 2009
12 min read
Save for later

Finding and Fixing Joomla! 1.5x Customization Problems

Packt
06 Oct 2009
12 min read
Understanding common errors There are five main areas that cause the majority of problems for Joomla! sites. Understanding these areas and the common problems that occur with in each of them is a very important part of fixing them and thus, our site. Even though there is a practically unlimited number of potential issues and problems that can occur, there are certain problems which occur much more regularly than others. If we understand these main problems, we should be able to take care of many of the problems that will occur on our site without needing to resort to hiring people to fix them, or waiting for extension developers to provide support. The five areas are: PHP code JavaScript code CSS/HTML code Web server Database We will now look at the two most common error sources, PHP and JavaScript. PHP code Because PHP code is executed on the server, we usually have some control over the conditions that it is subject to. Most PHP errors originate from one of four sources: Incorrect extension parameters PHP code error PHP version Server settings Incorrect extension parameters It is often easy to misunderstand what the correct value for an extension parameter is, or if a particular parameter is required or not. These misunderstandings are behind a large number of PHP "errors" that developers experience when building a site. Diagnosis In a well-coded extension, putting the wrong information into a parameter shouldn't result in an error, but will usually result in the extension producing strange or unexpected output, or even no output at all. In a poorly coded extension, an incorrect parameter value will probably cause an error. These errors are often easy to spot, especially in modules, because our site will output everything it processed up until the point of the error, giving our page the appearance of being cut off. Some very minor errors may even result in the whole page, except for the error causing extension, being output correctly, and error messages appearing in the page, where the extension with the error was supposed to appear. A critical error, however, may cause the site to crash completely, and output only an error message. In extreme cases not even an error message will be output, and visitors will only see a white screen. The messages should always appear in our PHP log though. Fixing the problem Incorrect extension parameters are the easiest problems to fix, and are often solved simply by going through the parameter screens for the extensions on the page with the errors, and making sure they all have correct values. If they all look correct, then we may want to try changing some parameters to see if that fixes the issue. If this still doesn't work, then we have a genuine error. PHP code error Extension developers aren't perfect, and even the best ones can overlook or miss small issues in the code. This is especially true with large, complex extensions so please remember that even if an extension has PHP code error, it may not necessarily mean that the whole extension is poorly coded. Diagnosis Similar to incorrect extension parameters, a PHP coding error will usually result in a cut-off page, or a white screen, sometimes with an error message displayed, sometimes without. Whether an error message is displayed or not depends partly on the configuration of your server, and partly on how severe the error was. Some servers are configured to suppress error output of certain types of errors. Regardless of the screen output, all PHP errors should be output to the PHP log. So, if we get a white screen, or even get a normal screen but strange output, checking our PHP log can often help us to find the problem. PHP logs can reside in different places on differently configured servers, although it will almost always be in a directory called logs. We may also not have direct access to the log, again depending on our server host. We should ask our web hosting company's support staff for the location of our PHP log, if we can't easily find it. Some common error messages and causes are: Parse error: parse error, unexpected T_STRING in... This is usually caused by a missing semi-colon at the end of a line, or a missing double quote (") or end bracket ()) after we opened one. For quotes and semicolons, the problem is usually the line above the one reported in the error. For missing brackets, the error will sometimes occur at the end of the script, even though the problem code is much earlier in the script. Parse error: syntax error, unexpected $end in... We are most likely missing a closing brace (}) somewhere. Make sure that each open brace ({) we have has been closed with a closing brace (}). Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in... There may be double quotes within double quotes. They either need to be escaped, using a forward slash before the inside quote, or changed to single quotes. Fixing the problem Fixing a PHP code error is possible but can be difficult depending on the extension. Usually when there is a PHP code error, it will give a brief description of the error, and a line number. If nothing is being output at all, then we may need to turn error reporting up as described later. We will then go to the line specified to examine it and the lines around it to try and find our problem. If we can't find an obvious error, then it might be better to take the error back to the developer and ask them for support. PHP version The current version of PHP is 5.x.x and version 6.x is expected soon, but because many older, but still popular, applications only run on PHP version 4.x.x. It is still very common to find many Web hosting companies still using PHP 4 on their servers. This problem is even more unfortunate due to the fact that PHP 4 isn't even supported anymore by the PHP developers. In PHP 5, there are many new functions and features that don't exist in PHP 4. As a result, using these functions in an extension will cause it to error when run on a PHP 4 server. Diagnosis Diagnosing if we have the wrong PHP version is not obvious, as it will usually result in an error about an unknown function when the extension tries to call a function that doesn't exist in the version of PHP installed on our server. Sometimes, the error will not be that the function is unknown, but that the number of parameters we are sending it is incorrect if they were changed between PHP 4 and PHP 5. Fixing the problem The only real way to fix the problem is to upgrade our PHP version. Some web hosts offer PHP 4 or 5 as an option and it might be as simple as checking a box or clicking a button to turn on PHP 5. In case if our host doesn't offer PHP 5 at all, the only solution is to use a different extension or change our web host. This may actually be a good idea anyway, because if our host is still using an unsupported PHP version with no option to upgrade, then what other unsupported, out of date software is running those servers? Server settings One of the most common problems encountered by site owners in regards to server settings is file permissions. Many web hosting companies run Linux, which uses a three-part permission model, on their servers. Using this model, every file can have separate permissions set for: The user who owns the particular file Other users in the same user group as the owner Everyone else (in a web site situation this is mainly the site visitors) Each file also has three permissions that enable, or disable, certain actions on the file. These permissions are read, write, and execute. Permissions are usually expressed in one of two ways, first as single characters in a file listing or as a three digit number. For example, a file listing on a Linux server might look like this: drwxr-x--- 2 auser agroup 4096 Dec 28 04:09 tmp-rwxr-x--- 1 auser agroup 345 Sep 1 04:12 somefile.php-rwxr--r-- 1 auser agroup 345 Sep 1 04:12 foo The very first character to the left, a d or – in this case, indicates if this is a directory (the d) or a file (the -). The next nine characters indicate the permissions and who they apply to. The first three belong to the file owner, next three to those in the same group as the owner, and the final three to everyone else. The letters used are: r—read permission w—write permission x—execute permission A dash (-) indicates that this permission hasn't been given to those particular people. So in our example above, tmp.php can be read, written to, or executed by the owner (a user). It can be read or executed (but not written to) by other users in the same group (agroup) as the owner, but the file cannot be used at all by people outside the group.foo however, can be read by people in the owners group, and also read by everyone else, but it cannot be executed by them. As mentioned above, permissions are also often expressed as a three-digit number. Each of the digits represents the sum of the numbers that represent the permissions granted. For example: r = 4, w = 2, and x = 1. Adding these together gives us a number from 0-7, which can indicate the permission level. So a file with a permission level of 644 would translate as: 6 = 4 + 2 = rw4 = r4 = r or -rw-r--r-- in the first notation that we looked at. Most servers are set by default to one of the following: 644 -rw-r--r--755 -rwxr-xr-x775 -rwxrwxr-x All of this looks fine so far. The problems start to creep in depending on how the server runs their PHP. PHP can either be set up to run as the same user who owns all the files (usually our FTP user or hosting account owner), or it can be set up to run as a different user, but in the same group as the owner. Or it can be set up to be a completely different user and group, as illustrated here: The ideal setup, from a convenience point of view, is the first one where PHP is executed as the same user who owns the files. This setup should have no problems with permissions. But the ideal setup for a very security-conscious web host is the third one since the PHP engine can't be used to hack the web site files, or the server itself. A web server with this setup though used to have a difficult time running a Joomla! site. It was difficult because changing the server preferences requires that files be edited by the PHP user, uploading extensions means that folders and files need to be created by the PHP user, and so on. If the PHP engine isn't even in the same group as the file owner, then it gets treated the same as any site visitor and can usually only read, and probably execute files, but not change them. This prevents us from editing preferences or uploading new extensions. However, if we changed the files so that the PHP engine could edit and execute them (permission 777, for example) then anyone who can see our site on the internet can potentially edit and execute our files by themselves, making our site very vulnerable to being hacked by even a novice hacker. We should never give files or directories a permission of 777 (read, write, and execute to all three user types) because it is almost guaranteed that our site will be hacked eventually as a result. If, for some reason, we need to do it for testing, or because we need to in order to install extensions, then we should change it back as soon as possible. Diagnosis To spot this problem is relatively simple. If we can't edit our web site configuration, or install any extensions at all, then nine times out of ten, server permissions will be the problem. Fixing the problem We can start by asking our web host if they allow PHP to be run as CGI, or install suEXEC (technical terms for running it as the same user who owns the files) and if so, how do we set it up. If they don't allow this, then the next best situation is to enable the Joomla! FTP layer in our configuration. This will force Joomla! to log into our site as the FTP user, which is almost always the same user that uploaded the site files, and edit or install files. We can enable the FTP layer by going to the Site | Global Configuration page and then clicking on the server item in the menu below the heading. We can then enter the required information for the FTP layer on this screen. The FTP layer should only be used on Linux-based servers. More information about the FTP layer can be found in the official Joomla! documentation at http://help.joomla.org/content/view/1941/302/1/2/ If for some reason the FTP layer doesn't work, we only have two other options. We could change our web hosting provider as one option. Or, whenever we want to install a new extension or change our configuration, we need to change the permissions on our folders, perform our tasks, and then change the permissions back to their original settings.
Read more
  • 0
  • 0
  • 5739
article-image-social-media-magento
Packt
06 Oct 2009
4 min read
Save for later

Social Media in Magento

Packt
06 Oct 2009
4 min read
Integrating Twitter with Magento Twitter (http://twitter.com) is a micro-blogging service, which allows its users to send short messages to their followers, answering the question "what are you doing now?" After registering a Twitter account, you can begin to follow other Twitter users. When they update their status, you will see it in your timeline of what people you follow say. When you sign up for a Twitter account, it is usually best to sign up as the name of your store—for example, "Cheesy Cheese Store" rather than "RichardCarter", simply because your customers are more likely to search for the name of the store rather than your own name. Tweeting: Ideas for your store's tweets If you look at other businesses on Twitter, you'll see that there are a number of ways to promote your store on Twitter without losing followers by being too "spammy". Some companies give voucher codes to Twitter followers—a good way to entice new customers Others use Twitter to host competitions for free items—a good way to reward existing customers You can also release products to your Twitter followers before releasing them to other customers Displaying your Twitter updates on your Magento store Twitter can be a powerful tool for your store on its own, but you can integrate Twitter with your Magento store to drive existing customers to your Twitter account, which can help to generate repeat customers. There are a few ways Twitter can be used with Magento, the most versatile of which is the LazzyMonks Twitter module. Installing the LazzyMonks Twitter module To install the LazzyMonks module, visit its page on the Magento Commerce web site (http://www.magentocommerce.com/extension/482/lazzymonks-twitter, and retrieve the extension key, after agreeing to the terms and conditions. Log in to your Magento store's administration panel, and open the Magento Connect Manager in the Magento Connect option under the System tab. Once this has loaded, paste the extension key in to the text box next to the Paste extension key to install label, as shown in the following screenshot: This will install the module for you. Return to your Magento store's administration panel, and you will see a Twitter option in the navigation. The View Tweets option allows you to view updates made to your Twitter account. The Post Update option allows you to update Twitter from your store's administration panel. Firstly, you will need to configure the module's settings, which can be found under the Twitter option of the Configuration section of your store's administration panel, under the System tab. The Twitter Login options are of particular interest. Here you will need to enter your Twitter account's username and password. Once this has been saved, you can post a status update to your Twitter account through Magento's administration panel: This then appears on your Twitter account: Your tweets will also be displayed on your store, as a block beneath other content and can be styled with CSS in your Magento theme by addressing div.twitter. Other ways to integrate Twitter with Magento The other way to integrate your Twitter feed with Magento is by embedding Twitter's widgets into your site. To use these, log in to your Twitter account, and go to http://twitter.com/widgets. You can then use the HTML provided within the Magento templates to insert your Twitter updates into your store. Adding your Twitter feed through Magento's CMS Alternatively, you can insert your Twitter account's updates into any page managed through Magento's Content Management System. In Magento's administration panel, select CMS | Manage Pages, and select the page that you want your Twitter stream to appear in. Within your page, simply paste the code that Twitter produces when you select the type of Twitter "badge", which you want to display on your store. Consider creating a new block for your Twitter statuses, so that it can be removed from pages where it is likely to be distracting (for example, the checkout page).
Read more
  • 0
  • 0
  • 9129

article-image-modifying-system-using-microsoft-dynamics-nav-2009-part-1
Packt
06 Oct 2009
7 min read
Save for later

Modifying the System using Microsoft Dynamics Nav 2009: Part 1

Packt
06 Oct 2009
7 min read
"The best investment is in the tools of one's own trade." Benjamin Franklin Understanding the tools Have you ever held a chainsaw in your hands? Go try it, hear it roar. Quite a beast, eh? Now, what can you do with it? Was felling timber the first image that popped up? We had something else in mind. Have you ever seen any of those ice sculptures? Did you know that sculptors often use chainsaws to carve them out? Carving them slowly over days with fine tools is often not an option—the ice can start melting in a matter of minutes. To be able to finish in time before physics takes over, power tools must be used, and specially equipped chainsaws have been selected as a tool of choice of many ice carvers. Modifying a big system, one like Microsoft Dynamics NAV 2009, requires a lot of skill, knowledge, and experience. While skill and experience can't be learned from a book, knowledge for the better part of it can. There are two kinds of knowledge: the knowledge of the tools, and the knowledge of the product. If you only know the tools, and don't know the object you will work on with these tools, you can easily mess up. If you only know the product, but don't know the tools, you are missing many opportunities. When you know the tools, and what they can do, and how the product will behave when it has been touched, you are on the right path. If you are an application consultant, and you know the product and how it works, but haven't ever dared to open it up in Object Designer and shape it to your liking, this chapter is for you. You already have the knowledge of the product, what it is and how it works; you only need the knowledge of the tools to become a true artist. A chainsaw artist, if you wish. The tools you are about to master are quite powerful: they can craft beautifully architectured state-of-the-art solutions, or they can leave a complete mess. Let's become artists. Modifications for non-programmers In Microsoft Dynamics NAV 2009, it is possible to create a fully functioning modification without really writing a single line of code. As a matter of fact, it happens quite often. Often, customers will demand changes that are simple in nature: adding a field to a report, or rearranging the screen elements. You don't need to be a programmer to be able to accomplish that mission. Microsoft Dynamics NAV comes with a comprehensive set of tools aimed at modifying the solution and every aspect of it, from the data model, via business logic, all the way to the user interface. Many steps along this way can be done without any programming knowledge. Let's take a look at what can be done without writing code: Extending the data model: Application data is stored in tables, which are specifically designed to store exactly that information which is required by the application, no more, no less. When your customer presents you with new requirements, these will often spawn many changes to the underlying data model, to accommodate all those types of information that weren't originally supposed to be stored, because nobody knew they existed. You can do all of these data model modifications using special data design tools, without writing any code. True, some business logic is usually associated with data, so called business rules, but these should be written much later, after the model has been completed. Modifying the user interface: To put a functional user interface together requires a good understanding of the underlying data model, and of various user interface controls that can be put on screen, what they can do, and what they can't. You can compose hundreds of fully functional data-enabled pages or forms, and establish complex navigation rules between them, without ever coming anywhere close to the C/AL code editor. Reporting: Again, to compose reports mainly requires good knowledge of the underlying data, and the knowledge of tools. While some complex reports may require extensive coding, the vast majority of reports will be prepared by simply laying out fields in the report designer. Data import and export: When data needs to go in and out of the system, you can reach for built-in development tools that can create data migration objects in a matter of minutes. One of those times when knowing how to shape the system matters, while coding doesn't at all, is prototyping. Imagine how quickly you could get the requirements straight with a customer if you were able to quickly compose a usable user interface prototype! Object Designer basics All of the development in Microsoft Dynamics NAV is done through the Object Designer feature of the Classic client. To invoke the Object Designer from anywhere within the application, simply press Shift+F12, or go to main menu, click Tools, then Object Designer. It looks like the following screenshot: To the left there is a series of buttons, which you can use to switch between the lists of objects of various types: Type   Description   Tables are used to store information in the system.   Forms are used to provide access to information by displaying it on screen and allowing data entry and modification. Forms can only be used by Classic client.   Reports are primarily used to display information in printable form, but can also be used to execute batch jobs.   Dataports are used to export and import information to and from the system in fixed width or variable length text format.   Dataports on steroids, XMLports are RoleTailored and can get information into or out of the system in XML and text format. XMLports can also be used to automate communication with external application in a way transparent to the users, such as with Business Notifications functionality.   Codeunits contain blocks of application code: the part of the system popularly called business logic.   MenuSuites define what the navigation pane in Classic client and the Departments page in the RoleTailored client look like.   Pages are the forms of the RoleTailored client: they are used to present the information to users and provide means for data entry using RoleTailored or any other service-tier clients (such as SharePoint client).   On the right, there is a table displaying all the objects of the selected type. The following columns are on show: Column Description Type This is actually displayed as an icon, which can represent any of the eight object types described in the previous table. ID An integer number representing the unique identifier of an object. Every object in the system is uniquely distinguished from every other by its type and ID. Name A textual identifier of the object, which has to be unique for each object type. You typically refer to objects by their names when you are declaring C/AL variables. Caption A localized version of the name, aware of the multi-language capabilities of Microsoft Dynamics NAV. Modified Tells if the object was modified. Upon saving, every object will automatically get a checkmark in this field. Version List A textual list of version tags, explaining which product releases, add-ons, or customizations have changed the object. Date Date of the last save operation in Object Designer. Time Time of the last save operation in Object Designer. BLOB Size Size of BLOB representation of the object in the database. The definition, and for all compiled objects an executable version of it, are saved in the database. This makes for a very portable solution, where the database is, so are the application objects. Compiled Flag that tells if the object was compiled, either during the last save operation, or manually by calling the Compile command. Only compiled objects can be executed. On the bottom right, you have a few basic command buttons: New to create a new object of the selected type, Design to open an existing one, Run to execute the selected object, and Help to answer any questions that we might come across in the process of modifying the system.
Read more
  • 0
  • 0
  • 2721

article-image-modifying-system-using-microsoft-dynamics-nav-2009-part-2
Packt
06 Oct 2009
4 min read
Save for later

Modifying the System using Microsoft Dynamics Nav 2009: Part 2

Packt
06 Oct 2009
4 min read
Customizing pages Pages are the RoleTailored client's equivalent of forms, and are the building blocks of the RoleTailored user interface. They are used primarily to display information from the database and to allow data entry, but we can use them simply to put anything we wish on screen for the user to interact with. To create a page, in Object Designer select Pages, then click the New button. The New Page form will assist you through the creation process: Page properties Unlike the New Form dialog, here you can only choose the source table and the type of page; but as soon as you make your choice, a blank Page Designer is shown, with only two properties filled out: SourceTable and PageType. Most page properties are called exactly the same and exhibit the same behavior as form properties, but there are four additional ones: Property Description PageType Specifies the type of the page. Types affect the behavior of pages, and we will discuss page types in more detail later on. InstructionalTextML Declares the multi-language text label that will be displayed on the page before any other user interface element. It only has effect on ConfirmationDialog type forms. CardFormID Defines the card form that is used to display, edit, or create records of the type that is displayed in a list. For example, in Customer List, this property defines that Customer Card is invoked every time a user calls the Edit, View, or New action. This property affects only list type forms. LinksAllowed Specifies whether links functionality will be available for this page or not. Page types The most important of these properties is PageType, because it defines the behavior of the form when displayed in the RoleTailored client. There are exactly ten types of pages: Card, List, RoleCenter, CardPart, ListPart, Document, Worksheet, ListPlus, ConfirmationDialog and NavigatePage. Let's take a closer look at their purpose, functionality, and anatomy. Card Similar to the card form, this type of page displays information about one record of a single table, such as one customer, one vendor, or one item. Typical examples of a card page are 21 Customer Card, or 30 Item Card. The following is what a typical page looks like: At the top of the page there are actions. Actions can be grouped into menus, or into toolbars. The majority of the screen is used for information display and entry. The left part of the screen is occupied with a ContentArea, which consists of groups of fields called FastTabs. Values of fields in FastTabs are typically taken from a single record of a table. The right part of the screen is occupied by the FactBoxArea, which contains several FactBoxes. List Similar to the list form, List pages display multiple records from the same table at once, such as a list of customers, list of vendors, or list of items. Typical examples are 22 Customer List, or 27 Vendor List. This is what a List page looks like: It has exactly the same elements as a card page, except its ContentArea is consumed by a single repeater group, which lists all information in a table. RoleCenter Pages of this type are used as home screens for different roles. They consist of different parts, and are used to provide quick access to the functionality most used by a user role, as well as the most relevant information, all at a glance. Examples of RoleCenter pages are 9005 Sales Manager Role Center and 9010 Production Planner Role Center. The following is what a RoleCenter looks like: It consists of groups displayed as vertical columns. In each group it is possible to have several page parts, such as Activities, My Items, and many more.
Read more
  • 0
  • 0
  • 2085
article-image-common-recovery-tools-active-directory-part-2
Packt
06 Oct 2009
6 min read
Save for later

Common Recovery Tools in Active Directory: Part 2

Packt
06 Oct 2009
6 min read
{literal} Monitoring with Sonar and Ultrasound Monitoring your AD is something that needs to be done regularly, and there are many commercial utilities out there that will help you achieve this. However, it might be worth investigating tools that are available for free from Microsoft, and even from some other vendors. Introducing Sonar Sonar and Ultrasound are two utilities that allow you to monitor the File Replication Service (FRS), and both utilities are good at detecting problems beforehand, or issues with replication from certain DCs. Sonar can be downloaded from the Microsoft Download Center at http://www.microsoft.com/downloads. You will need to have the .Net Framework 1.1 installed on the machine where Sonar will run. Also, please be aware that if you have .Net Framework 2.0 installed, it does not include 1.1, and you need to install 1.1 as well. Once installed, Sonar will not create a program menu entry, so you will need to search for it. For some reason, it will install itself into the Resource Kit folder (C:Program FilesResource Kit) and it is called Sonar.exe. Once you run it, you will be presented with the following dialog box: At this point, you can see two buttons, which can be used either for default querying (that is, all of the DCs within your domain) or for loading the settings with the Load Query button, if you have a specific query or setup saved. In our example, we will view the results and you will see the screen that you have seen in the previous figure. Also note the drop-down for Replica Set. This allows you to monitor DFS replications within your domain. So this tool is not just used to monitor the SYSVOL replications. From the top part, you can easily select a very wide range of Filters via a drop-down list, and the Columns can be used to select the columns to be displayed. This relates to a group of columns, so there are more columns than just the ones selected from the drop-down. To illustrate the extent of information that you can get with this little utility, the following screenshot shows both of the menus expanded. As you can see, you can use this tool to find out any information regarding the replication. Once you select the filters and columns that you want, you can click Refresh All and it will fetch that information from all DCs within your domain. You can see the disk usage of the AD database on all different DCs including any DC that has low disk space, is too slow, is backlogged with AD replications, and so on. This small utility, when used periodically, will help you to keep your AD in good healthy, shape and might help you find trouble-spots such as low bandwidth or wrongly configured replication schedules. Introducing Ultrasound Although Sonar is a good utility that is small and does its job very well, some organizations either have many FRS points that they want to monitor, or want much more information. This is where Ultrasound comes in. This utility is also a free download from Microsoft. However, it has much steeper requirements. Namely, it requires an SQL server as a backend. Even the SQL Server 2000 Desktop engine, or the free SQL Server 2005 Express Edition, downloadable from the Microsoft Download Center, will serve this purpose, but they would require a two-step setup and more resources. It also does collections periodically via agents that are deployed using WMI from within the Ultrasound interface. Although the free Desktop Engine has limitations, such as allowing only few connections, it does provide enough database functionality for Ultrasound. SQL Server 2005 Express edition will work perfectly fine with no problems. If Sonar can be compared to a sonar on a boat, which gives you a lot of information about what's ahead and what's going on around you, then Ultrasound has all of the features of Sonar, plus an additional feature for radar and satellite surveillance. Getting familiar with Ultrasound may take some time. As Ultrasound is a Microsoft utility, it can be downloaded from the Microsoft Download Center. Once you install the SQL server, or prepare a database on an existing server, you can proceed to installing Ultrasound. You will be asked which server to use and you can just enter the name of the PC where your SQL server is running. After deploying the database structure, which can take a few minutes, the installation will finish, and you will have a new program menu entry, called FRS Monitoring, where Ultrasound is located. Once you launch Ultrasound for the first time, you will be asked to add an FRS replica to Ultrasound. At this point, you should click Yes and you will be prompted for your domain name and the available FRS replicas. In our case, this is similar to the example shown in the following screenshot. By simply clicking the replica set, and then clicking on Add, you can add it to the list of FRS replicas to the list of FRS replicas to be monitored. Next, you click OK, and Ultrasound will collect the Schema data from the selected replica set, and then ask you to add all Servers found, add only the highly connected, hub, servers or add none, and you will select your own. There is also an option to install the WMI collectors, which you want to do (shown in the following screenshot). Once you have selected your approach, a whole world of information will open up. The tool may appear confusing simply because of the volume of information you can gather with it, but the learning curve quickly flattens, and the data that it provides becomes invaluable. After the initial WMI collector deployment is done, you can close the screen. Henceforth you will find that the screen shown in the following screenshot is always displayed when you start Ultrasound: At first, you are given a health rating, which is generally accurate as only critical errors, or errors that could cause problems, change this rating. You can expand the replica set and see each server's health rating as well. This allows you to quickly identify any critical issues with the DCs. Details On the second tab, Details, you will find information about the replications of the servers you have selected. We selected only DC1, DC2, and DC30, and details of the ongoing replications and which DCs have the most inbound and outbound connections are displayed, as shown in the following screenshot. On the top, you can also change the details to be displayed, for example the files contained within this Replica Set that are replicated. Right-clicking on a server opens up a context menu that either allows you to collect data from a specific server, or opens up the replica set and displays the details of the replica set for the server, depending on the context. Right-clicking on the inbound or outbound connection windows will allow you to collect data, or see details regarding a specific inbound, outbound, or replica member.
Read more
  • 0
  • 0
  • 2351

article-image-create-local-ubuntu-repository-using-apt-mirror-and-apt-cacher
Packt
05 Oct 2009
7 min read
Save for later

Create a Local Ubuntu Repository using Apt-Mirror and Apt-Cacher

Packt
05 Oct 2009
7 min read
How can a company or organization minimize bandwidth costs when maintaining multiple Ubuntu installations? With bandwidth becoming the currency of the new millennium, being responsible with the bandwidth you have can be a real concern. In this article by Christer Edwards, we will learn how to create, maintain and make available a local Ubuntu repository mirror, allowing you to save bandwidth and improve network efficiency with each machine you add to your network. (For more resources on Ubuntu, see here.) Background Before I begin, let me give you some background into what prompted me to initially come up with these solutions. I used to volunteer at local university user groups whenever they held "installfests". I always enjoyed offering my support and expertise with new Linux users. I have to say, the distribution that we helped deploy the most was Ubuntu. The fact that Ubuntu's parent company, Canonical, provided us with pressed CDs didn't hurt! Despite having more CDs than we could handle we still regularly ran into the same problem. Bandwidth. Fetching updates and security errata was always our bottleneck, consistently slowing down our deployments. Imagine you are in a conference room with dozens of other Linux users, each of them trying to use the internet to fetch updates. Imagine how slow and bogged down that internet connection would be. If you've ever been to a large tech conference you've probably experienced this first hand! After a few of these "installfests" I started looking for a solution to our bandwidth issue. I knew that all of these machines were downloading the same updates and security errata, therefore duplicating work that another user had already done. It just seemed so inefficient. There had to be a better way. Eventually I came across two solutions, which I will outline below. Apt-Mirror The first method makes use of a tool called “apt-mirror”. It is a perl-based utility for downloading and mirroring the entire contents of a public repository. This may likely include packages that you don't use and will not use, but anything stored in a public repository will also be stored in your mirror. To configure apt-mirror you will need the following: apt-mirror package (sudo aptitude install apt-mirror) apache2 package (sudo aptitude install apache2) roughly 15G of storage per release, per architecture Once these requirements are met you can begin configuring the apt-mirror tool. The main items that you'll need to define are: storage location (base_path) number of download threads (nthreads) release(s) and architecture(s) you want The configuration is done in the /etc/apt/mirror.list file. A default config was put in place when you installed the package, but it is generic. You'll need to update the values as mentioned above. Below I have included a complete configuration which will mirror Ubuntu 8.04 LTS for both 32 and 64 bit installations. It will require nearly 30G of storage space, which I will be putting on a removable drive. The drive will be mounted at /media/STORAGE/. # apt-mirror configuration file#### The default configuration options (uncomment and change to override)###set base_path /media/STORAGE/# set mirror_path $base_path/mirror# set skel_path $base_path/skel# set var_path $base_path/var## set defaultarch <running host architecture>set nthreads 20## 8.04 "hardy" i386 mirrordeb-i386 http://us.archive.ubuntu.com/ubuntu hardy main restricted universe multiversedeb-i386 http://us.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiversedeb-i386 http://us.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiversedeb-i386 http://us.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiversedeb-i386 http://us.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiversedeb-i386 http://us.archive.ubuntu.com/ubuntu hardy main/debian-installer restricted/debian-installer universe/debian-installer multiverse/debian-installerdeb-i386 http://packages.medibuntu.org/ hardy free non-free# 8.04 "hardy" amd64 mirrordeb-amd64 http://us.archive.ubuntu.com/ubuntu hardy main restricted universe multiversedeb-amd64 http://us.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiversedeb-amd64 http://us.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiversedeb-amd64 http://us.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiversedeb-amd64 http://us.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiversedeb-amd64 http://us.archive.ubuntu.com/ubuntu hardy main/debian-installer restricted/debian-installer universe/debian-installer multiverse/debian-installerdeb-amd64 http://packages.medibuntu.org/ hardy free non-free# Cleaning sectionclean http://us.archive.ubuntu.com/clean http://packages.medibuntu.org/ It should be noted that each of the repository lines within the file should begin with deb-i386 or deb-amd64. Formatting may have changed based on the web formatting. Once your configuration is saved you can begin to populate your mirror by running the command: apt-mirror Be warned that, based on your internet connection speeds, this could take quite a long time. Hours, if not more than a day for the initial 30G to download. Each time you run the command after the initial download will be much faster, as only incremental updates are downloaded. You may be wondering if it is possible to cancel the transfer before it is finished and begin again where it left off. Yes, I have done this countless times and I have not run into any issues. You should now have a copy of the repository stored locally on your machine. In order for this to be available to other clients you'll need to share the contents over http. This is why we listed Apache as a requirement above. In my example configuration above I mirrored the repository on a removable drive, and mounted it at /media/STORAGE. What I need to do now is make that address available over the web. This can be done by way of a symbolic link. cd /var/www/sudo ln -s /media/STORAGE/mirror/us.archive.ubuntu.com/ubuntu/ ubuntu The commands above will tell the filesystem to follow any requests for “ubuntu” back up to the mounted external drive, where it will find your mirrored contents. If you have any problems with this linking double-check your paths (as compared to those suggested here) and make sure your link points to the ubuntu directory, which is a subdirectory of the mirror you pulled from. If you point anywhere below this point your clients will not properly be able to find the contents. The additional task of keeping this newly downloaded mirror updated with the latest updates can be automated by way of a cron job. By activating the cron job your machine will automatically run the apt-mirror command on a regular daily basis, keeping your mirror up to date without any additional effort on your part. To activate the automated cron job, edit the file /etc/cron.d/apt-mirror. There will be a sample entry in the file. Simply uncomment the line and (optionally) change the “4” to an hour more convenient for you. If left with its defaults it will run the apt-mirror command, updating and synchronizing your mirror, every morning at 4:00am. The final step needed, now that you have your repository created, shared over http and configured to automatically update, is to configure your clients to use it. Ubuntu clients define where they should grab errata and security updates in the /etc/apt/sources.list file. This will usually point to the default or regional mirror. To update your clients to use your local mirror instead you'll need to edit the /etc/apt/sources.list and comment the existing entries (you may want to revert to them later!) Once you've commented the entries you can create new entries, this time pointing to your mirror. A sample entry pointing to a local mirror might look something like this: deb http://192.168.0.10/ubuntu hardy main restricted universe multiversedeb http://192.168.0.10/ubuntu hardy-updates main restricted universe multiversedeb http://192.168.0.10/ubuntu hardy-security main restricted universe multiverse Basically what you are doing is recreating your existing entries but replacing the archive.ubuntu.com with the IP of your local mirror. As long as the mirrored contents are made available over http on the mirror-server itself you should have no problems. If you do run into problems check your apache logs for details. By following these simple steps you'll have your own private (even portable!) Ubuntu repository available within your LAN, saving you future bandwidth and avoiding redundant downloads.
Read more
  • 0
  • 0
  • 33055
Modal Close icon
Modal Close icon