Archive for the ‘FreeBSD’ Category.

Netcraft: Most Reliable Hosting Company Sites in July 2010

Netcraft has posted the most reliable hosting companies and of the top ten, five are using FreeBSD.
Most Reliable Hosting Company Sites in July 2010

I was informed about this by an email to the FreeBSD advocacy mailing list: advocacy@freebsd.org

Seems that this is something worth pointing out to companies who ask whether to use Windows, Linux, or BSD.

FreeBSD 8.1 Released today!

So I was browsing the FreeBSD Ftp yesterday and saw that FreeBSD 8.1-Release ISOs were available, and I almost jumped the gun and announced this yesterday.

http://www.freebsd.org/news/newsflash.html#event20100723:01

How to determine if an MSI patch (.msp file) has been applied using C++?

Ok, so I need to determine if a patch has been applied to an MSI. Lets start with Enumerating the installed products and enumerating all the patches applied for each installed product.

I guess the title should be “How to enumerate installed MSI products and their applied MSP patches.”

I have to do it in C++, which is a drag because it looked like three lines of code in C#, but hey, maybe it isn’t so hard with C++ using .NET as well.

I researched on MSDN, of course.  It looks like I need to use this function: MsiGetPatchInfoEx.  However, I need to know the MSI GUID in order to use that function, so I might as well learn to use the MsiEnumProducts, MsiGetProductInfo, MsiEnumPatches to match the Product to an MSI Guid and that to a patch.

Creating the Project

  1. I created a new Project in Visual Studio to test this out. The project type I used was under C++ and is called Win32 Console application.
  2. I didn’t make any changes to the default code provided: targetver.h, stafx.h, stafx.cpp.
  3. Make sure you have the Platform SDK installed for the next step.
  4. I went to the project properties and went to Linker | Inpuut and added to Additional Dependencies the following line:
    "$(WindowsSdkDir)Lib\msi.lib"
    
  5. I wrote my code.

Learning the Code
So here is what the code I wrote in this little learning project will do:

  1. Create a list or vector to store each MSIProduct.
  2. Loop through each installed MSIs using the MsiEnumProducts function and for each installed MSI:
  3. Get MSI information using MSIProductInfo.
  4. Create an MSIProduct object using the information from MSIProductInfo and add the MSIProduct to the list or vector.
  5. Write to standard output the MSI count (as Id), the MSI name, and the MSI Guid.
  6. Create a list or vector to store each MSIPatch.
  7. Check if any patches or MSPs are applied to the MSI and for each patch:
  8. Get MSP information using MSIPatchInfoEx.
  9. Create an MSIPatch object using the information from MSIPatchInfoEx and add the MSIPatch to this list or vector.
  10. Write to standard output the MSP Guid.

Here is my code:

Run.cpp
This file does all the work and has the tmain function. It creates a list or vector of MSIProduct objects and then uses MsiEnumProducts and MsiGetProductInfo to create and add each MSIProduct to the vector.  It also loops through each of the MSIProduct‘s and find any installed patches.  It adds each patch found to the MSIProduct‘s _Patches vector.

// Run.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
#include "Msi.h"
#include "MSIProduct.h" // Includes MSIBase.h and MSIPatch.h as well
#include <iostream>
#include <vector>

using namespace std;

#define MYSIZE 512

int _tmain(int argc, _TCHAR* argv[])
{
	// Step 1. Create a list or vector to store each MSIProduct.
	vector<MSIProduct> *products = new vector<MSIProduct>();

	// Step 2. Loop through each installed MSIs using the MsiEnumProducts
	//            function and for each installed MSI:
	int i = 0;
	bool foundMoreApps = true;
	while (foundMoreApps)
	{
		DWORD size = MYSIZE;
		LPTSTR tmpGuid = new TCHAR[MYSIZE];
		LPTSTR tmpName = new TCHAR[MYSIZE];

		UINT ret1 = MsiEnumProducts(i, tmpGuid);
		if (ret1 > 0)
		{
			foundMoreApps = false;
			continue;
		}

		// Step 3. Get MSI information using MSIProductInfo.
		UINT ret2 = MsiGetProductInfo(tmpGuid, INSTALLPROPERTY_PRODUCTNAME, tmpName, &size);
		if (ret2 > 0)
		{
			// Todo: Handle failure
		}

		// Step 4. Create an MSIProduct object using the information from MSIProductInfo
		//            and add the MSIProduct to the list or vector.
		products->push_back(MSIProduct());
		products->at(i).SetName(tmpName);
		products->at(i).SetGuid(tmpGuid);

		// Step 5. Write to standard output the MSI count (as Id), the MSI name, and the MSI Guid.
		cout << endl;
		cout << "Id: " << i << endl;
		wcout << "Product: " << tmpName << endl;
		wcout << "Guid: " << tmpGuid << endl;
		cout << "Patches: ";

		// Step 6. Create a list or vector to store each MSIPatch.
		vector<MSIPatch> *patches = new vector<MSIPatch>();
		products->at(i).SetPatches(patches);

		// Step 7. Check if any patches or MSPs are applied to the MSI and for each patch:
		int j = 0;
		bool foundMorePatches = true;
		while (foundMorePatches)
		{
			DWORD size = MYSIZE;
			LPTSTR tmpPatchGuid = new TCHAR[MYSIZE];
			LPTSTR tmpPatchState = new TCHAR[MYSIZE];
			LPTSTR tmpPatchTransforms = new TCHAR[MYSIZE];

			UINT retPatch1 = MsiEnumPatches(tmpGuid, j, tmpPatchGuid, tmpPatchTransforms, &size);
			if (retPatch1 > 0)
			{
				cout << "(" << retPatch1 << ") :" << endl;
				foundMorePatches = false;
				continue;
			}

			// These values correspond to the constants the dwFilter parameter
			// of MsiEnumPatchesEx uses.

			// Step 8. Get MSP information using MSIPatchInfoEx.
			UINT retPatch2 = MsiGetPatchInfoEx(tmpPatchGuid, tmpGuid, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PATCHSTATE, tmpPatchState, &size);
			// Returns "1" if this patch is currently applied to the product.
			// Returns "2" if this patch is superseded by another patch.
			// Returns "4" if this patch is obsolete.
			if (retPatch2 > 0)
			{
				// Todo: Handle failure
			}

			// Step 9. Create an MSIPatch object using the information from MSIPatchInfoEx
			//            and add the MSIPatch to this list or vector.
			patches->push_back(MSIPatch());
			patches->at(j).SetPatchState(tmpPatchState);
			patches->at(j).SetGuid(tmpPatchGuid);
			patches->at(j).SetTransforms(tmpPatchTransforms);

			// Step 9. Write to standard output the MSP Guid.
			wcout << "\t" << "Patch Guid: " << tmpPatchGuid << endl;

			j++;
		}

		i++;
	}
}
&#91;/sourcecode&#93;

I did create some simple supporting classes for this:

<strong>MSIBase.h</strong>


#pragma once
#include "windows.h"

class MSIBase
{
  public:

	// Constructor
	MSIBase(void);

	// Destructor
	virtual ~MSIBase(void);

	// Accessor functions
	LPTSTR GetName();
	void SetName(LPTSTR inName);

	LPTSTR GetGuid();
	void SetGuid(LPTSTR inGuid);

  protected:
	LPTSTR _Guid;
	LPTSTR _Name;
};

MSIBase.cpp

#include "StdAfx.h"
#include "MSIBase.h"

MSIBase::MSIBase(void)
{
}

MSIBase::~MSIBase(void)
{
}

// Accessor functions
LPTSTR  MSIBase::GetName()
{
	return _Name;
}

void MSIBase::SetName(LPTSTR inName)
{
	_Name = inName;
}

LPTSTR  MSIBase::GetGuid()
{
	return _Guid;
}

void MSIBase::SetGuid(LPTSTR inGuid)
{
	_Guid = inGuid;
}

MSIProduct.h

#include "MSIBase.h"
#include "MSIPatch.h"
#include <vector>

#pragma once
class MSIProduct : public MSIBase
{
public:
	MSIProduct(void);
	~MSIProduct(void);

	std::vector<MSIPatch> GetPatches();
	void SetPatches(std::vector<MSIPatch> * inPatches);
	void AddPatch(MSIPatch inPatch);

protected:
	std::vector<MSIPatch> * _Patches;
};

MSIProduct.cpp

#include "StdAfx.h"
#include "MSIProduct.h"

MSIProduct::MSIProduct(void)
{
}

MSIProduct::~MSIProduct(void)
{
	delete _Patches;
}

std::vector<MSIPatch> MSIProduct::GetPatches()
{
	return * _Patches;
}

void MSIProduct::SetPatches(std::vector<MSIPatch> * inPatches)
{
	_Patches = inPatches;
}

void MSIProduct::AddPatch(MSIPatch inPatch)
{
	_Patches->push_back(inPatch);
}

MSIPatch.h

#pragma once
#include "MSIBase.h"

class MSIPatch : public MSIBase
{
public:
	MSIPatch(void);
	~MSIPatch(void);

	LPTSTR GetTransforms();
	void SetTransforms(LPTSTR inTransforms);
	int GetPatchState();
	void SetPatchState(int inPatchState);
	void SetPatchState(LPTSTR inPatchState);

protected:
	LPTSTR _Transforms;
	int _PatchState;
};

MSIPatch.cpp

#include "StdAfx.h"
#include "MSIPatch.h"

MSIPatch::MSIPatch(void)
{
}

MSIPatch::~MSIPatch(void)
{
}

LPTSTR  MSIPatch::GetTransforms()
{
	return _Transforms;
}

void MSIPatch::SetTransforms(LPTSTR inTransforms)
{
	_Transforms = inTransforms;
}

int  MSIPatch::GetPatchState()
{
	return _PatchState;
}

void MSIPatch::SetPatchState(int inPatchState)
{
	_PatchState = inPatchState;

}

void MSIPatch::SetPatchState(LPTSTR inPatchState)
{
	_PatchState = _wtoi(inPatchState);
}

Sorry, I am not explaining in more detail, my time is limited.

Note: I found one problem where an application has a ™ in the name. (Skype™ 4.2) and the output doesn’t work well after that.


Copyright ® Rhyous.com – Linking to this article is allowed without permission and as many as ten lines of this article can be used along with this link. Any other use of this article is allowed only by permission of Rhyous.com.

Connecting to Active Directory with Kerberos on FreeBSD

So, I am trying to get Active Directory integration with FreeBSD and I have been researching this for a while as I have stated.
http://rhyous.com/2010/01/13/researching-the-process-for-integrating-freebsd-with-active-directory

I don’t have it all integrated yet. I keep running into road blocks.

First, I want to be able to do integration with Kerberos alone.

One part that is really easy is connecting to active directory with kerberos.

Step 1 – Collect Active Directory information.

Active Directory Domain LD.LAB
AD Domain Controller vmdc.ld.lab
Domain Admin user name administrator
Domain Admin password pw

Step 2 – Create the /etc/krb5.conf

Here is mine. Supposedly this is case sensitive, so make sure to match the case.

[libdefaults]
  clockskew = 300
  default_realm = LD.LAB

[realms]
  LD.LAB = {
    kdc = vmdc.ld.lab
    default_domain = LD.LAB
    kpasswd_server = vmdc.ld.lab
  }

[domain_realm]
  .LD.LAB = LD.LAB

Step 3 – Acquiring a ticket

  1. Use kinit and a domain user and password to acquire a certificate.# kinit administratorEnter the password when prompted.
  2. Use klist to list the kerberos tickets.

However, once I have this working, I don’t know how to change authentication using nsswitch.conf and /etc/pam.d/sshd or system to make it work.

I assumed I wouldn’t need to change nsswitch.conf and that for Step 4 I would just have to uncomment the pam_krb5.so lines in the the /etc/pam.d/sshd and /etc/pam.d/system but unfortunately, that isn’t enough.  Authentication is not working.

I can’t seem to find much documentation on pam and kerberos in FreeBSD.  I have tried to add “debug” to the lines in the /etc/pam.d/sshd and /etc/pam.d/system but if that is adding more logging then I am not seeing it.

BSD Magazine releases its May 2010 Issue.

Hello all,

BSDMag just released the may issue. Get it here.

http://bsdmag.org/magazine/1067-embedded-bsd

fdisk failure re-installing PCBSD 8

Ok, so I have an IBM T40 and I am installed PC-BSD 8.  Then for fun, I downloaded a more recent snapshot (PCBSD 8-Stable) and installed that.

However, woe is me, I ran into this FreeBSD bug: 131087. This prevents me from using my Wireless, which on a laptop is a show stopper.

So I got out the release version of the PCBSD 8 installer and tried to install again, however, now it fails.

Here is the log:

Running: find-update-parts
kern.geom.debugflags: 0 -> 16
Cleaning up ad0
Running: dd if=/dev/zero of=/dev/ad0 count=2048
2048+0 records in
2048+0 records out
1048576 bytes transferred in 0.391058 secs (2681383 bytes/sec)
Running fdisk on ad0
Running: fdisk -I /dev/ad0
fdisk: invalid fdisk partition table found
fdisk: Class not found
******* Working on device /dev/ad0 *******
ERROR: The slice ad0s1 doesn't exist! FDISK Failure
Running: umount /cdmnt-install
umount: /cdmnt-install: statfs: No such file or directory
umount: /cdmnt-install: unknown file system

So obviously something is broke with the partition table.  I am not sure if this can be duplicated but it sure is annoying.
So how do I fix this?  Well, right now I decided to use dd to wipe my drive.

dd if=/dev/zero of=/dev/ad0 bs=4096k

That took something more than an hour and then I reinstalled an all worked fine.

Anyway, I wonder if there is a bug with the installer that caused this or if this is a result of the multiple crashes that occurred due to the iwi bug that causes kernel panic.

PCBSD 8 on an IBM T40

Hello all,

I thought I would share my experiences of using PCBSD 8 on an IBM T40.  I am going to put the information in separate headings, and I am going to document who is responsible for the feature I am talking about by prefacing each line with the responsible party.  If it is a positive experience, the responsible party will be in Green.  If it is a negative experience the responsible party will be in Red.

I am probably going to reinstall and do all this over again with the “snapshot” version and look for any improvements and try to submit any bugs/suggestions to Kris and his team.

IBM T40 Hardware Specs

Intel Pentium M
ATI Radeon Mobility M7 LQ (Mobility Radeon 7500 (fdds)
Intel PRO/Wireless 2200BG
Realtek AC97 Audio
Intel 82801DB PRO/100 VE Network Connection
UltraATA/100 EIDE Controller
34 GB 5400 RPM drive

Installation of PCBSD

9:20 AM started boot process
9:25 AM Finished configuring and clicked “Install”
9:37 AM 47% finished
Sorry, I was pulled away for an hour so I don’t know how long hte install took. I did find an install log, but unfortunately it had no date stamps. I rebooted before I realized that the log file itself might have had a timestamp.

PCBSD: So I don’t know how long the install took but it felt too long. I wonder if there are some tricks that can be done to speed this up.  For example, the install could use an image. It could lay down the image, then extend the last partition to fill the drive, and then modify the key files after the image is laid down, add any packages not included in the image.

Boot options

PCBSD: Adding the “Run X in Vesa mode” as item 6 is pretty cool.
PCBSD: Adding the “Run the Display setup wizard” is nice, so you can try to use a different video card post setup.
PCBSD: Single user mode and other boot options normal to FreeBSD still exist.
PCBSD: Splash screen works (this is an x86 box)
PCBSD: The bootup takes too long, there should be some ways to speed it up.

FreeBSD: I like to have a shorter delay when booting. 10 seconds is too long for me. So I added this to /boot/loader.conf

# Boot Options
autoboot_delay=”3″

Post-install Setup

Update: So I reinstalled because I tried a PC-BSD 8-stable snapshot, but ran into a FreeBSD bug, so I returned to PCBSD 8 release.  On Reinstall, the ATI-3D-Enabled drivers worked, so I am editing this to say so.  I am not sure why they didn’t appear to work the first time.  Maybe because I had tried the Radeon settings first, I don’t know.

PCBSD: On first boot, there was a great interface for configuring Xorg.

PCBSD: This has a Radeon card, but there was no option for Radeon, just ATI or Radeonhd and neither worked really.

  • Tried Radeonhd drivers – both normal and 3D failed to launch Xorg.
  • Tried ATI drivers – both worked but I used the one that enabled 3D features.

Note: I found another solution that added 3D features I wanted. See the Xorg and KDE4 Features section.

Networking

FreeBSD: Wired networking worked using DHCP without me having to do anything.
FreeBSD: Unplugging the wired network and plugging into a different subnet does not automatically cause dhclient to run again.  So in order to get new IP settings, I had to run /etc/netstart as root.  It didn’t work the first time either, I had to run it again.
PCBSD/KDE4: I couldn’t easily find a network tool to configure WIFI. I finally found it under System Settings.
PCBSD/KDE4: Once I did find the Newtork Configuration tool, it was easy to use and I connected to my WPA2 secured wireless network using a D-Link DIR-615 router.  It worked very well and I downloaded a lot with no hiccups.

Sleep/Resume

FreeBSD/ACPI: Put machine to sleep. Worked fine.
FreeBSD/ACPI/moused:
Woke machine up. No mouse. Had to use Ctrl + Alt + F1 to get a command prompt and fix this by restarting the moused daemon.

Note: Added this line before exit 0 in the /etc/rc.resume. This doesn’t resolve the bug, but restarts the mouse so it works, which is a workaround, but workable none-the-less.

/etc/rc.d/moused/restart

PCBSD/FreeBSD: Closing the lid does not put the machine to sleep.

Note: I fixed this by added this line to the /etc/sysctl.conf

hw.acpi.lid_switch_state=S3

After making the above settings, you can run this command to change it in the current booted system so you don’t have to reboot.  But the setting in /etc/sysctl.conf is what makes this persist on reboot.

sysctl -w hw.acpi.lid_switch_state=S3

Random Usability Notes

PCBSD: Ports Console is easily confused with a regular console as Icon Text is not always looked at, I recommend a different icon and naming it Ports Jail. I created this for myself.

KDE4/PCBSD: The fonts were a little off for the four default icons vs the background…but this only seems to be an issue with dark backgrounds.
Shutdown and Reboot works as a regular user by default.
KDE4: After selecting Reboot or Shutdown, there is a hesitation before the shutdown/reboot popup, so I sometimes double click. I don’t like how the shutdown/reboot popup just disappears if a second click occurs with the mouse anywhere but on the shutdown/reboot popup.

Web Usability

Firefox/Flash/FreeBSD: YouTube – Went online and clicked on one of the first videos and it played.

Xorg & KDE4 Features

Update: Do to a reinstall, I noticed that choosing ATI 3D actually worked an enabled 3D features.  I will check on the settings below to see whey they set.
Even though I had a Radeon, only the ATI or ATI 3D drivers worked. The RadeonHd drivers did not work.  Probably because it is an old Radeon and not a new RadeonHd.

Note: I got the Radeon driver to work myself by using the xorg.conf from the ati3d settting and changing the “Device” section to use the settings below. I didn’t make these up on my own, I found them here: http://userweb.cs.utexas.edu/~walter/geek/linux-t40.html#video

Section "Device"
	Identifier	"ATI Radeon"
	Driver	"radeon"
	Option	"DynamicClocks" "on"
	Option	"AGPMode" "4"
	Option	"RenderAccel" "on"
	Option	"EnablePageFlip" "on"
	Option	"BIOSHotkeys" "on"
	BusID	"PCI:1:0:0"
EndSection

After doing this, I got much better settings as described below:

Xorg/KDE4: Konsole supports transparency when using ATI 3D.
Xorg/KDE4/3D: Moving the cursor to the top of the screen will do a cool screen where it shows your configured screen in a line from left to right (four by default though I always change to 3).
Xorg/KDE4/3D: Moving the cursor to the top right corner of the screen will do a cool screen where it shows your configured screens in a 3D object (cube or pyramid).

Ctrl + Alt + Backspace is disabled

Ctrl + Alt + F1 does display the terminal sessions and then:

Alt + F2, F3, F4, …, F8 will all take you to one of the open console terminal sessions.
Alt + F9 returns you to your Xorg seesion

KDE4/PCBSD: Alt + F1 does NOT open the start bar. Right-clicking on the Fireball and choosing Application Launcher settings shows no shortcut, so you can configure it if desired. When I install KDE4 the default is Alt + F1, not None, so I assume this is something PCBSD changed.

KDE4: After selecting Reboot or Shutdown, I don’t like how the reboot option or shutdown option just disappears if I click with the mouse on the desktop.

Software Installation

PCBSD: PBIs make installing software fairly easy.
PCBSD: There are not enough PBIs.
PCBSD: The size of PBIs are HUGE, which is by design, they include every library they need to run, but by design or not, they are huge.
PCBSD: I installed Firefox and Open Office and Pidgin post install because there are updated version to those on disk anyway.

KDE4/Firefox: Firefox prompts every single time I open it to be the default browser. Saying yes appears to do nothing. I manually went to KDE4’s System Settings and change the default application for the web browser to be /Programs/bin/firefox3.sh and this issue stopped.

PCBSD: K3b installed perfected first try.

External Media

PCBSD: K3b burnt a DVD (the latest PC-BSD snapshot) without having to perform any tweak, and for those who know how many tweaks are required when using just FreeBSD and not PC-BSD, you know why this is awesome.

Weirdnesses

Every boot when loading KDE4, the following error displays: The profile “” has been selected but it does not exist.

I plan to update this from time to time with my experiences, so this post is in no way final.

PC-BSD's Ports Console in a jail is cool, but I keep clicking when I want a normal console!

Hello all,

PC-BSD’s Ports Console in a jail is cool, but I keep clicking when I want a normal console!

So today, I got fed up and I drew a new Icon for it:

I then renamed it from Ports Console to Ports Jail.

I’ll never make this mistake again and I think I will suggest this idea on the PC-BSD forums.

Oops!

This didn’t exactly work as expected.  Sure, I never confuse the Icon on the desktop anymore, or in the KDE Menu, but now I have a different problem.  If I open the Jail first, then open the regular Konsole, the icon for the running Konsole and Jail apps in the task bar are both Jail icons. The same in reverse.  If I open Konsole, then open the Jail, the icons for the running Konsole and Jail apps in the task bar are both Konsole icons.

I can’t seem to make this work how I want.

Yep…I now install FreeBSD with PCBSD's Installer

So today, I need to install FreeBSD clean in a VM for testing. I thought, I am going to use the PCBSD 8 install disk because it is faster.

I am sorry, but I am a Sysinstall hater.

Thanks PC-BSD for the much faster installer.

Why Bugzilla fails to authenticate a local user when LDAP integration is failing?

Problem

Authentication fails with the following error even when not using an LDAP user:

Failed to bind to the LDAP server. The error message was: 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 52e, vece�

To me this is a straight up bug.  I am not sure if it is reported.

Cause

Bugzilla will not even try authenticate a local user using another authentication method when LDAP integration is both list first and failing. If LDAP is the first option in the authentication methods, then if the credentials are invalid, it just stops the entire authentication process and returns this error:

Business/Impact

Low.  While this could disallow all logins to the bugzilla web page, including administrator logins.  A server administrator can make a manual change to one of configuration text files.

Resolution

Authentication is configured to use LDAP then DB.  It needs to be reversed, where it tries DB then LDAP.

There is a setting called user_verify_class in Bugzilla that allows you to select the different authentication methods you want to use.  There are two places to access this:

  1. Through the web administration
  2. Through the bugzilla/data/params file

Through Web Administration

Log in as an administrator and go to Administration | Parameters | User Authentication.

Then look for the user_verify_class setting.

Click on DB and click to move it up to the top of the list.

Through the bugzilla/data/params file

Using a text editor, open the params file located under the bugzilla website and under the data folder.

Look for the following line to configure this manually in text:

‘user_verify_class’ => ‘LDAP,DB’,

Change it to:

‘user_verify_class’ => ‘DB,LDAP’,

The user_verify_class setting

This setting allows for enabling and disabling authentication as well as providing the order for enabled authentication methods.

By default only DB is enabled.  But it can be configured so that both DB, and LDAP are enabled and they can be ordered so either is first.  However, LDAP should NOT be first.  The following setting should be used.

‘LDAP,DB’,

How to use relative paths when debugging in Visual Studio 2008?

Hello everyone,

I have a project one computer in the My Documents folder. When I copy it to another user computer (under their My Documents directory) I want it to work with no tweaking.

Do Macros work? No.

My build process uses build events to copy files to an Install directory and since build events uses macros so it works perfectly. I want to use these same Macros in either or both of two debugging options:

  • Start external program
  • Working directory

So I attempt to use the same Macros:

Start external program: $(SolutionDir)\Install\Program.exe

This fails with the following error:

Working Directory:
The working directory you entered does not exist.  Please enter a valid working directory.

Same failure pretty much if I try to use a macro int he Working directory text field.

Well, that is a let down.

Do Environment Variables Work? No.

So I tried to use environment variables. They didn’t work either.

Start external program:    “%USERPROFILE%\My Documents\My Project\Install\Program.exe”

That wasn’t a good solution anyway, cause I want it to work whether copied to a Desktop or a D: drive or whatever.

What can I do?

Well, I loaded up Process Monitor for Sysinterals Suite and checked where we look. I configured it to just look for the executable.

Start external program:    Program.exe

Turns out we check for the executable relative to either of two paths:

  • In the YourProjectDir\bin\debug\Program.exe (or if you are doing a release build, YourProjectDir\bin\release\Program.exe)
  • The current working directory for Visual Studio 2008’s devenv.exe process.
    • Ok, so if Visual Studio 2008 was launched by double-clicking the the solution file, the working directory is the directory the solution file is in.
    • If you open Visual Studio using the Start | All Programs | Microsoft Visual Studio 2008 | Launch Microsoft Visual Studio 2008 shortcut, then the working directory is “C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\” (or the equivalent 32 bit path).

Ok, so it will check relative to the Project directory without putting in a macro if I open Visual Studio by double-clicking the the solution file. I can work with that.

So if I have an Install directory that contains the Program.exe and if I open Visual Studio by double-clicking the the solution file, I can put this in the Start external program:

Start external program:    Install\Program.exe

I left the Working directory blank.

It worked!

To bad if I ever forget to open by double-clicking the the solution file, and I instead use the shortcut it doesn’t work.  But no biggie, I can close and re-open correctly.

What else did I try?

I thought that if I added a relative path, it would check there.  So I should be able to put something like this:

Start external program:   Program.exe
Working Directory:    Install

But the relative path doesn’t work the same way.  Anything put there is only relative to YourProjectDir\bin\debug (or if you are doing a release build, YourProjectDir\bin\release), so this didn’t work.

I tried to use environment variables, but they didn’t work either.

I tried Macros, they didn’t work either.

I tried this:

Start external program:   Program.exe
Working Directory:    ..\..\..\Install

Nope, that didn’t work.

So what is the working directory when debugging/running from Visual Studio 2008?

I loaded up a project with an Install directory and debugging set to run the executable from the install directory.  I added this line to the program and put a break point on it:

string workingDirectory = Directory.GetCurrentDirectory();

The working directory appears to remain this:

YourProjectDir\bin\debug\ (or if you are doing a release build, YourProjectDir\bin\release\)

Oh well.

In a few weeks I am going to try Visual Studio 2010 and I will have to check if they improved this.

K-3D 8 Released!

Hey all,

For those of you who want to work with 3D drawing and animation and can’t afford to buy one of the expensive 3D programs, K-3D is 8 just released.

Get it here:
http://www.k-3d.org/downloads

Are you using BSD or Linux and you don't even know it?

Hello everyone,

I have had two Open Source experiences with average non-geeks that I would like to share.

Experience 1 – The in-laws are using Linux
I spent Easter at my in-laws and while I was their I of course took some time to “fix” their computers. Doing some maintenance to their computers is a regular task for me. However, they had recent purchased a new netbook and it was the only computer that they didn’t need me to work on.

“You got a new Netbook?”, I asked in surprise. Not that they consult me before every purchase but I usually hear about it. “Can I see it?” I asked.

My father-in-law, a retired seminary teacher who does real estate on the side, went and got the new little Netbook.

I booted it up and while the average person couldn’t tell it was running Linux, I immediately recognized the KDE interface despite the fact that it was tweaked to look as much like windows as possible.

I pressed “Ctrl + Alt + Backspace and sure enough Xorg restarted.

The Netbook is a pretty cool system. It is featured more like a smart phone than a computer, in that it has a tabbed window and you have a limited amount of icons on each tab, including needed items such as a browser, a documentation suite (Google Docs), etc…

My son’s grandparents are using Linux and they don’t even know it. While my curiosity told me to figure out how to enable the root account and start hacking around, I pushed aside the temptation because it was pleasure enough to know that my predictions are coming true.

I said, “By 2010, Linux will be above the watermark of requirements for the majority of users, and will start taking the market by storm.” And I am telling you it has begun.

Well, you might argue that this one purchase by my grandparents doesn’t mean this is true.

Well, I would retort that it isn’t just this one incident.

  • Netbooks are very popular and selling fairly well among all walks of life, not just to my grandparents.
  • There are many Google phones that are running Android, based on the Linux kernel.
  • Slashdot has a story where Ubuntu is claiming 12 million users and Fedora claims 24 million.
  • My company, LANDesk, continues to get an increased amount of request to support Linux flavors.

Experience 2 – A friend of a friend needing to compile an open source app on OS X
My favorite Operating System is FreeBSD, which has a great desktop version PC-BSD. While these are not exactly Linux, they are open source and actually more free than Linux (see my post on licenses). The rise in the use of FreeBSD and PC-BSD is also increasing rapidly.

Windows is the most used operating system by far. Did you know that the second most used operating system is FreeBSD-based. Yes, Macintosh users, underneath the hood of your pretty graphical user interface (GUI), you have a system that is derived in a large amount from FreeBSD.

Yes, if you are running OS X, you are running a system that is, underneath the hood, very similar to FreeBSD. It has a nice ports system called MacPorts that is a very similar system to FreeBSD’s ports system.

Well, as a replacement for a Visio diagram, I used the program Dia so that some of my friends could have the ability to modify and change the diagram (which happens about once a quarter) as desired without spending way too much for Visio when they otherwise would never ever use it. Well, a friend of a friend called me and wanted to use it.

Unfortunately at this time, Dia doesn’t have a version for OS X, but can be installed using MacPorts. So I found myself showing the average user how to install MacPorts. Unfortunately, I don’t have a Mac, so I couldn’t write a walk-thru of doing this and I don’t know if the friend of a friend was successful in installing Dia on OS X, but still, this average user wanted to do it and wanted this open source app that was available to him only because his system was derived in large part from FreeBSD.

GhostBSD: A FreeBSD desktop that uses GNOME

Hey all,

I was recently made aware of a new distribution of FreeBSD called GhostBSD. One of the focuses of GhostBSD is to provide a FreeBSD-based desktop that uses GNOME.

I’ll be honest, I like KDE over GNOME and probably always will, but my opinion is not your opinion, and I have heard plenty of opinions amongst FreeBSD users that GNOME is preferred by them. So this is going to be a good thing for those of you who prefer GNOME.

They have released their first amd64 version, which I downloaded and installed to my VMWare environment. Here is a screen shot.


See larger image.

I was pleased to find that it was a Live CD, as well, until I realized that it was a Live CD only. There are such a large number of people who have asked about a FreeBSD distro that focus on the desktop using GNOME, that I was actually disappointed to find out that it does not install to the hard drive. However, if this distribution becomes popular, I am sure that the distribution could eventually include an installer.

It downloads and fits on one CD (not DVD) and so the download was rather quick for me.

I installed to my VMWare environment, however, the keyboard didn’t work. Maybe the i386 version would work. It might be worth detecting why this didn’t work and submitting a bug to GhostBSD. It would also be cool if they provided a version that had vmware-tools installed. I am not sure if I could install vmware-tools to a Live CD and if I did, it would probably only be installed until I rebooted.

Great work GhostBSD team. As FreeSBIE is discontinued according to Distrowatch, I will definitely replace my Live CD version of FreeBSD and GhostBSD may be an excellent option.

Differences between the BSD/FreeBSD Copyrights and the GNU Public License (GPL)

The FreeBSD Copyright and the BSD Copyright

You may notice that FreeBSD uses the term Copyright while GNU uses the term License.
http://www.freebsd.org/copyright/copyright.html

The FreeBSD Copyright is free as in you don’t have to buy a license but you can do pretty much anything. The BSD Copyright is almost the same.

What you can do:

  1. Use it at home for no cost.
  2. Use it at work for no cost.
  3. Use it at work for a publicly accessible server that you make money on for no cost.
  4. Add or change code at no cost.
  5. Distribute the entire source code at no cost.
  6. Distribute the entire source code with your changes at no cost.
  7. Build binaries at no cost.
  8. Distribute binaries with your source at no cost if you also give it away at no cost.
  9. Distribute binaries without also distributing the original source and your changes.
  10. Write code that uses or links to this code and license your new code however you want.
  11. Embed the binaries in software you sell, at no cost, even if you don’t provide the source.

Note: This list was created by me based on my understanding of what people would want to do with the code.

Do I need a lawyer?
No. Basically, there is almost no instance in which you have to pay a fee to anybody to use a FreeBSD Copyrighted or BSD Copyrighted piece of code.

However, while 100% free in cost to use it, it is not 100% free. Notice I italicized the word almost in the above sentence.

For the FreeBSD Copyright, also known as the New BSD Copyright, there are two requirements you must meet.

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

And for the BSD Copyright, there are four requirements listed, but as mentioned on the BSD Copyright web site, the third requirement is no longer required.

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software must display the following acknowledgement:

This product includes software developed by the University of California, Berkeley and its contributors.

4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

So you can do anything you want with FreeBSD licenses and BSD licenses at no dollar cost, but you have to spend some time and resources to make sure you display some text as required.

I guess if you didn’t want to follow the 2 or 4 steps, you could find someone to pay so you didn’t have to, but the steps are so simple I doubt anyone would choose to try to license the software to not have to follow these steps.

The The GNU Public License or GPL

The The GNU Public License or GPL is not completely different but yet don’t be fooled. It is not the same and is far more restrictive than most realize. And it is harder to explain or describe, especially since there is GPLv1, GPLv2, GPLv3, and I am not even discussing the LGPL here.

You can get more info here:
A Quick Guide to GPLv3

What you can do:

  1. Use it at home for no cost.
  2. Use it at work for no cost.
  3. Use it at work for a publicly accessible server that you make money on for no cost.
  4. Add or change code at no cost.
  5. Distribute the entire source code at no cost.
  6. Distribute the entire source code with your changes at no cost.
  7. Build binaries at no cost.
  8. Distribute binaries with your source at no cost if you also give it away at no cost.

Do I need a lawyer?
For home use, no.
For a business, yes.

If you are doing anything NOT on the above list, you probably need to involve a lawyer. If you stick to the above list, then no, you probably don’t need a lawyer. However, the GPL is so long and wordy you may need a lawyer to determine if you need a lawyer.

The Difference between the BSD/FreeBSD Copyrights and the The GNU Public License or GPL

The first noticeable difference is that the FreeBSD Copyright is 25 lines (when wrapped at 78 characters with some lines blank due to section separation) while the GPL is 339 lines (when wrapped at 78 characters with some lines blank due to section separation). So it is much more difficult to learn and understand the GPL and there is a higher likelihood to take a wrong step.

The following items were removed these from the GPL’s can-do list because you can’t do them without permission from the author, which most likely will come at a cost but not always. Sometimes, the author will just say, “Yes, you can use it in your proprietary software” and sometimes they will charge a fee. However, even in those instances you probably need to pay a lawyer to draft and agreement and get it signed. However, one problem with GPL is that there are usually many different authors and so obtaining such permission becomes impossible.

  1. Distribute binaries without also distributing the original source and your changes.
  2. Write code that uses or links to this code and license your new code however you want.
  3. Embed the binaries in software you sell, at no cost, even if you don’t provide the source.

Lets put this in a table:

What you can do? BSD/FreeBSD Copyright GNU Public License or GPL
1. Use it at home for no cost. x x
2. Use it at work for no cost. x x
3. Use it at work for a publicly accessible server than you make money on for no cost. x x
4. Add or change code at no cost. x x
5. Distribute the entire source code at no cost. x x
6. Distribute the entire source code with your changes at no cost. x x
7. Build binaries at no cost. x x
8. Distribute binaries with your source at no cost if you also give it away at no cost. x x
9. (Commercial) Distribute binaries without also distributing the original source and your changes. x
10. (Commercial) Write code that uses or links to this code and license your new code however you want. x
11. (Commercial) Embed the binaries, without a license fee, in software you sell, even if you don’t provide the source. x

Conclusion

For use at home or work or school or play
In all practicallity there is no difference to a home user between the BSD/FreeBSD Copyrights and the GPL.

For Free Distribution
There is one slight difference in free distribution. Any code you write that uses GPL code must be GPL too. With the BSD/FreeBSD copyright, that is not the case. If you write software that uses or links to BSD licensed software, you can still choose your own license.

For Commercial and Enterprise Use
This is where the difference mainly resides between these two licenses.

For use internally for an enterprise or any use that doesn’t distribute the code, there is no difference.

However, when it comes to including the code or a binary in software that you sell, you are not free to do so. The BSD/FreeBSD Copyrights are much more business and enterprise friendly.

DISCLAIMER

I am not a lawyer. I am not responsible in any way for the misuse of a license based on this post, even if the post is has some piece of data that is blatantly wrong. It is the responsibility of the user of licensed or copyrighted software to make sure the license agreement or copyright is adhered to properly.