Why does VMWare guests lose network access constantly on Windows 7 64 bit?

I have a problem with VMWare

PROBLEM

My VMWare guests lose network access constantly on Windows 7 64 bit. This happens sometimes within an hour and sometimes longer. I haven’t really tracked that well.

The first step to troubleshooting is identifying the problem…then next is gathering data, so lets analyze what I have.

Setup

Operating System: Windows 7 64 bit
VMWare version: Workstation 6.5.3

Processor: Core 2 Quad
Memory: 8 GB

Physical cards
1 GB Ethernet
1 Wireless

VMNet0 – Bridged
VMNet1 – Host only
VMNet8 – NAT

Do I need three networks? Could that be problematic? According to this article it could be on Vista 64 bit, and that may hold true for Windows 7 64 bit.
http://communities.vmware.com/message/1137694;jsessionid=407F88A83287FEE2B3B60EC22A592ACB

Ok, so I really only need VMNet0 as I always plan to bridge in this environment. In other environments I might not though. I also have never remove these, but I am going to try it.

ACTIONS:
1. Deleted VMNet1
2. Deleted VMNet8
Note: I deleted those using the Virtual Network Editor | Host Virtual Adapters tab.

Settings
So I started looking at settings to see if there is a setting that doesn’t look right.

Found this setting: Automatic bridging

My problem may be the Automatic bridging settings, since mine is disabled and VMNet0 was configured to use the wireless adapter. I am only using the Ethernet adapter but even though it is a desktop, my PC came with a wireless card, which I am not going to use.

ACTIONS:
1. On the Virtual Network Editor | Automatic Bridging tab, I unchecked the automatic bridging option to disable it.
2. On the Virtual Network Editor | Host Virtual Network Mapping, changed VMNet0 to to be statically mapped to my physical wired Ethernet controller.
3. In windows, I went to my network settings and disabled my wireless network card, since I am not going to use it.

So here goes the test…lets see if my VMWare guest operatings system lose their networking capability.

UDPATE 7:48 AM 12/9/2009

Well, my network wasn’t working last night…so I would have to say the steps above didn’t NOT resolve the issue. Time to continue troubleshooting.

I now have configured the vmnat.exe and vmentdhcp.exe to be allowed in the firewall always.

UDPATE 7:48 AM 1/18/2010
So the three networks somehow came back. I removed them again and this time they stayed gone. This was about a month ago and my virtual hosts’ haven’t lost network access since.


How to convert an XP SP3 Home Retail CD to an XP SP3 Home OEM CD? (Using all free software)

Ok, so I have a legal XP OEM license on an Gateway T2692.

Note: I do NOT believe in doing anything illegal, so an requests for Keys will be ignored and your comment will be deleted.

Problems:

  1. The motherboard died and I replaced it.
  2. The restore CD was an image not the install files and it failed with a blue screen.
  3. I don’t have an OEM XP CD.

So I read that I can easily convert an XP Retail disk to an XP OEM disk, so here it goes.

Step 1 – Modifying the Originally CD Files

  1. Copy the XP HOME w/SP3 Retail disk contents to a folder.
  2. Copythe i386\SETUPP.INI file to SETUPP.INI.RETAIL
  3. Edit the i386\SETUPP.INI file.

    Change it from this: (SETUPP.INI for Retail Versions)

    [Pid]
    ExtraData=786F687170637175716954806365EF
    Pid=76477000
    

    To this: (SETUPP.INI for OEM Versions)

    [Pid]
    ExtraData=786F687170637175716954806365EF
    Pid=76477OEM
    

Here is a resource I used: http://www.mydigitallife.info/2009/08/16/how-to-change-windows-xp-version-between-retail-oem-and-volume-license-channel/

Note: Make sure you save your changes. You don’t won’t to burn the disk only to find you didn’t make the change and you still have a retail disk.

That should be enough to change the files of the CD into an OEM instead of a Retail disk.

Step 2 – Extract the boot sector

  1. Download and extract a boot sector extraction tool such as: http://www.nu2.nu/bbie/
  2. My drive was drive F:, so I ran bbie with the following syntax: (In Windows 7, I had to open the command prompt as administrator.)

    bbie.exe f:

  3. Copy the image1.bin to the directory where you copied your XP CD files.

You now have the boot sector extracted.

Step 3 – Building and Burning the CD

  1. You need burning software that will create a bootable XP CD. If you don’t have burning software, download and install http://cdburnerxp.se, which is what I am going to use, but Nero and other burning applications can do this as well.
  2. Open your burning software and choose the option to create a new data disc.
  3. Name your new disk this: GRTMHOEM_EN
  4. From the CDBurnerXP menu, click on Disk | Boot options and configure your boot options as follows:
    Use the image1.bin file.
    Emulation Type = No Emulation (NT/2000/XP boot images)
    ISO Level = ISO9660:1999 (unrestricted)
    Load Segments = 7C0 (or 07C0, same thing)
    Loaded Sectors = 4
    Enable [Check] ISO version number extension
    Disable [Uncheck] Enforce level 1

  5. Now from the folder where your disk files were extracted, drag all the files to the new data disk.

    Yes, I did follow this guide, so you have to give credit where credit is due: http://www.dtraylor.com/blog/?page_id=40

  6. Make sure you have a blank CD in the drive.
  7. Click Burn.
  8. Select Let me choose Advanced Settings.
  9. Choose Disk at once.
  10. Click Burn Disk.

You now have a working XP Home w/SP3 OEM CD.

Step 4 – Testing the CD

  1. Boot off the CD and run through the installer.
  2. Enter the OEM product key when prompted.
  3. If it works, you really have an OEM CD, if not you don’t.

I have to be honest, even though I knew the right settings I clicked one of them wrong the first time and made a coaster out of my CD. But I repeated my steps and the CD booted.

SWEET, MY OEM KEY WORKED!!!!!!!!!!!!!!!!!!!!!!


What is the syntax for the switch and case statement in C++?

The switch statement is often a good alternate for multiple if..else if...else statements.

switch (expression)
{
  case someConstantValue1 :
    // Your code goes here...
    break;
 case  someConstantValue2:
    // Your code goes here...
    break;
}

So lets look at this using an integer variable intValue and we will show you some other syntax capabilities.

switch (intValue) {

  case 1 :
    // Your code goes here...
    break;

  case 2 :
    // Your code goes here...
    break;

  case 3 :
  case 4 :
    // Both options 3 and 4 will run the same code
    // Your code goes here...
    break;

  case 10 :
  case 5 :
    // The options don't have to be in order but you may want to keep them order because you can.
    // Your code goes here...
    break;

  default :
    // Anything that doesn't match will run this code.
    // Your code goes here...
    break;
}

Keywords: C++ switch case break syntax


What files are required to create a theme for dotProject 2.1.2?

Ok, so I want to create a theme for dotProject. I love doing something for open source projects but it is never easy. So much is not documented.

I would imagine that since dotProject is free, it would be worth it to a company to pay for some customization and some really shiny themes. I know another open source project, SquirrellMail, has a lot of themes that can be purchased out there.

So I am going to look at the three themes that come with dotProject by default and determine what it takes to make my own.

Files in a dotProject Theme

So each them appears to have most of the following files (though each theme does not have all files):

  • footer.php
  • header.php
  • images (directory)
  • index.html
  • login.php
  • lostpass.php
  • main.css
  • overrides.php

So the only directory is the images directory. So what images does it usually contain? I usually contains the following files in general. Some contain more, some less. Some similar files with different names. But that gives you a basic idea.

  • dp_icon.gif
  • favicon.ico
  • index.html
  • obj (directory)
  • titlegrad.jpg
  • tabBg.png
  • tabLeft.png
  • tabRight.png
  • tabSelectedBg.png
  • tabSelectedLeft.png
  • tabSelectedRight.png

Again, there is often a directory in images called obj. The obj directory has the following files.

  • index.html
  • tick.gif

Well, that is pretty much it for the file structure of a dotProject theme.

So lets look at the common files and what is in them? However, how should we group them? How about by extension first, then by name:

HTML File (Optional)

There is only one, but it is in each folder, and as I suspected, it is optional.

  1. index.html – Ok, so why are there these random index.html files? They all only contain one line:
    <html><body bgcolor="#FFFFFF"></body></html>
    

    I have to say that these index.html files are for no other reason that to prevent directory browsing, which should probably be done by a security setting in your web server, so these files are completely optional.

CSS File (Required)

There appears to be only one CSS file, but that doesn’t mean you can’t have multiple CSS files in your theme. However, this is probably the most important file for your theme, so obviously it is required.

  1. main.css – This is of course the file that determines all the style information for the web page. Each HTML element has a style and this is where you change it.

PHP Files – (Requirements unknown)

  1. footer.php – By the name, you can tell this script has to do with the footer of your web page.

    There doesn’t seem to be much variation on this file. It seems to usually have the following script:

    <?php
    	echo $AppUI->getMsg();
    ?>
    	</td>
    </tr>
    </table>
    </body>
    </html>
    
  2. header.php – This file is a lot more complex and has over 100 lines in each theme I have looked at. It will take some time to see what is required. It looks like this is actually both the header and the body. The body appears to be formatted with an HTML table instead of using CSS. So here is the code from the default theme.
    <?php /* STYLE/DEFAULT $Id: header.php 5544 2007-11-27 01:04:12Z merlinyoda $ */
    if (!defined('DP_BASE_DIR')) {
    	die('You should not access this file directly');
    }
    $dialog = dPgetParam( $_GET, 'dialog', 0 );
    if ($dialog)
    	$page_title = '';
    else
    	$page_title = ($dPconfig&#91;'page_title'&#93; == 'dotProject') ? $dPconfig&#91;'page_title'&#93; . '&nbsp;' . $AppUI->getVersion() : $dPconfig['page_title'];
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    	   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    	<meta name="Description" content="dotProject Default Style" />
    	<meta name="Version" content="<?php echo @$AppUI->getVersion();?>" />
    	<meta http-equiv="Content-Type" content="text/html;charset=<?php echo isset( $locale_char_set ) ? $locale_char_set : 'UTF-8';?>" />
    	<title><?php echo @dPgetConfig( 'page_title' );?></title>
    	<link rel="stylesheet" type="text/css" href="./style/<?php echo $uistyle;?>/main.css" media="all" />
    	<style type="text/css" media="all">@import "./style/<?php echo $uistyle;?>/main.css";</style>
    	<link rel="shortcut icon" href="./style/<?php echo $uistyle;?>/images/favicon.ico" type="image/ico" />
    	<?php @$AppUI->loadJS(); ?>
    </head>
    
    <body onload="this.focus();">
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
    	<td><table width="100%" cellpadding="3" cellspacing="0" border="0"><tr>
    	<th background="style/<?php echo $uistyle;?>/images/titlegrad.jpg" class="banner" align="left"><strong><?php
    		echo "<a style='color: white' href='{$dPconfig&#91;'base_url'&#93;}'>$page_title</a>";
    	?></strong></th>
    	<th align="right" width='50'><a href='http://www.dotproject.net/' <?php if ($dialog) echo "target='_blank'"; ?>><img src="style/<?php echo $uistyle;?>/images/dp_icon.gif" border="0" /></a></th>
    	</tr></table></td>
    </tr>
    <?php if (!$dialog) {
    	// top navigation menu
    	$nav = $AppUI->getMenuModules();
    	$perms =& $AppUI->acl();
    ?>
    <tr>
    	<td class="nav" align="left">
    	<table width="100%" cellpadding="3" cellspacing="0">
    	<tr>
    		<td>
    		<?php
    		$links = array();
    		foreach ($nav as $module) {
    			if ($perms->checkModule($module['mod_directory'], 'access')) {
    				$links[] = '<a href="?m='.$module&#91;'mod_directory'&#93;.'">'.$AppUI->_($module['mod_ui_name']).'</a>';
    			}
    		}
    		echo implode( ' | ', $links );
    		echo "\n";
    		?>
    		</td>
    		<td nowrap="nowrap" align="right">
    		<form name="frm_new" method=GET action="./index.php">
    		<table cellpadding="0" cellspacing="0">
    		<tr><td>
    <?php
    	$newItem = array( 0=>'- New Item -' );
    	if ($perms->checkModule( 'companies', 'add' )) $newItem["companies"] = "Company";
    	if ($perms->checkModule( 'contacts', 'add' )) $newItem["contacts"] = "Contact";
    	if ($perms->checkModule( 'calendar', 'add' )) $newItem["calendar"] = "Event";
    	if ($perms->checkModule( 'files', 'add' )) $newItem["files"] = "File";
    	if ($perms->checkModule( 'projects', 'add' )) $newItem["projects"] = "Project";
    
    	echo arraySelect( $newItem, 'm', 'style="font-size:10px" onChange="f=document.frm_new;mod=f.m.options[f.m.selectedIndex].value;if(mod) f.submit();"', '', true);
    
    	echo "        <input type=\"hidden\" name=\"a\" value=\"addedit\" />\n";
    
    //build URI string
    	if (isset( $company_id )) {
    		echo '<input type="hidden" name="company_id" value="'.$company_id.'" />';
    	}
    	if (isset( $task_id )) {
    		echo '<input type="hidden" name="task_parent" value="'.$task_id.'" />';
    	}
    	if (isset( $file_id )) {
    		echo '<input type="hidden" name="file_id" value="'.$file_id.'" />';
    	}
    ?>
    		</td></tr>
    		</table>
    		</form>
    		</td>
    	</tr>
    	</table>
    	</td>
    </tr>
    <tr>
    	<td>
    		<table cellspacing="0" cellpadding="3" border="0" width="100%">
    		<tr>
    			<td width="100%"><?php echo $AppUI->_('Welcome').' '.$AppUI->user_first_name.' '.$AppUI->user_last_name; ?></td>
    			<td nowrap="nowrap">
    				<?php echo dPcontextHelp( 'Help' );?> |
    				<a href="./index.php?m=admin&a=viewuser&user_id=<?php echo $AppUI->user_id;?>"><?php echo $AppUI->_('My Info');?></a> |
    <?php
    	if ($perms->checkModule('calendar', 'access')) {
    		$now = new CDate();
    ?>                              <b><a href="./index.php?m=tasks&a=todo"><?php echo $AppUI->_('Todo');?></a></b> |
    				<a href="./index.php?m=calendar&a=day_view&date=<?php echo $now->format( FMT_TIMESTAMP_DATE );?>"><?php echo $AppUI->_('Today');?></a> |
    <?php } ?>
    				<a href="./index.php?logout=-1"><?php echo $AppUI->_('Logout');?></a>
    			</td>
    		</tr>
    		</table>
    	</td>
    </tr>
    <?php } // END showMenu ?>
    </table>
    
    <table width="100%" cellspacing="0" cellpadding="4" border="0">
    <tr>
    <td valign="top" align="left" width="98%">
    <?php
    	echo $AppUI->getMsg();
    ?>
    
  3. login.php – These all seem to be a login web page and each seem to have almost the exact same code.
    <?php /* STYLE/DEFAULT $Id: login.php 4842 2007-03-17 15:56:19Z caseydk $ */
    if (!defined('DP_BASE_DIR')) {
    	die('You should not access this file directly');
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    	   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    	<title><?php echo $dPconfig&#91;'page_title'&#93;;?></title>
    	<meta http-equiv="Content-Type" content="text/html;charset=<?php echo isset( $locale_char_set ) ? $locale_char_set : 'UTF-8';?>" />
           	<title><?php echo $dPconfig&#91;'company_name'&#93;;?> :: dotProject Login</title>
    	<meta http-equiv="Pragma" content="no-cache" />
    	<meta name="Version" content="<?php echo @$AppUI->getVersion();?>" />
    	<link rel="stylesheet" type="text/css" href="./style/<?php echo $uistyle;?>/main.css" media="all" />
    	<style type="text/css" media="all">@import "./style/<?php echo $uistyle;?>/main.css";</style>
    	<link rel="shortcut icon" href="./style/<?php echo $uistyle;?>/images/favicon.ico" type="image/ico" />
    </head>
    
    <body bgcolor="#f0f0f0" onload="document.loginform.username.focus();">
    <br /><br /><br /><br />
    <?php //please leave action argument empty ?>
    <!--form action="./index.php" method="post" name="loginform"-->
    <form method="post" action="<?php echo $loginFromPage; ?>" name="loginform">
    <table align="center" border="0" width="250" cellpadding="6" cellspacing="0" class="std">
    <input type="hidden" name="login" value="<?php echo time();?>" />
    <input type="hidden" name="lostpass" value="0" />
    <input type="hidden" name="redirect" value="<?php echo $redirect;?>" />
    <tr>
    	<th colspan="2"><em><?php echo $dPconfig&#91;'company_name'&#93;;?></em></th>
    </tr>
    <tr>
    	<td align="right" nowrap><?php echo $AppUI->_('Username');?>:</td>
    	<td align="left" nowrap><input type="text" size="25" maxlength="255" name="username" class="text" /></td>
    </tr>
    <tr>
    	<td align="right" nowrap><?php echo $AppUI->_('Password');?>:</td>
    	<td align="left" nowrap><input type="password" size="25" maxlength="32" name="password" class="text" /></td>
    </tr>
    <tr>
    	<td align="left" nowrap><a href="http://www.dotproject.net/"><img src="./style/default/images/dp_icon.gif" border="0" alt="dotProject logo" /></a></td>
    	<td align="right" valign="bottom" nowrap><input type="submit" name="login" value="<?php echo $AppUI->_('login');?>" class="button" /></td>
    </tr>
    <tr>
    	<td colspan="2"><a href="#" onclick="f=document.loginform;f.lostpass.value=1;f.submit();"><?php echo $AppUI->_('forgotPassword');?></a></td>
    </tr>
    </table>
    <?php if (@$AppUI->getVersion()) { ?>
    <div align="center">
    	<span style="font-size:7pt">Version <?php echo @$AppUI->getVersion();?></span>
    </div>
    <?php } ?>
    </form>
    <div align="center">
    <?php
    	echo '<span class="error">'.$AppUI->getMsg().'</span>';
    
    	$msg = '';
    	$msg .=  phpversion() < '4.1' ? '<br /><span class="warning">WARNING: dotproject is NOT SUPPORT for this PHP Version ('.phpversion().')</span>' : '';
    	$msg .= function_exists( 'mysql_pconnect' ) ? '': '<br /><span class="warning">WARNING: PHP may not be compiled with MySQL support.  This will prevent proper operation of dotProject.  Please check you system setup.</span>';
    	echo $msg;
    ?>
    </div>
    <center><?php echo "* ".$AppUI->_("You must have cookies enabled in your browser"); ?></center>
    </body>
    </html>
    
  4. lostpass.php – These all seem to be a full web page to provide a lost password interface and each seem to have almost the exact same code.
    <?php /* STYLE/DEFAULT $Id: lostpass.php 4771 2007-02-18 03:06:27Z ajdonnison $ */
    if (!defined('DP_BASE_DIR')) {
    	die('You should not access this file directly');
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    	   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    	<title><?php echo @dPgetConfig( 'page_title' );?></title>
    	<meta http-equiv="Content-Type" content="text/html;charset=<?php echo isset( $locale_char_set ) ? $locale_char_set : 'UTF-8';?>" />
           	<title><?php echo $dPconfig&#91;'company_name'&#93;;?> :: dotProject Login</title>
    	<meta http-equiv="Pragma" content="no-cache" />
    	<meta name="Version" content="<?php echo @$AppUI->getVersion();?>" />
    	<link rel="stylesheet" type="text/css" href="./style/<?php echo $uistyle;?>/main.css" media="all" />
    	<style type="text/css" media="all">@import "./style/<?php echo $uistyle;?>/main.css";</style>
    	<link rel="shortcut icon" href="./style/<?php echo $uistyle;?>/images/favicon.ico" type="image/ico" />
    </head>
    
    <body bgcolor="#f0f0f0" onload="document.lostpassform.checkusername.focus();">
    <br /><br /><br /><br />
    <?php //please leave action argument empty ?>
    <!--form action="./index.php" method="post" name="loginform"-->
    <form method="post" name="lostpassform">
    <table align="center" border="0" width="250" cellpadding="6" cellspacing="0" class="std">
    <input type="hidden" name="lostpass" value="1" />
    <input type="hidden" name="redirect" value="<?php echo $redirect;?>" />
    <tr>
    	<th colspan="2"><em><?php echo $dPconfig&#91;'company_name'&#93;;?></em></th>
    </tr>
    <tr>
    	<td align="right" nowrap><?php echo $AppUI->_('Username');?>:</td>
    	<td align="left" nowrap><input type="text" size="25" maxlength="20" name="checkusername" class="text" /></td>
    </tr>
    <tr>
    	<td align="right" nowrap><?php echo $AppUI->_('EMail');?>:</td>
    	<td align="left" nowrap><input type="email" size="25" maxlength="64" name="checkemail" class="text" /></td>
    </tr>
    <tr>
    	<td align="left" nowrap><a href="http://www.dotproject.net/"><img src="./style/default/images/dp_icon.gif" width="120" height="20" border="0" alt="dotProject logo" /></a></td>
    	<td align="right" valign="bottom" nowrap><input type="submit" name="sendpass" value="<?php echo $AppUI->_('send password');?>" class="button" /></td>
    </tr>
    </table>
    <?php if (@$AppUI->getVersion()) { ?>
    <div align="center">
    	<span style="font-size:7pt">Version <?php echo @$AppUI->getVersion();?></span>
    </div>
    <?php } ?>
    </form>
    <div align="center">
    <?php
    	echo '<span class="error">'.$AppUI->getMsg().'</span>';
    
    	$msg = '';
    	$msg .=  phpversion() < '4.1' ? '<br /><span class="warning">WARNING: dotproject is NOT SUPPORT for this PHP Version ('.phpversion().')</span>' : '';
    	$msg .= function_exists( 'mysql_pconnect' ) ? '': '<br /><span class="warning">WARNING: PHP may not be compiled with MySQL support.  This will prevent proper operation of dotProject.  Please check you system setup.</span>';
    	echo $msg;
    ?>
    </div>
    </body>
    </html>
    
  5. overrides.php – I will have to analyze this more to see what it is for. The code looks pretty similar in each file, though the files are slightly different lengths.
    <?php /* STYLE/DEFAULT $Id: overrides.php 5725 2008-06-02 16:20:34Z merlinyoda $ */
    
    if (!defined('DP_BASE_DIR')) {
    	die('You should not access this file directly');
    }
    class CTitleBlock extends CTitleBlock_core {
    }
    
    ##
    ##  This overrides the show function of the CTabBox_core function
    ##
    class CTabBox extends CTabBox_core {
    	function show( $extra='', $js_tabs = false ) {
    		GLOBAL $AppUI, $dPconfig, $currentTabId, $currentTabName;
    		$uistyle = ($AppUI->getPref( 'UISTYLE' )
    		            ? $AppUI->getPref( 'UISTYLE' )
    		            : (($dPconfig['host_style']) ? $dPconfig['host_style'] : 'default'));
    		reset( $this->tabs );
    		$s = '';
    
    		// tabbed / flat view options
    		if (@$AppUI->getPref( 'TABVIEW' ) == 0) {
    			$s .= '<table border="0" cellpadding="2" cellspacing="0" width="100%">' . "\n";
    			$s .= "<tr>\n";
    			$s .= '<td nowrap="nowrap">' . "\n";
    			$s .= '<a href="' . $this->baseHRef . 'tab=0">' . $AppUI->_('tabbed') . '</a> : ';
    			$s .= '<a href="' . $this->baseHRef . 'tab=-1">' . $AppUI->_('flat') . '</a>' . "\n";
    			$s .= "</td>\n" . $extra . "\n</tr>\n</table>\n";
    			echo $s;
    		} else {
    			if ($extra) {
    				echo ('<table border="0" cellpadding="2" cellspacing="0" width="100%">'
    				      . "\n<tr>\n" . $extra . "</tr>\n</table>\n");
    			} else {
    				echo '<img src="./images/shim.gif" height="10" width="1" alt="" />' . "\n";
    			}
    		}
    
    		if ($this->active < 0 || @$AppUI->getPref( 'TABVIEW' ) == 2 ) {
    			// flat view, active = -1
    			echo '<table border="0" cellpadding="2" cellspacing="0" width="100%">' . "\n";
    			foreach ($this->tabs as $k => $v) {
    				echo '<tr><td><strong>'.($v[2] ? $v[1] : $AppUI->_($v[1]))."</strong></td></tr>\n";
    				echo '<tr><td>';
    				$currentTabId = $k;
    				$currentTabName = $v[1];
    				include $this->baseInc.$v[0].".php";
    				echo "</td></tr>\n";
    			}
    			echo "</table>\n";
    		} else {
    			// tabbed view
    			$s = '<table width="100%" border="0" cellpadding="0" cellspacing="0">' . "\n";
    			$s .= '<tr><td>' . "\n" .'<table border="0" cellpadding="0" cellspacing="0"><tr>' . "\n";
    
    			if ( count($this->tabs)-1 < $this->active ) {
    				//Last selected tab is not available in this view. eg. Child tasks
    //				$this->active = 0;
    			}
    			foreach( $this->tabs as $k => $v ) {
    				$class = ($k == $this->active) ? 'tabon' : 'taboff';
    				$sel = ($k == $this->active) ? 'Selected' : '';
    				$s .= '<td valign="middle"><img src="./style/' . $uistyle . '/images/tab' . $sel . 'Left.png" id="lefttab_' . $k .'" border="0" alt="" /></td>' . "\n";
    				$s .= '<td id="toptab_'.$k.'" valign="middle" nowrap="nowrap"';
    
    				$s .= (($js_tabs)
    					   ? (' class="' . $class . '"')
    					   : (' background="./style/' . $uistyle . '/images/tab' . $sel . 'Bg.png"'));
    				$s .= '>&nbsp;<a href="';
    
    				if ($this->javascript) {
    					$s .= "javascript:" . $this->javascript . "({$this->active}, $k)";
    				} else if ($js_tabs) {
    					$s .= 'javascript:show_tab(' . $k . ')';
    				} else {
    					$s .= $this->baseHRef.'tab='.$k;
    				}
    
    				$s .='">'.(($v[2]) ? $v[1] : $AppUI->_($v[1])).'</a>&nbsp;</td>' . "\n";
    				$s .= ('<td valign="middle"><img id="righttab_' . $k . '" src="./style/' . $uistyle . '/images/tab'
    					   . $sel . 'Right.png" border="0" alt="" /></td>' . "\n");
    				$s .= '<td class="tabsp"><img src="./images/shim.gif" height="1" width="3" /></td>' . "\n";
    			}
    			$s .= '</tr></table>' . "\n" .'</td></tr>' . "\n";
    			$s .= '<tr><td width="100%" colspan="'.(count($this->tabs)*4 + 1).'" class="tabox">' . "\n";
    			echo $s;
    			//Will be null if the previous selection tab is not available in the new window eg. Children tasks
    			if ( $this->tabs[$this->active][0] != "" ) {
    				$currentTabId = $this->active;
    				$currentTabName = $this->tabs[$this->active][1];
    				if (!$js_tabs)
    					require $this->baseInc.$this->tabs[$this->active][0].'.php';
    			}
    			if ($js_tabs)
    			{
    				foreach( $this->tabs as $k => $v )
    				{
    					echo '<div class="tab" id="tab_'.$k.'">';
    					$currentTabId = $k;
    					$currentTabName = $v[1];
    					require $this->baseInc.$v[0].'.php';
    					echo '</div>';
    					echo ('<script language="JavaScript" type="text/javascript">' . "\n"
    						  . '//<!--' . "\n"
    						  . 'show_tab('.$this->active.');' . "\n"
    						  . '//-->' . "\n"
    						  . '</script>');
    				}
    			}
    			echo '</td></tr>' . "\n" . '</table>' . "\n";
    		}
    	}
    }
    ?>
    

Image files, gif, jpg, png

These are all just images. You can change them if you want. The image type doesn’t have to remain constant. If you do change them, your theme will be noticeably different.

  1. Tab Images – These are images for the tabs you click on at the top of the web page.
    • tabBg.png
    • tabLeft.png
    • tabRight.png
  2. Tab Selected Images – These are images for the tab that is currently selected at the top of the web page.
    • tabSelectedBg.png
    • tabSelectedLeft.png
    • tabSelectedRight.png

    favicon.ico

    This is the icon that shows up in the tool bar of your browser next to the URL.


From the Fixit environment of a FreeBSD 8 install disk, how do I download a file using ftp?

From the Fixit environment of a FreeBSD 8 install disk, how do I download a file using ftp?

  1. Run ifconfig to find what ethernet controller you have. Mine was em0.
    fixit# ifconfig
  2. Now assign an IP address. Make sure to find an open IP Address that is not already in use.
    fixit# ifconfig em0 inet 192.168.0.25 netmask 255.255.255.0
  3. Run the following commands to enable ssh/sftp capability:

    Fixit#
    Fixit#
    mkdir /usr/bin
    ln -s /mnt2/usr/bin/ssh /usr/bin/ssh

You can now connect to a server on your same subnet using sftp. Feel free to add a default route if you need to connect to a remote server or add a DNS server if you need name resolution.

fixit# sftp user@192.168.0.10

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.


How to open a command prompt running as Local System on Windows 7?

User context is very important. What works for a logged in user may not work for the LocalSystem account. If a process is running as LocalSystem, it is important to test that what you are doing will work when running as LocalSystem. Testing as the logged in user may give incorrect results as the logged in user may have different access rights and permissions.

There used to be many ways to do this, but now in Windows 7 those ways have been cut down.

Here are the two ways I know of that still work, however, only the first way I would recommend:

Method 1 – Using PsExec from Sysinternals

  1. Download psexec from here: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
  2. Extract it.
  3. Open a command prompt and change to the directory where you have psexec and run the following:
    psexec -i -s cmd.exe
    

Method 2 – Using an interactive service

  1. Open a command prompt as administrator (right-click on the cmd.exe shortcut and choose Run as administrator) and run the following:
    sc create CMD binpath= "cmd /K start" type= own type= interact
    sc start "CMD"
    WARNING:  The service testsvc is configured as interactive whose support is being deprecated. The service may not function properly.
    

    A prompt may appear or it may only show down on the start bar and you have to click it to see it. It looks like this:

  2. Click “View Message”.You are now at a local system command prompt.
  3. When you are done, close the command prompt and click return.How to verify that the command prompt is running as Local System?

    1. Run Task Manager and make sure that the cmd.exe process is running as user SYSTEM.

    2. Run SET in your command prompt and make sure the username variable equal your computer name with a $ at the end. For example if you computer is named MyPC1, the username variable would be MyPC1$.


How to enable sshd from the FreeBSD 8 install’s fixit environment?

How to enable sshd from the FreeBSD 8 install’s fixit environemnt?

So there are lots of documents out there on how to do something in fixit and some times (most the time) those are long drawn out processes with a lot of typing.

What if you could copy and paste? Well, you can’t. But you could if you could ssh in right.

So lets boot to the FreeBSD 8 Installation DVD and see if we can enable sshd.

I just got it to work so let me document my steps:

  1. Run ifconfig to find what ethernet controller you have. Mine was em0.
    fixit# ifconfig
  2. Now assign an IP address. Make sure to find an open IP Address that is not already in use.
    fixit# ifconfig em0 inet 192.168.0.25 netmask 255.255.255.0

    That is it for configuring your IP address. You may be asking yourself, what about the DNS server and the default route? Well, you only need those if you are connecting from a different subnet and since you are booted to a fixit environment, I assume you are on the same subnet. Just in case you aren’t, you can enable DNS and give yourself a default route with these commands:

    fixit#
    fixit#
    echo nameserver 192.168.0.1 > /etc/resolv.conf
    route add default 192.168.0.1
  3. Create the directory where the default sshd configuration and keys are stored.
    fixit# mkdir /etc/ssh
  4. Copy the sshd_config to this directory.
    fixit# cp /dist/etc/ssh/sshd_config /etc/ssh
  5. Change the configuration file to allow root logins.
    fixit# echo PermitRootLogin yes >> /etc/ssh/sshd_config
  6. Create the rsa1, rsa, and dsa keys.
    fixit#
    fixit#
    fixit#
    ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ”
    ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ”
    ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ”
  7. Make sure that root can find a shell.
    fixit# ln -s /mnt2/bin/csh /bin/csh
  8. Make sure root has a home directory.
    fixit# mkdir /root
  9. Start the sshddaemon.
    fixit# /mnt2/usr/sbin/sshd
  10. Prepare the environment for login. We probably want similar environment variables, because the defaults won’t work, since most our binary files are in subdirectories of /mnt2.
    fixit#
    fixit#
    fixit#
    env > /root/env
    echo ‘setenv ENV $HOME/env’ > /root/.cshrc
    echo sh >> /root/.cshrc
  11. Now try to connect using ssh and the root user. There should be no password requested. If you need a windows ssh client, use PuTTY.Note: There may be some errors on setting the environment variables when you log in but they aren’t going to hurt anything and the ones you need should work.

Well, that was a lot easier than I thought it would be. Only took me a short time to figure out.

Hopefully if you search any search engine for this term, you will find this post:
freebsd fixit sshd


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.


How to configure ssh to allow certificate authentication to FreeBSD?

How to configure ssh to allow certificate authentication to FreeBSD?

So supposedly you can configure SSH so that you can connect without having to type in a user name and password, but instead authenticate with a certificate. Lets see if we can set this up..

Questions

  • Do I need to modify the /etc/sshd_config?
    No.

Here is what I had to do…

  1. Install FreeBSD and when prompted to enable SSH choose yes.
    How do I install FreeBSD?

    Ok, now you have a FreeBSD server.

    I had problems creating the key using PuTTYgen, (see this post) so I am going to create the keys on the server.

  2. Log in as a non-root user.
  3. Create the RSA keys with this command: (You can use dsa keys by replacing any instance of rsa with dsa.)
    ssh-keygen -t rsa

    Accept the default file locations and hit enter.

    In your home folder you now have two files:

    .ssh/id_rsa
    .ssh/id_rsa.pub
  4. Add the public key to the .ssh/authorized_keys file.
    cat .ssh/id_rsa.pub >> .ssh/authorized_keys

    You can delete the public key, .ssh/id_rsa.pub, now if you want from the FreeBSD server as it is stored in the .ssh/authorized_keys file.

  5. From the workstation that you want to connect to this machine with, use an sftp tool to copy the private key, the .ssh/id_rsa file, to the local workstation.

    Example 1 -If you are on windows, you could use WinSCP to connect to the FreeBSD server. Then you can use the key to connect. If you are using PuTTY, then also use PuTTYgen to load the key and save it in PuTTY’s format.

    Example 2 – If you are on another FreeBSD server or workstation, then copy the private key to the .ssh directory (with the same name id_rsa) for the user you want to automatically connect.

    Now you are done.
    If you have questions, this blog helped me a lot: How to set up SSH keys: Frustration with “Server refused our key”

    Just SSH in and you will not be prompted.


    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.


How to install FreeBSD 8.0 using only ZFS partitions? (Newbie proof, I hope)

Ok, so I want to install the newly released FreeBSD 8.0 and only have ZFS partitions.

Questions I had that I am answering here for you:

  1. Does Sysinstall support ZFS?

    No. You have to install manually using Fixit.

  2. Can I boot off a ZFS partition?

    Yes, you can. Takes some effort to set it up though.

  3. Is it easy?

    No, it isn’t easy it is hard. Unless you have used FreeBSD for some time, then it is just tedious and not really easy or hard.

  4. Is there a guide?

    Yes, it is here:
    http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition
    But hopefully by the time I am done, the best guide will be this post.

Ok, so here it goes, I am following this guide: http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition
I am going to improve upon it and try to make it newbie proof and not skip steps in my guide when this guide skips steps. Why am I making it newbie proof? I don’t know, you would think if you are doing ZFS you aren’t a newbie, but who knows. Better safe than sorry.

Steps for How to install FreeBSD 8.0 using only ZFS partitions?
Step 1. Creating a bootable ZFS Filesystem

  1. Download the FreeBSD 8 DVD ISO from here: http://www.freebsd.org/where.html
    Ok, so this isn’t exactly a download link, but it takes you to where you choose your architecture. Click on the [ISO] link next to your Architecture type.
    If you are a newbie and don’t know your architecture, you probably want i386. If you just bought a new 64 bit machine then you want amd64.
    Ok, so the actually link you want is the one that looks as follows:
    For amd64 – 8.0-RELEASE-amd64-dvd1.iso.gz
    For i386 – 8.0-RELEASE-i386-dvd1.iso.gz

  2. Extract it as it is zipped.
  3. Burn the ISO to DVD disk (or if you are using VMWare just point your VM’s CD-ROM at the ISO).
  4. Boot off the FreeBSD 8 DVD and let it boot all the way up.
  5. Choose your country/region.
    You should now be at the Sysinstall Main Menu. Remember, we cannot use Sysinstall because it doesn’t yet support ZFS. (I am hoping for a new installer over fixing this old one.)

  6. Choose Fixit. You will be promted to Please choose a fixit option.
  7. Choose CDROM/DVD.
    You are now at a Fixit command prompt. And if you are following the wiki guide, you are only at that guide’s step 3. Create MBR disk

  8. Create an MBR disk by running the following command:
    gpart create -s mbr ad0

    However, what the guide assumes you already know is that ad0 is the name of your hard drive and can be different for each installation. I am installing on VMWare using SCSI and the name of my hard drive is da0. So I would run:

    gpart create -s mbr da0

    You can find out your by looking at a directory listing of /dev if you are familiar with common names, otherwise, you can start a Standard install and see what name is used when you get to the Disk label editor section of the install.

    I am going to use da0 or ad0 in the rest of my document interchangeably, so you need to remember to always use the correct disk name for your drive.

  9. Run the following command to show the information for your disk
    gpart show ad0

    There are two columns of numbers. The first column number is a start block for the slice and the second is the size in blocks for the slice. 63 is the start of every first slice. However, the end of a slice is variable depending on the size of your hard drive.

    A slice is not exactly a partition. On FreeBSD you first create a Slice and then you create your partitions on your slice. The next steps will show you have to do both.

  10. Create a new Slice using the entire disk.

    Obviously the guy who wrote the wiki I am following already had two slices for windows, so he must have been dual booting. I am assuming that you are not dual booting and that you are installing a new server and you plan to use the entire disk.

    To create a slice using the entire disk, run this command replacing the value after the -s with the value you saw when you ran the previous command.

    gpart add -b 63 -s 104857515 -t freebsd da0

    It will output something like “da0s1 added”. If you look at the da0s1 string, it makes sense. da0 (your disk name) s1 (slice 1 – the slice you just created).

  11. Now lets create our slice. No, I am not sure why you have to both add the slice and create the slice, but I am sure there is a good reason.
    gpart create -s BSD da0s1
  12. Lets make our slice the active slice. Sounds like this is only sometimes needed. Better to do it and not need it than to not do it an find out you need it.
    gpart set -a active -i 1 da0

    You can run the gpart show da0 command again to make sure it is set as active.

  13. Look at the slice.
    gpart show da0s1

    Again, you will have two rows of numbers. This time the first number is 0 and the second number is the size of the slice.

    We want at least two partitions, one for / and one as a swap partition. So we need to determine how much space we want for the swap partition. I want 3 GB.

    Now we have to convert the desired size from GB to sectors.

    1 kilobyte = 1024 bytes or 2 sectors (Sectors are normally 512 Bytes)
    1 megabyte = 1024 kilobytes
    1 gigabyte = 1024 megabytes

    So to get the number of sectors in 1 GB, we need to use the following equation:

    Gigabytes in Sectors = NumberOfGB * numberOfMBInAGB * NumberOfKBInAMB * NumberOfSectorsInAKB

    1 GB in sectors = 1 * 1024 * 1024 * 2 = 2097152
    3 GB in sectors = 3 * 1024 * 1024 * 2 = 6291456

    So take the total size of your slice in sectors and subtract 6291456 and you will have the size of your / partition. And our swap partition will be 6291456.

  14. Create your / partition.
    gpart add -i 1 -b 0 -s 98566059 -t freebsd-zfs da0s1
  15. Create the swap partition.
    gpart add -i 2 -b 98566059 -s 6291456 -t freebsd-swap da0s1
  16. Load the ZFS kernel module.
    kldload /mnt2/boot/kernel/opensolaris.ko
    kldload /mnt2/boot/kernel/zfs.ko
  17. Create your zpools.
    mkdir /boot/zfs
    zpool create zroot /dev/da0s1a
    zpool set bootfs=zroot zroot
  18. Install the boot manager.
    gpart bootcode -b /mnt2/boot/boot0 da0
  19. Install ZFS boot.
    zpool export zroot
    dd if=/mnt2/boot/zfsboot of=/dev/da0s1 count=1
    dd if=/mnt2/boot/zfsboot of=/dev/da0s1a skip=1 seek=1024
    zpool import zroot

Yeah we are done with step 1. Stay tuned for step 2 and step 3 coming.

… I am back for round 2…er uh…step 2 that is.

Step 2. Installing FreeBSD to the ZFS filesystem

Ok for those of you who skipped the details above, I am reading this wiki:
http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition

My intention is to make a more thorough and newbie proof version of this wiki. So here we go, diving into step 2.

  1. Create the ZFS hierarchy.

    Wow, this is going to be a lot of tedious typing. You know, while FreeBSD didn’t make an installer for all this, how hard would it have been to create a couple of scripts and include them on the CD so this would be easier.

    zfs set checksum=fletcher4 zroot

    zfs create -o compression=on -o exec=on -o setuid=off zroot/tmp
    chmod 1777 /zroot/tmp

    zfs create zroot/usr
    zfs create zroot/usr/home
    cd zroot ; ln -s /usr/home home

    zfs create -o compression=lzjb -o setuid=off zroot/usr/ports
    zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/distfiles
    zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/packages

    zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/usr/src

    zfs create zroot/var
    zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/crash
    zfs create -o exec=off -o setuid=off zroot/var/db
    zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/db/pkg
    zfs create -o exec=off -o setuid=off zroot/var/empty
    zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/log
    zfs create -o compression=gzip -o exec=off -o setuid=off zroot/var/mail
    zfs create -o exec=off -o setuid=off zroot/var/run
    zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/tmp
    chmod 1777 /zroot/var/tmp

    cd /dist/8.0-RELEASE
    export DESTDIR=/zroot
    for dir in base catpages dict doc games info lib32 manpages ports; \
    do (cd $dir ; ./install.sh) ; done
    cd src ; ./install.sh all
    cd ../kernels ; ./install.sh generic
    cd /zroot/boot ; cp -Rlp GENERIC/* /zroot/boot/kernel/
    zfs set readonly=on zroot/var/empty

    chroot /zroot

    echo ‘zfs_enable=”YES”‘ > /etc/rc.conf
    echo ‘hostname=”zfs.mydomain.local”‘ >> /etc/rc.conf
    echo ‘ifconfig_em0=”DHCP”‘ >> /etc/rc.conf

    echo ‘zfs_load=”YES”‘ > /boot/loader.conf
    echo ‘vfs.root.mountfrom=”zfs:zroot”‘ >> /boot/loader.conf

    echo ‘LOADER_ZFS_SUPPORT=YES’ > /etc/src.conf

    mount -t devfs devfs /dev
    export DESTDIR=””

    cd /usr/src/sys/boot/
    make obj
    make depend
    make
    cd i386/loader
    make install

    passwd

    tzsetup

    cd /etc/mail
    make aliases
    umount /dev
    exit
    cp /boot/zfs/zpool.cache /zroot/boot/zfs/zpool.cache

Warning! There is only one line that might catch a newbie off-guard. Every other line you can type in as is but this one.

echo ‘ifconfig_em0=”DHCP”‘ >> /etc/rc.conf

On FreeBSD this is how you setup your network card to use FreeBSD. However, while my card is em0, not all cards are em0. Run the ifconfig command on FreeBSD to see your card type and replace em0 with the type for you card.

Step 3 – Finish

I followed the guide almost exactly except I had to do a cd / before unmounting. So I added that command where it needs to be, so this should be very newbie proof.

  1. Run these commands.
    cat < /zroot/etc/fstab # Device Mountpoint FStype Options Dump Pass# /dev/ad0s3b none swap sw 0 0 EOF export LD_LIBRARY_PATH=/mnt2/lib cd / zfs unmount -a zfs set mountpoint=legacy zroot zfs set mountpoint=/tmp zroot/tmp zfs set mountpoint=/usr zroot/usr zfs set mountpoint=/var zroot/var

I made some mistakes but finally got it to work.


I started using FreeBSD when it was at 4.x and now FreeBSD 8 released November 27, 2009

Wow, to think I started FreeBSD when it was at 4.x. I started using FreeBSD end of 2001, so at the end of 2008, I have used FreeBSD for almost 8 years.

FreeBSD 8 was released November 27, 2009.

Read about it here:
http://www.freebsd.org/releases/8.0R/pressrelease.html

I have some documents on FreeBSD, so I will have to make sure they are still valid.


In QlikView 9, How to report on what Support Cases were open on any given date using open date and close date?

In QlikView 9, How to report on what Support Cases were open on any given date using open date and close date?

So here is what I have in the most basic terms:
1. A Calendar (see my previous post)
My new and improved Calendar in QlikView 9

2. A table loaded from a Ticketing/Case Management database (in this instance it is Salesforce but if could be any ticketing system).

Load CaseId as CaseNumber,
	CreatedDate as DateOpened
SQL SELECT CaseId,
	CreatedDate as DateOpened,
	ClosedDate as DateClosed,
FROM Case;

The table loaded would look like this (only I would have exact times to the second for open and closed dates:

CaseNumber, DateOpened, DateClosed
0001, 11/2/09, 11/5/09
0002, 11/2/09, 11/12/09
0003, 11/3/09, 11/4/09
0004, 11/3/09, 11/9/09
0005, 11/3/09, 11/1/09
0006, 11/4/09, 11/4/09
0007, 11/4/09, 11/3/09
0008, 11/4/09, 11/12/09
0009, 11/4/09, 11/4/09
0010, 11/5/09, 11/9/09
0011, 11/5/09, 11/6/09
0012, 11/5/09, 11/6/09
0013, 11/6/09, 11/6/09
0014, 11/6/09, 11/9/09
0015, 11/6/09, 11/9/09
0016, 11/9/09, 11/11/09
0017, 11/9/09, 11/21/09
0018, 11/10/09, 11/13/09
0019, 11/10/09, 11/13/09
0020, 11/11/09, 11/21/09
0021, 11/12/09, 11/31/09
0022, 11/13/09, 11/115/09
0023, 11/16/09, 11/17/09
0024, 11/16/09, 11/31/09
0025, 11/17/09, 11/31/09
0026, 11/17/09, 11/31/09
0027, 11/17/09, 11/25/09
0028, 11/18/09, 11/23/09
0029, 11/19/09, 11/27/09
0030, 11/20/09, 11/21/09
0031, 11/23/09, 11/23/09
0032, 11/23/09, 11/23/09
0033, 11/24/09, 11/25/09
0034, 11/24/09, 11/26/09
0035, 11/25/09, 11/29/09
0036, 11/25/09, 11/31/09
0037, 11/26/09, 11/30/09
0038, 11/27/09, 11/31/09
0039, 11/27/09, 11/30/09
0040, 11/30/09, 11/31/09
0041, 11/30/09, 11/31/09
0042, 11/30/09, 11/31/09
0043, 11/31/09, 11/31/09
0044, 11/31/09, 12/1/09
0045, 11/31/09, 12/1/09

So each of these cases have a range of time they were open.
For example, Case 0001 was opened on 10/2/09. It continues to be open at the start of the day on 10/3/09, 10/4/09, and 10/5/09 before it was closed later in the day on 10/5/09.

So I have a MasterCalendar that has every day in it. I want to click on 10/4/09 and have this case show as being opened on that day.

I will be getting this to work this week, I hope. So stay in touch.

….

I am back, and much faster than I thought I would be.

Ok, so you won’t have my Salesforce database, so I created an inline load of data you can use to see this work.

Cases:
LOAD * INLINE [
CaseNumber,	DateOpened,	DateClosed
	0001,	11/2/09,	11/5/09
	0002,	11/2/09,	11/12/09
	0003,	11/3/09,	11/4/09
	0004,	11/3/09,	11/9/09
	0005,	11/3/09,	11/1/09
	0006,	11/4/09,	11/4/09
	0007,	11/4/09,	11/3/09
	0008,	11/4/09,	11/12/09
	0009,	11/4/09,	11/4/09
	0010,	11/5/09,	11/9/09
	0011,	11/5/09,	11/6/09
	0012,	11/5/09,	11/6/09
	0013,	11/6/09,	11/6/09
	0014,	11/6/09,	11/9/09
	0015,	11/6/09,	11/9/09
	0016,	11/9/09,	11/11/09
	0017,	11/9/09,	11/21/09
	0018,	11/10/09,	11/13/09
	0019,	11/10/09,	11/13/09
	0020,	11/11/09,	11/21/09
	0021,	11/12/09,	11/31/09
	0022,	11/13/09,	11/115/09
	0023,	11/16/09,	11/17/09
	0024,	11/16/09,	11/31/09
	0025,	11/17/09,	11/31/09
	0026,	11/17/09,	11/31/09
	0027,	11/17/09,	11/25/09
	0028,	11/18/09,	11/23/09
	0029,	11/19/09,	11/27/09
	0030,	11/20/09,	11/21/09
	0031,	11/23/09,	11/23/09
	0032,	11/23/09,	11/23/09
	0033,	11/24/09,	11/25/09
	0034,	11/24/09,	11/26/09
	0035,	11/25/09,	11/29/09
	0036,	11/25/09,	11/31/09
	0037,	11/26/09,	11/30/09
	0038,	11/27/09,	11/31/09
	0039,	11/27/09,	11/30/09
	0040,	11/30/09,	11/31/09
	0041,	11/30/09,	11/31/09
	0042,	11/30/09,	11/31/09
	0043,	11/31/09,	11/31/09
	0044,	11/31/09,	12/1/09
	0045,	11/31/09,	12/1/09
];

Now just do this, and you have your information that you need.

LEFT JOIN ([MasterCalendar])
INTERVALMATCH (CalendarDate)
LOAD
	DateOpened,
	DateClosed
RESIDENT [Cases];

LEFT JOIN ([MasterCalendar])
LOAD
	CaseNumber,
	DateOpened,
	DateClosed
RESIDENT [Cases];

Now load this script up with the calendar script and you can see how it works by playing with a few charts.

Ok I am back with a problem.

PROBLEM
If the case is not closed yet, it is not being counted. I need to fix that, because that is not going to work for me. I need to count the cases that are currently open.

So back to research mode…I will update you as I can.

See this forum post:
http://community.qlikview.com/forums/t/23247.aspx

Solved my own question by continuing to RTM.

I needed to add the following just before my Load Statement:

NullAsValue SFCaseDateClosed;


My new and improved Calendar in QlikView 9

Hey all,

After working with QlikView for a few days, and working with the calendar, here is my new and improved load script for a Calendar.

Calendar:
LET vDateMin = Num(MakeDate(2000,1,1));
LET vDateMax = Floor(YearEnd(Today()));

TempCalendar:
LOAD
$(vDateMin) + RowNo() – 1 AS DateNumber,
Date($(vDateMin) + RowNo() – 1) AS TempDate
AUTOGENERATE 1
WHILE $(vDateMin)+IterNo()-1<= $(vDateMax); MasterCalendar: LOAD TempDate AS CalendarDate, // Standard Date Objects Day(TempDate) AS CalendarDay, WeekDay(TempDate) AS CalendarWeekDay, Week(TempDate) AS CalendarWeek, Month(TempDate) AS CalendarMonth, 'Q' & Ceil(Month(TempDate)/3) AS CalendarQuarter, Year(TempDate) AS CalendarYear, // Calendar Date Names DayName(TempDate) as CalendarDayName, WeekName(TempDate) as CalendarWeekName, MonthName(TempDate) as CalendarMonthName, QuarterName(TempDate) as CalendarQuarterName, YearName(TempDate) as CalendarYearName, // Start Dates DayStart(TempDate) as CalendarDayStart, WeekStart(TempDate) as CalendarWeekStart, MonthStart(TempDate) as CalendarMonthStart, QuarterStart(TempDate) as CalendarQuarterStart, YearStart(TempDate) as CalendarYearStart, // End Dates DayEnd(TempDate) as CalendarDayEnd, WeekEnd(TempDate) as CalendarWeekEnd, MonthEnd(TempDate) as CalendarMonthEnd, QuarterEnd(TempDate) as CalendarQuarterEnd, YearEnd(TempDate) as CalendarYearEnd, // Combo Dates 'Q' & Ceil(Month(TempDate)/3) & '/' & Year(TempDate) AS CalendarQuarterAndYear RESIDENT TempCalendar ORDER BY TempDate ASC; DROP TABLE TempCalendar; LET vDateMin = Null(); LET vDateMax = Null(); [/sourcecode] It is much better and more complete than the previous one I had. Update: Here is what I am using now. Almost the same, but not quite: [sourcecode language="sql"] ///$tab Calendar Calendar: LET vDateMin = Num(MakeDate(2003,1,1)); LET vDateMax = Floor(MonthEnd(Today())); LET vDateToday = Num(Today()); TempCalendar: LOAD $(vDateMin) + RowNo() - 1 AS DateNumber, Date($(vDateMin) + RowNo() - 1) AS TempDate AUTOGENERATE 1 WHILE $(vDateMin)+IterNo()-1<= $(vDateMax); Calendar: LOAD Date(TempDate) AS CalendarDate, // Standard Date Objects Day(TempDate) AS CalendarDayOfMonth, WeekDay(TempDate) AS CalendarDayName, Week(TempDate) AS CalendarWeekOfYear, Month(TempDate) AS CalendarMonthName, 'Q' & Ceil(Month(TempDate)/3) AS CalendarQuarter, Year(TempDate) AS CalendarYear, // Calendar Date Names WeekName(TempDate) as CalendarWeekNumberAndYear, MonthName(TempDate) as CalendarMonthAndYear, QuarterName(TempDate) as CalendarQuarterMonthsAndYear, // Start Dates DayStart(TempDate) as CalendarDayStart, WeekStart(TempDate) as CalendarWeekStart, MonthStart(TempDate) as CalendarMonthStart, QuarterStart(TempDate) as CalendarQuarterStart, YearStart(TempDate) as CalendarYearStart, // End Dates DayEnd(TempDate) as CalendarDayEnd, WeekEnd(TempDate) as CalendarWeekEnd, MonthEnd(TempDate) as CalendarMonthEnd, QuarterEnd(TempDate) as CalendarQuarterEnd, YearEnd(TempDate) as CalendarYearEnd, // Combo Dates 'Q' & Ceil(Month(TempDate)/3) & '/' & Year(TempDate) AS CalendarQuarterAndYear, Year(TempDate) & '/' & 'Q' & Ceil(Month(TempDate)/3) AS CalendarYearAndQuarter, 'Wed ' & DayStart(WeekStart(TempDate) + 3) as CalendarWednesdays RESIDENT TempCalendar ORDER BY TempDate ASC; DROP TABLE TempCalendar; LET vDateMin = Num(MakeDate(2000,1,1)); LET vDateMax = Floor(YearEnd(AddMonths(Today(), 12))); LET vDateToday = Num(Today()); STORE Calendar INTO C:\ProgramData\QlikTech\Support\QVD\Calendar.qvd; [/sourcecode]


A new style guide or a new way to format your code in C++ or C# or any language: "Code like you speak"

Code Like You Speak

Ok, so I wrote a post about why I use long variable names, where I discussed how it is very easy to use long filenames with today’s IDEs. As I code more and more I realize how I want to write like I speak.

As I try to read other people’s code, I have to wonder if they could even understand it themselves if they went six months without touching it.

For example, lets say I am working with a database that has phone numbers and for each phone number I want to do check if it is valid:

Example 1

PhoneNumber p = new PhoneNumber("555-555-5555");
if (p.isValid())
{
    // do something
} else
{
    // Do something different
}

There is nothing wrong with the above code. It even makes sense, mostly because the first line where p is created is right next to the if statement. But of course that is not always the case.

Maybe I have dozens of objects for different database attributes including multiple ojects that start with ‘p’: PhoneNumber, PartList, PersonID, and they all have an isValid() method and those objects are created elsewhere in the code, who knows where. Also, your isValid() function in PhoneNumber checks if the PhoneNumber is formatted correctly, but the isValid() function in PartList checks if it is a valid part in the database and the isValid() function in PersonID does something different, now the above code would be more confusing, especially to some one else reading it (or to yourself six months after writing it).

if (p.isValid())
{
    // do something
} else
{
    // Do something different
}

So if we don’t have the declaration right next to the code, it is hard to understand…

You might say, “Load it in a debugger and just look…why is it so hard?”

My response is this. “What about your Team Leads for you Tech Support team? What about your documentation team? They may have that has access to read the code but they don’t have the tools or know how to compile it. But they may need to see your code to get their job done. And I don’t want to offend your project managers, but there sure are a lot of Project Managers that either never had the ability or have lost the skill to compile code.”

So someone else reading your code is lost. What does p represent? PhoneNumber, PartList, PersonId? What is the object? What does isValid() check for on this object?

So lets code like we speak. First you should say what we really want to do in your language. The sentence below is a valid English sentence and anybody who speaks English can understand it.

If the current phone number is formatted correctly, do something, else do something different.

Well, what if the code were written like this:

// This could be anywhere in code
PhoneNumber theCurrentPhoneNumber = new PhoneNumber("555-555-5555");

// A code like you speak if statement
if (theCurrentPhoneNumber.isFormattedCorrectly())
{
    // do something
} else
{
    // do something different
}

See how it is in “code like you speak” format?

So you may here different theories about writing code and whether to document with comments or not document and have clear code. I am for the theory that when you write your code you should assume that the person reading your code:
1. Doesn’t understand code.
2. Has no technical skills
3. Has an average IQ (in the 90s).
4. Is the worst technical ever who has to document your code…
etc, etc, etc…

So that is why “Code like you speak” is a great way to code. If your technical writer reads the first example, he is confused, but if he read the second, he fully understands the idea what it going one.

Now, it is important that you don’t over do it. You don’t need to have perfect English. Broken English is fine. As you practice you will get better at it. As you get better at it, your code becomes more readable and others can work on it easier. This is especially usefully when working in teams, or one a community-developed open source application.

Don’t go overboard! I mean, there is not reason to define the word “othewise” to replace “else”. If you did that, you may actually confuse veteran developers.

// In a header somewhere...
#define otherwise else

// This could be anywhere in code
PhoneNumber theCurrentPhoneNumber = new PhoneNumber("555-555-5555");

// A code like you speak if statement
if (theCurrentPhoneNumber.isFormattedCorrectly())
{
    // do something
}
otherwise
{
    // do something different
}

However, if the “Code like you speak” development style takes off, the above may not be so overboard, and may become a standard practice to define many English synonyms to help one code in a more clear and understandable method.

One might argue that because not every one speaks english, a language barrier would be more likely, and I would have to disagree. If you code like you speak, someone who doesn’t speak your language could still figure it out a lot faster using something like a language translation tool (such as google’s or babblefish’s) than they could by trying to figure out what a random object is.

As for other style guide information, there are lots of style guides. If you need one and don’t have one, start with this one:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml


Explorer.exe in Windows 7 doesn't always acknowledge deleted files in a timely manner!

Ok, so I have another complaint about Windows 7 and Explorer.

I am sure my system is in a state based on my usage that leads to this bug because it doesn’t always happen.

I wonder if this problem has the same cause as this one:
Windows 7 hangs when creating a new folder and hangs again when renaming it

Problem

Files deleted in Explore sometimes don’t delete from explorer right away, though they do delete. It takes too long to update. It takes far too long to update. It takes abismally too long to update. (I consider anything over 1 second too long, anything over 2 seconds far too long, and anything over 10 seconds abismally too long.)

Time to update is sometimes as long as 45 seconds.

Steps to duplicate

Here is what I do:

1. Delete a file in a folder.
2. Wait 15 seconds or more and the file doesn’t show as deleted.
3. Delete the file again and it says it is already deleted.

Getting to the state where this occurs
Unknown but here is what I do

I have a T61p Laptop running Windows 7 64 bit.
I am joined to a Windows 2003 domain and often the domain controller is not available (like I said I have a laptop).

I use Remote Desktop.
I use network shares often.
I use Visual Studio often.
I use Outlook often.
I use Firefox and IE often.
I have Windows Live Messenger running all the time.
Sometimes I VPN into work.
I do all of the above while VPNed

Software with plugins to explorer include: TortoiseSVN and Notepad++ (could be something they are doing, but even if it is, why would microsoft allow code that calls a plugin to execute when deleting a file?)

Resolution
Unknown, but the problem comes and goes.

Conclusion
Microsoft didn’t not test Explorer in production environments very well or they would have seen this.
If they have seen this and haven’t fixed then that would make me more annoyed.


A guide for analyzing the quality of an open source application?

Ok, so you want to evaluate and open source application?

What guidelines should you use? Here is a guideline. I will continue to update this as I find valid items to measure. If you have something I should add to the list, please let me know.

Obtaining the Software

  1. A top link in search engine when searching for open source app’s name?
  2. A quick download link?
  3. Clear description of different downloads per platform?

Installation of Open Source App

  1. Clear description of different downloads per platform?
    List of platforms:

  2. Ease of install score:
  3. Ease of initial configuration score:

Authentication

  1. Integration with Active Directory?
    Score:

  2. Integration with LDAP?
    Score:

  3. Database authentication?
    Explanation: Can authentication occur in a database such as Postgresql, MySQL, etc…
    Supported Database list:
    Score:

  4. Authentication to a 3rd party programs database?
    Explanation: So that if you have an application A with a database that hosts a username a password, can this open source application B use your database from application A to authenticate?
    Score:

Security

  1. How secure is this application?
  2. What security holes have been reported and fixed?
  3. What development designs were taken into consideration to enhance security?
  4. What security analysis tools such as Nessus has this open source application been analyzed with?

Documentation

  1. Install guide exists?
    Quality Score:

  2. Users guide exists?
    Quality Score:

  3. Admin guide exists?
    Quality Score:

  4. Developer’s guide exists?
  5. Compile/Debug guide on how to load in an IDE and compile and debug (Visual Studio 2008, Eclipse, KDevelop, other, etc…)
  6. Guide for submitting a bug or suggestion?
  7. Guide for contributing documentation?
  8. Ease of contribution Documentation?

Ease of Use

  1. Is the application easy to use?
  2. Can non-technical users use the application with minimal training?

Stability

  1. How stable is the application? Determine this from normal use for a period of time.
  2. How stable is the platform(s) and/or 3rd party dependencies the application runs/depends on?
  3. Does the application crash with normal use?
  4. Does the application crash with abnormal use?
  5. Does the application crash with prolonged use?
  6. Is the process for submitting a bug simple?
  7. Is the process for applying a patch simple?
  8. Does applying patches decrease stability?

Community Strength

  1. Is it being maintained by a strong community?
  2. Is there a high adoption rate for this application?
  3. What is the average turn around time for a bug in the community?
  4. Is there a forum? What is forums user base? How quick do questions get responses?
  5. Is there a mailing list?
  6. Is there an RSS feed?

Customization of Open Source Application

  1. What language is this written in?
  2. Ease of customization.
  3. Ease of contributing to project
  4. Ease of compiling/debugging?
  5. Ease of getting fixes committed to source?

Scalability

  1. Does the application scale well with increased usage?
  2. Does this application integrate with the two most used operating systems for desktops? Windows and OS X?