Tuesday, July 1, 2008

Set processor affinity programmatically in a multi-core system

Take advantage of multi-core CPUs by programmatically setting their affinity inside your applications.

Early on in the history of the personal computer an author and technology prophet, Jerry Pournelle, authored a law that went like this, “One user, one CPU”. At the time a statement like that was something akin to heresy. It was, after all, a time when dinosaurs ruled the computing world and personal computers were looked upon as little more than very expensive toys.

However, time passed and in subsequent years Pournelle’s law came to be considered somewhat conservative. So much so, in fact, that he actually modified his law to “One user, at least one CPU”, which is essentially where we are now. Unfortunately, for developers, Jerry Pournelle never actually said what to use the additional processing power for.

This blog post is also available in the PDF format as a TechRepublic Download.
My own devices

As a developer left to my own devices the first use that I’d consider would be a multi-threaded application, but what if my goal was something that didn’t readily lend itself to multi-threading or what if it was a prepackaged application?

Either of those scenarios would be an issue, fortunately there is a solution to both that dates back to the very-same days when personal computers were considered little more than very expensive toys. A point of interest to consider, is that, in those days, some of the high-end dinosaur computers actually had more than one CPU, what the system administers in those days would do with those machines is to treat them as multiple computers in a single box.

Alright, now that I know what I want to do, that only leaves the question of just how to accomplish the task. Fortunately there are both a programmatic solution for my own applications and a lazy approach for pre-written software. Being counted among the lazy, let’s take a look at that approach first.
Manually setting processor affinity

Figure A shows soffice.exe task in the task manager which is the file for Open Office, the open source office application suite, along with the various options available. One of these options is Processor Affinity, which when clicked on displays the pop-up shown in Figure B that has a check box for each core. Processor affinity is set by checking one or the other check box. In cases where both are checked the operating system will attempt to balance the load between the cores.
Figure A


Vista task manager

Figure B


Processor affinity


Now the real fun begins, because as the administrator of my own little computer I have both the power and ability to check or un-check the boxes as I feel necessary. Or, as I say when I’m feeling a bit of megalomania, “Let it run on the second core today.” The result of this mental aberration is displayed in Figure C.

Figure C




Open Office on the second core
Setting processor affinity in C#

Ah, here is where I can really let my megalomania run free, programmatically picking which core or cores my application will run on, now that’s real power. Alright, I admit it, in my case it’s more of a not completely locking-up the computer if things don’t work-out the way I intended. Come to think of it; things not going as intended is a perfect demonstration of processor affinity. Nothing says whoops like a tight loop.

To work with processor affinity in the .NET environment it is necessary to use the System.Diagnostics namespace which contains Process class from which the GetCurrentProcess() method is used to obtain a new process and associate it with the current active process. Of course, if I was working with a multi-treaded application I’d be using a different method.

Once the process is obtained the ProcessorAffinity property can be used to either set or get the processor affinity. It is important to remember that the ProcessorAffinity property is a bit mask where each bit represents a single CPU, so a system with a dual core CPU the possible values are as shown in Table A.
Table A

Value


Description
1 Use the first core
2 Use the second core
3 Use both the first and second cores

The code required to demonstrate processor affinity is surprisingly simple as Listing A illustrates. The result of the code is shown in Figures D and E.
Listing A

Processor Affinity console application

using System;

using System.Diagnostics;

using System.Text;

namespace caAfinity

{

class Program

{

static void Main(string[] args)

{

Console.WriteLine("Current ProcessorAffinity: {0}", Process.GetCurrentProcess().ProcessorAffinity);

Process.GetCurrentProcess().ProcessorAffinity = (System.IntPtr)2;

Console.WriteLine("Current ProcessorAffinity: {0}", Process.GetCurrentProcess().ProcessorAffinity);

while (true)

{ } // Tight CPU loop

}

}

}

Figure D



Demonstration running

Figure E




Vista task manager
Conclusion

Developers being what they are, when given more of anything will undoubtedly find some way to use it. Don’t believe me? Leaving an unattended pizza anywhere near a group of developers will prove me right. Seriously though, I hope that this example of what to do with the bounty of processing that Jerry Pournelle foresaw is of some use, especially for those occasions when, for one reason of another, multi-threading is out of the question.

Getting ready to support Mac on the corporate network

Getting ready to support Mac on the corporate network



As the corporate environment becomes more diverse, user support will have to become more diverse. Thanks to a new alliance of interoperability providers, the idea of supporting Macintosh in the workplace is becoming more viable. But we need to understand what new challenges will be raised.

Since the Mac became available with an Intel processor, there have been those who predicted that the Mac would be a valid corporate alternative, placing the Mac in direct competition with the likes of HP, Dell, and IBM. I personally thought that we would see a shift sooner (2003) but I may only have been five years off the mark.

Five software companies have come together to form an alliance to promote the use of the Mac in the corporate environment managed with Microsoft Windows. The allied companies include Atempo, Centrify, Group Logic, LANrev, and Parallels. The common factor between these companies is that they are all focused on interoperability technology between the Mac OS X and Windows.

As a Mac user, I can only say, “It’s about time”. But as with anything new, there will be impacts to the Support staff that count on us to know the technology and be able to fix what is broken within service SLAs. Therein lies the challenge.

This new alliance plans to provide education to both end users and corporations about the ease of use factor for the Mac. That will be a good thing as there are many who think of the Mac as being harder to use and harder to support. There is also a Best Practices area that is currently a vacuum. There is little education specifically addressing interoperability issues such as Active Directory integration, patch management, backups in a mixed environment, and security.

The alliance was formed in recognition that there is a growing number of Mac users, particularly Mac notebook users, placing new pressure on corporations to allow Macs on the network. Recently, Google has been allowing its employees to choose what they want to run, Windows, Mac, or Linux and IBM is experimenting with Macs. Another driver is the adoption of the iPhone by business, putting pressure on IT to incorporate them into the environment.

While basic education is going to be an issue, another consideration is going to be certification. You can certify in the Mac OS and in their server line. But what does the potential shift really mean in terms of required certification? Carrying both Windows certs and Apple certs? And will there be a tolerance for IT Support to come up to speed? Or is a better answer to have duplicate teams, one supporting the Windows environment and the other supporting the Mac? I think that these are the questions that will most directly affect those of us who provide end user support.

I have long believed that the corporate environment should be diverse and should be able to utilize the equipment that does the necessary job best. It may be that the enterprise is coming around to my way of thinking. I personally use a wide variety of hardware and software because some things are managed better. Graphics is very much at home on my Mac while I maintain databases using Windows XP and Access. The alliance makes good sense, especially as we consider the changes that the corporate environment is making. But I think that the change will come with a certain amount of growing pain as Windows support people are forced to confront the new machine in the environment.

How would you be impacted by the introduction of Macs to your workplace? Or do you support a mixed environment today?


source: techrepublic

Thursday, June 19, 2008

Is Linux the most secure OS???????

Linux-based systems get a lot of press in IT trade publications. A lot of that press relates to its security characteristics. In fact, some claim “Linux is the most secure operating system (OS) of them all.” Such statements are, of course, unsupportable hyperbole; while many Linux distributions may outshine both MS Windows and Apple MacOS X by a significant margin, there’s evidence to suggest that most Linux distributions are not up to the standards of FreeBSD, for instance — let alone OpenBSD, with possibly the best security record of any general-purpose operating system.

That’s even leaving out special-purpose OSes such as a number of RTOSes, IBM i, OpenVMS, and TrustedBSD. In the sense that many people tend to think first, foremost, and often only of Linux-based systems when they think of open source OSes (and even think of “Linux” as an OS without distinguishing between distributions), however, they have a point: all else being equal, a popular open source OS has definite security advantages over a popular closed source counterpart. Linux distributions are far from the only open source operating systems, though. Just for the sake of argument, insofar as Linux is emblematic of open source OSes, then, and that MS Windows is emblematic of closed source OSes, it may not be so unrealistic to say “Linux is the most secure OS of them all,” where “them all” consists of only two choices — but the world is not that simple.

“Linux” in the abstract, however — as a stand-in for the average Linux distribution — is simply not the most secure OS available by a more comprehensive view of OSes. There are, in fact, some Linux distributions that have been created for research purposes that are intentionally as poorly secured as possible in default configuration. The range of default configuration security for Linux distributions spans a broad array of choices between “intentionally as airtight as a screen door” and Hardened Gentoo. Obviously, the average, or the norm, is somewhere between the two.

Furthermore, determining a “most secure” OS is not as straightforward as it might at first sound. One of the most common criteria used by people who don’t really understand security, and by those who do understand it but want to manipulate those who don’t with misdirection and massaged statistics, is vulnerability discovery rates. Those of us who know better are aware that there’s a lot more to security than counting vulnerabilities. Other, more credible criteria, may involve factors such as:

code quality auditing

default security configuration

patch quality and response time

privilege separation architecture
. . . and a whole lot more.

Even if we ignore any OS that won’t, for instance, run a popular browser (such as Firefox), a popular email client (such as Thunderbird), and a popular office suite (such as OpenOffice.org) in a WIMP GUI on an Intel x86 architecture computer, the average Linux distribution doesn’t beat every other option in all categories by any stretch. Ubuntu Linux, arguably the Linux distribution with the greatest mindshare, certainly doesn’t.

In fact, for every category that occurs to me off the top of my head as I write this, there are operating systems that beat Ubuntu on every category, some of which are actually other Linux distributions — even if some people say Ubuntu is the most secure Linux distribution. Of course, if that was true, and it was true that Linux was the most secure OS, that would make Ubuntu more secure than OpenVMS. Suffice to say I don’t buy that implication.

If you’re one of those people inclined to say “Linux is the most secure operating system of all,” you should probably rethink that. A much stronger case can be made for the security of some other OSes than the average Linux distribution. Even if it couldn’t, the variability of Linux distributions in general, and the differing criteria for the security of an OS that may come into play in comparisons, make such a statement quixotic at best.

The long version of the answer to the question “Is Linux the most secure OS?” is that it depends on what OSes you’re comparing, or whether you’re comparing specific OSes at all (instead of something like “open source vs. closed source”), and for what purposes you mean to evaluate the security of an operating system. If you make claims like that, someone who knows better will have an easy way to discredit your argument. Be more specific, not only in your arguments, but in your thinking — because it’s too easy to form bad habits that may lead to making bad decisions about your own security, and because giving people inaccurate information about security like that can create real problems. If you mean that all else being equal popular open source OSes are more secure than popular closed source OSes, say so. If you mean that Ubuntu’s default configuration is more secure than MS Windows Vista’s, say so. Just saying “Linux is the most secure operating system of all,” on the other hand, is imprecise and inaccurate.

The short version of the answer, of course, is “No.”


Source: techrepublic.com

Monday, June 9, 2008

Windows Vista tricks

As I’ve been using Microsoft Windows Vista, I’ve discovered a handful of useful tricks that I use every day to make things a bit easier. In this edition of the Windows Vista Report, I thought I would pass on some of these tricks.
Keep track of multiple time zones

If you’re like most folks in this day and age, chances are good that you regularly communicate with people or businesses in cities in other time zones. As such, you’re always wondering what time it is where these people or businesses are, so that you know when to call or expect an e-mail response.



Wouldn’t it be cool if you could tell at a glance what time it is in those other time zones? Well, that’s the whole idea behind Windows Vista’s Additional Clocks feature, which can display up to three clocks: one for local time and two more for other time zones.





Fortunately, using and configuring Vista’s Additional Clocks feature is easy: just right-click the time display in the notification area and select the Adjust Date and Time command from the context menu. When you see the Date and Time dialog box, select the Additional Clocks tab. You can then select the Show This Clock check box, choose a time zone, and enter a name that you want to associate with the additional clock, as shown in Figure A. To activate your new clocks, just click OK.
Figure A
You can keep track of other time zones if you enable additional clocks.

Now, when you want to see what time it is in the other locations, you can just hover your mouse pointer over the time display in the notification area and you’ll see a pop-up showing the time in the other time zones. If you click the time display, you’ll see a larger pop-up showing you the clocks along with the calendar. Both of these pop-ups are shown in Figure B.
Figure B
There are two displays that you can use to view other time zones.
Instantly access Task Manager

As you know, in Windows XP, you can press [Ctrl]+[Alt]+[Del] and instantly get to Task Manager. In Windows Vista, that same keystroke combination will blank your display and display a full screen menu from which you can launch Task Manager.

In order to get directly to Task Manager in Windows Vista, you need to press [Ctrl]+[Shift]+[Esc].
Toggle Aero off and on

As you know, Aero is the fancy visual interface in Windows Vista that features the transparent glass design with cool window colors and neat animations. However, there are times when you may want to disable Aero to improve system responsiveness. For example, some games or other graphics-intensive applications may perform better with Aero disabled. Fortunately, you can easily do so with a shortcut.

To begin, right-click anywhere on the desktop and select the New | Shortcut command from the context menu. When the Create Shortcut wizard appears, type:

Rundll32 dwmApi #104

in the text box, as shown in Figure C, and click Next. Then, name the shortcut Turn Aero Off and click Finish.
Figure C
Create this shortcut to turn Aero off.

You can then create a second shortcut to re-enable Aero. To do so, launch the Create Shortcut wizard again and this time type:

Rundll32 dwmApi #102

in the text box. Name this shortcut Turn Aero On and click Finish.

Keep in mind that when you turn Aero off, the process will happen without any fanfare. However, when you turn Aero back on, the screen will blink momentarily as Windows readjusts the screen display.
Using Shell command shortcuts

While you can use Explorer, the Control Panel, or the Start menu to access key features in Windows Vista, sometimes a shortcut can be more useful. Hidden underneath the Windows Vista architecture are a whole host of special shortcuts known as Shell commands. To use a Shell command, all you need to do is press [Windows]+R to access the Run dialog box and then enter the word Shell followed by a colon (:) and then command as in:

Shell:command

As you can see there are no spaces between the word Shell and the colon and the command — it is essentially one word.

While there are close to 100 Shell commands, not all of them are very useful. As such, I won’t actually list them. I’ll just discuss the ones that I find most useful in everyday situations first and then I’ll list the other ones that I find occasionally useful.

Keep in mind that not all of these Shell commands will work in all versions of Windows Vista.
Most useful Shell commands

* shell:ChangeRemoveProgramsFolder - opens the Programs and Features (Add/Remove Programs) window.
* shell:Sendto - opens the SendTo folder so that you can easily add more locations to the Send To list.
* shell:Common Administrative Tools - opens the Administrative Tools menu as a folder
* shell:Desktop - opens the Desktop as a folder.
* shell:Downloads - opens your Downloads folder.
* shell:Quick Launch - opens the Quick Launch folder.
* shell:Searches - opens the Search folder showing all your saved searches.

The other useful Shell commands

* shell:AppUpdatesFolder - opens the Installed Windows Updates location in Program and Files.
* shell:Cache - opens Internet Explorer’s temporary Internet files folder.
* shell:CD Burning - opens the folder where Windows Vista temporarily stores files to be burned to a CD.
* shell:Common Desktop - opens the Public User’s Desktop folder.
* shell:Common Documents - opens the Public User’s Documents folder.
* shell:Common Programs - opens the Start menu shortcuts folder.
* shell:Common Start Menu - opens the Start Menu as a folder.
* shell:Common Startup - opens the Startup folder.
* shell:Common Templates - opens the Templates folder.
* shell:CommonDownloads - opens the Public User’s Downloads folder.
* shell:CommonMusic - opens the Public User’s Music folder.
* shell:CommonPictures - opens the Public User’s Pictures folder.
* shell:CommonVideo - opens the Public User’s Video folder.
* shell:ConflictFolder - opens the Sync Center Conflicts folder.
* shell:ConnectionsFolder - opens the Network Connections folder.
* shell:Contacts - opens your Contacts folder.
* shell:ControlPanelFolder - opens the Control Panel.
* shell:Cookies - opens the cookies folder
* shell:Favorites - opens your Favorites folder.
* shell:Fonts - opens Vista’s Fonts folder.
* shell:Gadgets - opens your Windows Sidebar Gadgets folder.
* shell:History - opens the Internet Explorer history folder.
* shell:InternetFolder - opens Internet Explorer.
* shell:Links - opens your Links folder location.
* shell:MyMusic - opens your Music folder.
* shell:MyPictures - opens your Pictures folder.
* shell:MyVideo - opens your Video folder.
* shell:MyComputerFolder - opens Computer window.
* shell:NetHood - opens Network Shortcuts folder.
* shell:NetworkPlacesFolder - opens the Network Places location.
* shell:Original Images - opens Windows Photo Gallery Original Images folder.
* shell:Personal - opens your Documents folder.
* shell:PhotoAlbums - opens your Slide Show folder.
* shell:Playlists - opens your Playlists folder.
* shell:PrintersFolder - opens Printers in the Control Panel.
* shell:Profile - opens your main folder.
* shell:ProgramFiles - opens the Program Files folder.
* shell:Public - opens the Public User folder.
* shell:Recent - opens the Recent Items folder.
* shell:RecycleBinFolder - opens the Recycle Bin folder.
* shell:Start Menu - opens the Start Menu folder.
* shell:Startup - opens the Startup folder
* shell:System - opens the System32 folder location.
* shell:Templates - opens the Templates folder location.
* shell:UserProfiles - opens the Users folder.
* shell:UsersFilesFolder - opens your main folder.
* shell:Windows - opens the Windows folder.

What you need to know about Cisco IOS access-list filtering


Let’s face it, if you don’t use Cisco IOS access lists (ACL) every day, they can be very painful to use. Why are ACLs so painful? Besides just being difficult to use, the penalty for mistake is huge. In one swift swoop, you could incorrectly permit malicious attackers onto your network or incorrectly deny all valid users from your network. Either way, the consequences could be devastating to your company and to your career. So how do you prevent this from happening? If you follow these guidelines, you will be “feeling good again” about your Cisco ACLs.
Know what an ACL can and cannot do

In the simplest of terms, a Cisco IOS ACL is used to define traffic. Once that traffic is defined, some action can then be taken on that traffic.

Commonly, an ACL is associated with the filtering of IP packets (Network Layer 3 of the OSI Model) as they pass through a router. In other words, it is used to permit or deny traffic through a router. However, if you just define the ACL only and don’t apply it to an interface using the access-group command, nothing happens.

While ACLs can be used for many functions like QoS, route filtering, and allowing access to the router, in this article, we will focus on using ACLs for filtering traffic in and out of the router.
Know the syntax of ACLs

To configure an ACL you need to include some basic information about which packets to permit or deny.

The general syntax for a standard access list is:

access-list {list number} permit | deny | [source address} [source mask]

Note that the standard ACL can only permit or deny traffic based on the source of the traffic.

The general syntax of a TCP extended access list is:

access-list access-list-number [dynamic dynamic-name [timeout minutes]] {deny | permit} tcp source source-wildcard [operator [port]] destination destination-wildcard [operator [port]] [established] [precedence precedence] [tos tos] [log | log-input] [time-range time-range-name] [fragments]

You should also know that extended ACL can filter IP traffic, TCP, UDP, ICMP, and other types of traffic. The syntax above is to filter TCP traffic.
Know that ACLs use wildcard masks

Cisco IOS ACLs use wildcard masks. These wildcard masks are required anytime you enter an IP address in your ACL. The only way NOT to enter an IP address (thus, using a wildcard mask) is to enter a keyword like “any” or use the keyword “host” before the absolute IP address of a host on the network.

Wildcard masks are the binary reverse of a subnet mask. Thus, to calculate a wildcard mask, you take the subnet mask of a network address or IP address, convert it to binary, turn all the 1s into 0s and the 0s into 1s, and convert it back to decimal. Sounds complicated, but it really isn’t. If the subnet mask is masked at the 8-bit subnet boundaries, then a 0 will turn into a 255 and a 255 will turn into a 0. Here are a few examples:
SN 255.0.0.0 = wildcard 0.255.255.255
SN 255.255.255.0 = wildcard 0.0.0.255
SN 255.255.128.0 = wildcard 0.0.127.255
SN 255.255.255.224 = 0.0.0.31

Do NOT use a subnet mask in a wildcard mask on a Cisco IOS router or switch, or you will end up with unintended results. (On the other hand, if you are configuring an ACL on a Cisco PIX, use regular subnet masks, not wildcard masks).
Know how to create an ACL and apply it to an interface

For example, here’s how a sample configuration might look for access list 1:

Router(config)# access-list 1 permit 172.16.30.0 0.0.0.255
Router(config-if)# interface e0/0
Router(config-if)# ip access-group 1 out

The ip access-group command is used to apply an ACL to an interface and specify the direction that it applies.

The commands above permit any traffic going to IP network 172.16.30.0 from going OUT the router’s Ethernet 0/0 interface. Any traffic addressed to that network will still be allowed in, but it won’t be permitted to go out interface e0/0.
Know the implicit deny

Let me ask you this: What is allowed through the ACL above? Answer: Only the traffic to the 172.16.30.0 /24 network. Why is that? That is because at the end of every ACL, whether you see it or not, ALL TRAFFIC IS IMPLICITLY DENIED.

So, what traffic is allowed through the ACL below?

Router(config)# access-list 1 deny 172.16.30.0 0.0.0.255

That’s right - NO TRAFFIC is allowed because certain traffic is explicitly denied and ALL OTHER TRAFFIC IS DENIED by the implicit deny.

How do you see the traffic being denied? You can enter your own explicit deny with the log keyword, like this:

Router(config)# access-list 1 permit 172.16.30.0 0.0.0.255
Router(config)# access-list 1 deny any log
Know that ACLs use top-down processing

Cisco IOS ACLs use top-down processing. This means that when a condition in the ACL is met, all processing is stopped. Thus, if there is a permit for network 1.1.1.0 in the fifth line of the ACL but it is denied in the third line of the ACL, then that traffic is denied.
Know the three Ps of ACLs

Remember, you can only apply ONE ACL:
Per Interface
Per Protocol
Per Direction

As most of us are applying IP ACLs, the protocol doesn’t matter that much, but the important thing to know is that you can apply only ONE ACL on each interface in each direction. In other words, you can apply only one INBOUND and one OUTBOUND ACL per interface.
Know how to verify which ACLs are applied and which are configured

Showing what ACLs are created and what ACLs are applied is easy if you know just a few commands. These commands are:
show access-lists
show ip interface
show running-config
Know that there are many methods and types of ACLs

The Cisco IOS supports IP Standard and Extended ACLs in both named and numbered versions. Additionally, there are reflexive, dynamic, and lock-and-key access lists, among many others.
Know how ACLs can be used in the real world

While you may understand the concept of ACLs and how to configure them, it is important to know how to use them in the real world.

Here are a few business applications for ACLs:

1. Basic packet filtering for security: Filter traffic from a host, a network, a protocol, or port.

2. Packet filtering for bandwidth control: Say that a streaming audio or video application was using network bandwidth, and it was on a certain port number. With an ACL, you could discard those video and audio packets to prevent overutilization of bandwidth.

3. Other functions with ACLs: Route filtering, QoS, controlling access to the router, etc.
Know where to find more resources to learn ACLs

There is a lot to know about ACLs, and we can’t cover it all in this short format. To learn more about ACLs, here are some links to other articles and videos I have created on this topic.
TechRepublic.com: Use Advanced Parameters on Your Cisco IOS ACLs
TechRepublic.com: Cisco IOS Access Lists - 10 Things You Should Know
HappyRouter.com: Free Video - Hardening Your Router with Cisco IOS ACLs
Petri.co.il: How to Edit Cisco IOS ACLs Using Line Numbers

Conclusion

ACLs are the least understood feature that new Cisco administrators and CCNA candidates struggle with. I hope you find this information about Cisco IOS access lists helpful, and you keep it handy to “cure those ACL pains” whenever they come up.

Monday, June 2, 2008

Advanced partition management on your Apple computer

All modern OSs include basic tools that will let you format and partition a volume. This isn’t enough for me, though. I like having a partition tool that supports nondestructive partition editing, and this usually means that I have to resort to third-party partition tools.




Windows users have a number of options if they’re looking for a more robust tool than the Disk Management app that Microsoft provides. PartitionMagic is my nondestructive partition editor of choice for Windows, but there are also a lot of open-source options developed by the Linux community to support the partitioning of Windows/Linux dual-boot systems.

Mac OS X’s default tool for volume management—Disk Utility—is also pretty basic, providing a simple means to format storage media. Apple doesn’t want to make it easy for users to screw up their system partitions. The partition management landscape has changed a little in the newest version of the Mac OS, since support for dual-booting with Windows is now bundled aboard. Boot Camp, the application that makes this dual-booting easy on Macs supports nondestructive partition resizing, but you can’t access the resize function outside the Boot Camp set-up app without delving into the Mac OS command line. That’s too difficult for all but the geekiest (and the bravest) of Mac users.

Fear not, however, if you have a Mac and want to start doing some advanced monkeying with your partition schemes. iPartition is a must-have for any tech who needs to support Macs, especially in a cross-platform environment. It offers a lot of the features I love in PartitionMagic: nondestructive resizing of both Mac and Windows partitions, and even conversion between partition tables of different types (Linux partition support is a future possibility). iPartition is very user-friendly and even includes a companion application for defragmenting your drive before you start creating new partitions; that app is called iDefrag.

Don’t let the vaguely annoying perpetuation of Apple-related “i” naming conventions put you off using iPartition. I’ve used it several times as I’ve been setting up my Macs to dual-boot Linux, and it’s worked great. I also have it on good authority that Apple support refers people to these products when users find that Boot Camp’s built-in partition resize tool won’t work on their system. For anyone who needs an advanced partition management tool for their Mac, I don’t know of anything better.

P.S. I shouldn’t have to remind any of you of this, but before touching your partitions, make sure your data is secure. Nondestructive editing isn’t intended to stand in place of a backup, it just saves you from the drawn-out wipe and reinstall cycle that came with making these changes the old-fashioned way. Editing partitions without a backup is just dumb. Don’t be dumb.

Thursday, May 29, 2008

Some benefits and drawbacks of Microsoft Project

According to the Microsoft’s website “Microsoft Office Project Standard 2007 gives you robust project management tools with the right blend of usability, power, and flexibility, so you can manage projects more efficiently and effectively.” While I don’t disagree with their statement, I have worked with many project managers who never have spent the time to understand the tool well enough to feel that it really helps them do their job better.

If you’ve been using Microsoft Project for any period of time, you probably know all the basics by now. Instead of writing another tutorial about how to use Project, I thought I would share some of the ideas for using Project to make your lives easier and more productive.
Using templates

Not every project is the same. In fact, most of them are very different. But they all have the common components of Inception, Elaboration, Construction, and Transition (depending on the methodology used by your company, the names vary but the purposes are the same).

By spending some of your time creating a few basic templates, you can decrease the time needed to set up the fundamentals over and over. This lets you focus on outlining what you need to get done. Microsoft even has some templates, available for download, to get you started. Click here to see some of the templates.
Quickly Estimating project timelines

We’ve all been in those meetings when a business partner requests a timeline on a project they came up with only a few minutes beforehand.

I know one manager who sits in meetings with his laptop open while Project is running trying to do a high-level estimate of what the user is asking for. By focusing on the creation of tasks with either a low, medium, or high level of effort, he can quickly provide his estimate based on what he feels is the work required for the particular project.
What If scenarios

Microsoft Project also helps in those situations where you tell your boss that a project will take X weeks, only to hear him tell you that’s too long. Project allows you to easily go back and modify your criteria to see if you can come up with something more appealing.

You can do this rather quickly by modifying the number of potential resources or evaluating the parallel-pathing of some of your tasks. The list of things you can try goes on and on but the benefit to you is that you can quickly try different scenarios and see how it affects the outcome.
Watchouts

I’ve told you some ways that Project can make your life easier. Here are some pitfalls to watch out for as well.
Watch Out #1: Not updating the project plan

Many project managers spend hours doing a project plan and then handing it over to the other shareholders. Unfortunately, many PMs then store that project plan on their hard drive and never look at it again. In the heat of running a project, one of the biggest mistakes you make is to abandon all that hard work. Make sure you spend at least some time each day reviewing your tasks and milestones as well as updating you plan. You spent all that time working on it - don’t you want get the benefits as well?
Watch Out #2: Over committing resources

This is one that I see far too often when I look at a project plan. Managers take the time to fill in all the detail, determining task durations, and assign predecessors and successors all in an effort to come up with a timeline. They then merrily go down the task list assigning the appropriate resources to each task with complete disregard to how much of each resource time is allocated.

When you have filled out your project plan, make sure that you check out the Resource Graph (View -> Resource Graph) on your project and look for the areas that are shaded in Red. This is Project showing you where somebody has been allocated more than their available time, which in turn puts some unnecessary risk into your timeline.

There are many other ways to make Microsoft Project a productive tool for you and your organization. By breaking down your tasks into subtasks and keeping realistic timelines in mind, you can see issues early on before they become major issues. And with its ability to track, change, and report on just about every key metric, you’ll always have the information you need at your fingertips to keep your end users up to date.

Even if you choose not to use Microsoft Project as your project management tool, it’s important that you find something to help you manage all of the pieces of your project. Once you get used to using it you’ll wonder how you ever managed without one.

Windows XP SP3 vs. Ubuntu upgrade to 8.04

More Installation guide in:

So a few friends of mine have all suffered from the Windows XP SP3 update plague that has rendered some machines in need of a complete re-install and some just acting as if they have been infected by some form of PC-West-Nile. So instead of making fun of them for once again getting pimp-slapped by Microsoft, I thought I would try to suffer their same pain by updating my primary machine (currently running Ubuntu 7.10) to Hardy Herron 8.04.

I have done plenty of googling to see what kinds of issues that I would come across (since this is a major update) and really didn’t find much that would scare me from making the jump. And even if I did suffer some pain I knew I had a back up of my machine via a LiveCD. So if all went kaput, I could just toss in the LiveCD and reinstall my working machine (don’t ya love Linux?).

So I followed these steps:

* Ran sudo update-manager
* Updated my machine to make sure I had all the latest 7.10 software
* Clicked on the Upgrade button
* Went to do something productive

Well, at first look, the ugrade went very well. The machine booted up to X, I logged in, got on-line, and did most everything I always do. Very quickly, however, I hit a snag. I always set up my personal machines with two drives: An OS drive and a data drive. The data drive, as you can assume, holds all my data. I have data from years ago on said drive. But once I tried to access that drive I found it not accessible. It didn’t take me long (after running the “dmesg” command) to find out that drives were now labeled differently in 8.04. Instead of /dev/hda or /dev/hdb, I was seeing /dev/sda and /dev/sdb. So I figured it was just a matter of remounting the drive with the new mapping. No such luck. No matter what I tried, the drive wouldn’t mount. So I figured up gparted only to find out that, according to the upgraded Ubuntu, the partition table on the drive was corrupted.

It turns out not to be the truth. The partition table on the drive is fine. But for some odd reason the upgrade process fubar’d the udev system. Udev? What is udev you ask? The udev system allows a dynamic /dev directory, and it provides the ability to have persistent device names. It’s a complex system that is supposed to create a simplistic user experience with devices. In normal circumstances, this system works like a charm. For instance, on my laptop, anytime I insert a disk I will see a new directory appear in /media. Most times the disk will be labeled /media/disk. If the disk was created with a name, that name will appear in the /media directory. This system normally works. But when udev itself is broken…well…you see where that leads.

I did spend a good amount of time looking up the udev problem. Ubuntu now also labels disks with UUIDs. I even tried getting the UUID of the drive, but to no avail. Ultimately it required a complete re-install. But interestingly enough, the install of Ubuntu 8.04 didn’t work. Every time I attempted an install it would install and then, upon reboot, it would stop at Busybox. What is Busybox? Busybox is a small application that contains a bunch of common UNIX utilities. Basically it is a tiny distribution that is aimed at embedded systems. So, why is my installed Ubuntu system booting to this? This was apparently a bug in the 8.04 Alpha 4 stage. The workaround? Go into the BIOS of your computer (F2 at boot), then go in Integrated Peripherals, and then change SATA Mode from IDE to RAID.

And this is supposed to be the Ubuntu to bring all users to Linux? Now certainly I can understand these sorts of bugs in Alpha and even Beta releases. But in a public release? Sorry. And this bug made it to Kubuntu as well. I finally had to drop back to 7.10 to get Ubuntu (actually gOS) installed on my machine. Now, granted my machine was built from scratch and it’s 64 bit (although running in 32 bit mode) hardware. But if 7.10 didn’t have any problems…dot…dot…dot…

As you can see I had just as many problems as the XP SP3 users had. Now to be fair to Ubuntu, I wasn’t just updating packages, I was upgrading an entire distribution which has always been flaky at best. So I have to wonder, when a distribution upgrade is almost always the WRONG way to go, why is it even an option? I would like to see the distro upgrade banished until such a time when it can be, well, successfully done. Until then, force people to install from scratch. I think most can agree the experience is ALWAYS better.

Tuesday, May 27, 2008

Firefox 3 Beta 3 offers numerous features for developers

There was a common thread to the reader feedback about my article on Safari 3: Developers are loyal to Firefox. Firefox’s support for customization and standards, along with plenty of add-ons, has made it a favorite among developers; however, this support has been strained as other browsers have caught up.

Firefox 3 Beta 3 is now available, and there are plenty of new features that will interest Web developers.

Web developmentWhen you support multiple browsers, it means knowing what browsers can and cannot do. The next version of Firefox adds support for a variety of Web standards, as well as its own extensions.

Firefox 3 Beta 3 is built on top of Gecko 1.9, which is the new version of Firefox’s HTML rendering engine. Furthermore, Gecko 1.9 can pass the Acid 2 test.

The latest version of Firefox includes many changes of interest to developers. The following list provides an overview:

Animated PNG (APNG): The animated PNG image format is now supported.
Canvas changes: You may draw text in a canvas, as well as use transform-related events.
Cross-site requests: Supports the W3C standard for allowing cross-site requests via the XmlHttpRequest object.
CSS: A variety of CSS features that were previously not supported are now supported.
DOM: Notable DOM features are now supported.
EXLST: XSLT extensions are now supported.
JavaScript 1.8: The browser supports version 1.8 of the default client scripting language. A notable change is discontinued support for the non-standard Script object. Notable changes to the JavaScript engine are a native JSON parser and Web-based protocol handlers.
Microformat support: The browser now includes a data manager for the Microformat standard.
Partial HTML 5 support: Certain aspects of the HTML 5 standard are supported, including WHATWG support, which encompasses offline/online support. This provides online and offline events in the BODY element, as well as more features. Also, the new activeElement and hasFocus attributes and drag-and-drop events are supported.
Enhanced XUL support: A variety of new XUL elements have been added and existing features have been enhanced.
The introduction of the Places API: It replaces the history and bookmarks APIs in previous versions, making it possible to develop add-ons that interact with bookmarks and browsing history.
Firefox’s add-on architecture is the feature that pushes it to the top of the browser heap. The list of add-ons is overwhelming — there’s something for everybody. A good example is Firebug. On the other hand, the proliferation of add-ons has added to the performance issues.

There are a variety of improvements in Firefox 3, which include the following: Enhancements to Cross Platform Component Object Model (XPCOM) that includes a cycle collector to address memory leaks; additional improvements include a way to secure add-on updates; a new thread manager; and a new approach to localization.

PerformanceFirefox 3 promises a smaller memory footprint and plenty of performance improvements. When I loaded Firefox 3, I noticed the drastic performance improvement over version 2. I was impressed with the quick application startup, as well as pages loading without delay.

On the memory issue, I use a system with 2 gigs of RAM, so noticing a memory problem would be hard. However, I did monitor memory usage, and Firefox 3 Beta 3 consistently consumed more than 80 MB of memory when browsing via multiple tabs. I would like to hear your feedback concerning memory usage and whether there are noticeable improvements in the current Beta version.

Another improvement is the download manager, which is a main feature for Web developers who are often downloading new software and applications. The download manager now supports searching and includes more information on the download such as a timestamp and where it was saved.

I love the Firefox feature of maintaining multiple tabs when closing, so the tabs appear the next time you open the browser. This is a great feature for developers who rely on the Web for research, testing, and so forth.

Choose your platformAnother great feature of Firefox is its support of multiple platforms. Firefox 3 Beta 3 is available as a free download for Windows, Linux, and Mac OS X. Once the download is complete, the installation is as easy as point-and-click and then choosing your options and the installation directory.

Go for a test driveBeta programs provide an avenue to examine software before its final release. It is interesting to peruse the list of bug fixes through the alpha and beta phases of Firefox 3.

Mozilla has taken its time with Firefox 3 Beta 3, which is another sign that it’s trying to work out all of the bugs. The company plans to release Beta 4 before a final commercial version.

Firefox 3 Beta 3 expands its already robust support of Web standards while adding its own features. Take Firefox 3 Beta 3 for a test drive today to get a better idea of what to expect.

Are you currently using the current Beta or a previous version of Firefox? Do you foresee yourself adopting Firefox 3 when it is released? Post your comments in the Web Developer article discussion.

Tony Patton began his professional career as an application developer earning Java, VB, Lotus, and XML certifications to bolster his knowledge.

—————————————————————————————

Check out the Web Development Zone archive, and catch up on the most recent editions of Tony Patton’s column.

Get weekly development tips in your inbox
Keep your developer skills sharp by signing up for TechRepublic’s free Web Developer newsletter, delivered each Tuesday

The challenges of maintenance programming

The world of programming has changed quite a bit since computers were first developed. One relative constant is the way in which programs are created; specifically, the idea of source code represented as standard ASCII text. It has been decades since we evolved from using hex editors or punch cards to using text editors. I think it’s time to look at how we work with the source code (presuming that the idea behind source code does not evolve anytime soon).

Most of the programming that I’ve done required me to come in behind someone else to make changes. It is fairly rare that I do “clean slate” programming. I suspect that most programmers are primarily doing maintenance at this point. For the maintenance programmer, the number one challenge is to find out enough about the code so you can strive to be as effective as the original programmer. This is just some of the information maintenance programmers have to pick up in short order:

Learn naming conventions well enough to be followed so that the new code mixes well with the original code.
Find out where the documentation is and how to update it (and what kinds of information belong in it).
Learn where and how to make common presentation-layer changes, such as error message text, font sizing, or the images used in the application.
Discover where input validation occurs and what the validation rules are.
Learn how to produce output in a way that is as similar as possible to the original code; in other words, if the original code combines an external resource file with a presentation template, your code should not contain hardcoded output.
Uncover “gotchas” such as long-running loops that block the main thread, making the application appear to be hung when it is actually operating normally.
This is why it often takes two days to make a 10 minute change — or even longer if the maintainer has never worked with that codebase.

If you believe that most programmers maintain code much of (or even most of) the time, the cost of programming can be dramatically reduced by making maintenance more efficient. If you study the above list carefully, you will see that having a clear conception or model of the code in your mind is the key to being able to perform maintenance efficiently. Many of the tools from Microsoft Research’s Human Interactions in Programming (HIP) group are designed for efficient code maintenance; in particular, Backstory, Code Thumbnails, and Software Terrain Maps.

It is unfortunate that none of these items are shipping products or even in a public beta state yet. Backstory is quickly making progress; I am told that it should be available in some condition in a few months, and I am hoping to catch up with its creator then. I am looking forward to using Backstory, particularly since my current project is 95% maintenance (much of my learning about the code is to learn where in the configuration to change things).

I learn a piece of code by reading through it once or twice and then stepping through the execution in a debugger (I really like Visual Studio’s auto watches for this task). The IntelliSense in Visual Studio is a huge help because it lets you quickly see the available methods and properties of a class; the Go to Definition command is a lifesaver as well.

How do you become familiar and comfortable with a new piece of code?

Thursday, May 22, 2008

Problems with XP SP3 highlight the need to beware of updates

It has taken Microsoft four years to ship another service pack for Windows XP. After all that time, you might think that they’d get it right. However, even as SP3 went to RTM, problems cropped up with SP3, including problems that it caused with Microsoft’s own Dynamics line of software.

With the practically unlimited hardware and software combinations that are out there, you can’t necessarily blame Microsoft if things break when they ship something as significant as a service pack. Even simple patches and fixes can sometimes break things. That’s why it’s often a good idea not to configure Automatic Updates on Windows software. You need to have a strategy in place to deal with updates and to test them in advance.

Where to begin?Of course, in some cases users can receive updates automatically and you don’t have to worry about them. For lower-level users doing noncritical work, you may think you can save yourself some time by just enabling Automatic Updates. Usually the places where updates and service packs cause the most damage is where you’re using custom applications or rely a lot on non-Microsoft solutions. So for those users, you may want to have a testing regiment in place before you allow them to receive updates. The main difficulty with such a strategy is that you can spend a lot of time doing triage.

It’s often easier to have a blanket policy in place. Either allow Automatic Updates for everyone, hope for the best, and deal with the fallout, or block updates for all users and distribute them on an as-needed basis once you’re sure they work properly.

Do-it-yourself distributionIt’s a gamble which is the better strategy. In the short term, certainly the most labor-intensive option is to block automatic updates and distribute them yourself. If you’ve standardized the workstations in your organization, you should keep back a representative machine with typically installed software. Apply the patches and do some testing yourself. If everything seems to be fine, then you can push the patches and service packs out.

Microsoft helps with the blocking of XP SP3 and Vista SP1 with the Windows Service Pack Blocker Tool Kit. Even if you have Automatic Updates installed, this tool will prevent them from loading the target service packs for up to a year. This gives you the flexibility of allowing Automatic Updates without having to worry about dealing with bad results from the service packs.

Another alternative is to set up your own update server and redirect workstation updates to it. Microsoft’s Windows Server Update Services will help you get that job done. Third parties create update services as well, such as PatchLink, PatchQuest, and Patch Authority.

Finally, you can also just create individual MSI files for each patch or update and then push them out via Group Policy. This takes a little more effort than the other solutions, but it gives you the maximum flexibility about who gets what and when. If you don’t like Active Directory and Group Policy, you can use things like ZENworks and LANDesk to do essentially the same thing.

Avoid fixes that break thingsService packs and updates have the ability to introduce as many problems as they fix. As an IT leader, you need to have a strategy in place before you deploy them. You may get lucky and not encounter any problems. However, it’s just as likely that when the updates fix one thing they break something else along the way. Do some testing in advance, and you can save yourself time in the long run.

Automatically generate and assign strong passwords in Windows XP

Computer users consistently use very simplistic logic when creating passwords. For example, many of us choose meaningful words, personal dates, or a word commonly found in the dictionary because it makes the password easy to remember. These common practices cause us to sacrifice the security that passwords are intended to provide.

If you’re really at a loss when it comes to thinking of a strong password, you can let Windows XP create and assign a random password to your account. To let Windows XP generate your password, follow these steps. (Warning: Before you follow these steps, please be sure that you are paying careful attention and are ready to actually use a password that might not be as memorable as you’re accustomed to! Also, you cannot use this tip on a Windows Server domain.)

Open a Command Prompt window and type:

net user username /random (username is your login account name)
Press [Enter]. Windows XP will randomly generate a secure password, as well as assign that strong password to your account. Windows XP will also display the strong password so you can remember it.
At your discretion, you may want to create a Password Reset Disk at this point. This disk will allow you to gain access to your computer in the event you forget your password. Here’s how to create the disk:

Open the Control Panel and double-click the User Accounts tool.
Click your account icon.
Select Prevent A Forgotten Password under Related Tasks.
Follow the instructions provided by the wizard.
Note: This tip applies to both Windows XP Home and Windows XP Professional systems in either a standalone or peer-to-peer workgroup configuration.