Wednesday, September 28, 2011

Changing the Z-Index of a jQuery UI Selectmenu

I am using jquery.ui.selectmenu on a website that I am building. One of the select controls on a page needs to have its z-index set higher because it is directly above another control that has a non-zero z-index.

The way that jquery.ui.selectmenu is designed is intended to make things really simple: You set the z-index of the original select control, and the rendered select will have the right z-index.

Well it is not quite that simple. jquery.ui.selectmenu uses jQuery’s zIndex() function to get the original select control’s z-index. This function only returns a non-zero z-index if the original select control uses relative or absolute position.

When my select control kept using z-index of 0, I first tried setting it on the ui-selectedmenu, etc. Of course, none worked. So I had to go into the javascript of jquery.ui.selectmenu to see why it was not working, and that was what I found.

So I changed the original select control to uses relative position, and then everything works fine.

Saturday, September 24, 2011

Windows Updates KB2468871 and KB2533523 Keep Reinstalling

On one of my workstations, Windows 7 kept re-installing two updates, KB2468871 and KB2533523, even though the installations were successful each time.

KB2468871 is titled "Update for Microsoft .NET Framework 4.0 on Windows...". More details on this update can be found here.
KB2533523 has the same title, and more details on this update can also be found at Microsoft's website.
Some folks on the internet suggested downloading the update packages and installing them manually. So I did that. It did not help. Some suggested that the update should be done in safe mode. That did not work.

It turned out that for me, the cause of the problem was that I had a .NET 4 beta component installed, and I forgot to remove it.
I saw it when I decided I was going to reinstall .NET 4. So I removed it. Now these updates are no longer trying to re-install themselves, finally.

Sunday, June 19, 2011

Processing Tfs_Analysis Database

I was trying to get TFS 2010 to work with SQL 2008 R2 Report Server. Because the order in which these servers were installed, the reporting service in TFS 2010 had to be fixed after it was migrated to a server computer from a test installation on a workstation.

I followed the suggestions at this link:

http://social.msdn.microsoft.com/Forums/en-US/tfsreporting/thread/1d566b21-3082-4aa8-bbc8-d02fb76791de/

I downloaded and uploaded necessary report definitions, I fixed the data sources, and I update security settings. When I tried to open a report, I got errors related to “dsIteration”. I opened a report definition in SQL Report Designer. When I tried to run a query on this dataset, I got a “no cube can be found” error.  

I had to get into “SQL Server Business Intelligence Development Studio” to open the “Tfs_Analysis” database. It is not visible from the “SQL Server Management Studio”. Although the “Tfs_AnalysisDataSource” tested fine, when I tried to process the database from the “Database” menu, I got an error:

“OLE DB error: OLE DB or ODBC error: A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.; 08001; Client unable to establish connection; 08001; Encryption not supported on the client.; 08001.

Errors in the high-level relational engine. A connection could not be made to the data source with the DataSourceID of 'Tfs_AnalysisDataSource', Name of 'Tfs_AnalysisDataSource'. “

I tried to fix the “Tfs_AnalysisDataSource” datasource. Everthing I tried was of no use. I updated the firewall for SQL Analysis Service. It uses port 2383 access. That was not enough. 

I found an article on the internet that was helpful:

http://blog.accentient.com/2010/04/08/ManuallyProcessingTheTeamFoundationServer2010DataWarehouseAndAnalysisServicesDatabase.aspx 

It taught me how to use a web service to build TFS report databases:

http://localhost:8080/tfs/TeamFoundation/Administration/v3.0/WarehouseControlService.asmx?

I went through the steps and they did not solve the problems. I restarted the SQL Analysis Service. It turned out that the “OLE DB error” was caused by the SQL Analysis Service itself. After the restart I got a bunch of SQL errors while processing the database, but none was “network-related”. I went into TFS Management Console and rebuilt the warehouse database, and reprocessed the “Tfs_Analysis” database. The reprocessing worked.

After that, the reports were still not accessible. I restarted the SQL Analysis Service again, and then I went through the web service calls again.

Finally, the reports came up.

Saturday, April 30, 2011

Split Personality of a Silverlight Control

Silverlight control visual states are separate from their enabled/disabled states. For example, a DataForm control can be enabled and yet shown in a “Disabled” visual state. I don’t know why these two states would ever need to be separated. It can only cause confusion.


When a Silverlight Control Toolkit ChildWindow is opened from a command bound to a button inside a DataForm control, this DataForm control is disabled, and its visual state becomes “Disabled” as well. However, when the ChildWindow is closed and the DataForm control is re-enabled, its visual state remains in “Disabled”.


If you did not expect this behavior, you would probably think that the DataForm control is still disabled after the ChildWindow is closed. Well it is enabled. It is just not rendered that way. There is an article here that suggested we create a derived control that updates the visual states in an event handler. It is a good solution, but of course, you can handle the state change anywhere, such as in a parent control’s code:



private void MyDataForm_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if(MyDataForm.IsEnabled)
{
VisualStateManager.GoToState(MyDataForm, "Normal", true);
}


else
{
VisualStateManager.GoToState(MyDataForm, "Disabled", true);
}


}



The fix is easy once you know what the bug is.

Wednesday, February 23, 2011

Installing SharePoint 2010

As a developer, I needed to install SharePoint 2010 on a Windows 7 machine. There is an excellent guide on how to do that at http://msdn.microsoft.com/en-us/library/ee554869.aspx

However, there are still a lot of things that this guide does not tell you.

Using a Different Database

This guide says that we should install a “standalone” server. With this option you do not get to choose a database server. It installs SQL 2008 Server Express on your machine without asking, even if you already have a SQL 2008 Server on your machine. Secondly, you have no control over this database. You cannot gain administrative access to this database, and you cannot change things in there. Given that the SharePoint 2010 administrative tools do a terrible job of managing the database, this will not work at all.

So I re-installed it and selected “Server Farm” and then a “New Farm”. With this option you get to choose a SQL 2008 R2 database server. Apparently anything less than R2 is not allowed.

It is my database and I can manage it now.

All of the Errors in the Event Log

1. SharePoint 2010 cannot load “TaxonomyPicker.ascx”. There are a lot of discussions online about “fixing it” by changing “,” to a comma, etc. But actually this file simply does not belong in the SharePoint folder and needs to be removed. The name of the class in front of the “,” is

“Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker”.

The assembly name after that is

“Microsoft.SharePoint.Portal.dll”.

I browsed through all of the classes in the namespace “Microsoft.SharePoint.Portal.WebControls” in this assembly with Microsoft’s FxCop 10.0. There is no class by the name of “TaxonomyPicker”, period. Here is a good article here about this: http://davidfrette.wordpress.com/2010/05/20/why-the-taxonomypicker-ascx-is-no-longer-used/

2. DCOM 10016 error. There is a good article about how to fix it here: http://www.wictorwilen.se/Post/Fix-the-SharePoint-DCOM-10016-error-on-Windows-Server-2008-R2.aspx

3. "The farm is unavailable". This happens to a long list of services, such as “SecurityToken.svc”, “MetadataWebService.svc”, and “ProfilePropertyService.svc”, etc. In the end each had to be deleted and recreated in “SharePoint Central Administration” > “Application Management” > “Manage Service Applications”. It turned out that this was easier than one would expect: From the “New” button on the ribbon control, each type can be easily selected. The deletion is not very intuitive: if you click on the name it tries to jump to the application’s setting if it has a blue link. You would have to click somewhere else in the row such as “Type” to select the service application, and then delete it using the delete button on the ribbon control.

Summary

Installing SharePoint 2010 is about as bad as installing Linux, you need to do several reinstalls and a lot of googling to get it right.

Friday, February 18, 2011

Installing CentOS 5.5 on a HP Proliant DL380 G5 Server

This should have been a simple task. But like everything else with Linux, there are always many things that can go wrong.
First of all, the DVD drive in the HP Proliant DL380 G5 only liked certain types of DVD+R media. I spent a day trying to boot up CentOS 5.5 installation DVD using different DVD+R media with various options, and finally succeeded on one.
Because we use a RAID controller, we needed to install an HP driver. This was easy. I copied the “cpq_cciss-3.6.26-5.rhel5.x86_64.dd” driver onto an USB drive, and plugged it into an USB port on the server once we got to the CentOS 5.5 setup screen.
I then hit F2 to get to the Options screen, entered “linux dd”, and then hit enter to continue. At some point the CentOS 5.5 setup program prompted me for a driver disk. I selected “yes”, and then selected “sda” for the USB drive. I then browsed for the RAID controller driver on the USB drive. I select the driver file, and then continued.
When the time comes for you to select drives for installation, the USB drive is selected by default. Unselect it, unless you really want to use it for your installation.
I cleared the check box in front of the USB drive “sda”, then continued. It was eventless until I got to the step for application selections.

First Problem

If you check the “Extra” applications check box, you will have to start all over again because the setup program just panics and reboots the machine. If you leave it unchecked, you get to finish the installation.
Success? Not yet.

Second Problem

After the installation, I had GRUB problems. I tried updating it with the USB drive unplugged, that did not fix the problem. Someone on the internet suggested that we should unplug the USB drive after language selection. That did not work for me, as the setup complained that the USB drive was missing. You can unplug it later and see if that helps, but I would rather not spend the time. I booted up the CentOS 5.5 Setup DVD, and entered “linux rescue”.
Once I got to the command prompt, I entered “chroot /mnt/sysimage”. Then I ran “mount” to see where the root “/” was. It was at /dev/VolGroup01/LogVol00. On the two different installation attempts, this path was set to different values.
I opened /boot/grub/grub.conf with vi, and it had /dev/VolGroup01/LogVol00 listed under “title CentOS (2.6.18-194.el5)”. But it started with “root (hd1,0). That was wrong. So I changed it to (hd0,0). The splash image was set under (hd1,0) as well. I corrected that. I then opened /boot/grub/device.map, and changed it so that there was only one device in it: (hd0) /dev/VolGroup01/LogVol00.
Reboot. You will see the message “Memory for crash kernel (0x to 0x) not within permissible range!” when it first comes up. Ignore it. It is mentioned in CentOS 5.1 (not 5.5) release note. It will go away on its own next time.

Third Problem

We needed to install the HP PSP. I following instructions at
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1436465
The instructions on this page are great. However, it does not cover any errors that one may encounter. On the first install, I installed all CentOS 5.5 updates and then proceed with the HP PSP install. The server would reboot itself every time “hp-health” started. On the second attempt, I installed HP PSP before the CentOS 5.5 updates. First I ran into the problem that the links to the kernel build source directory were going nowhere. Apparently one of the links was a typo since the link was off from the right target by a “../”. So I corrected it. Then every time when “hp-health” started, I got the error “insmod: error inserting ‘/opt/hp/hp-OpenIPMI/bin/2.6.18-194.el5/impi_devintf.ko’: –1 Unknown symbol in module”, “hp-OpenIPMI: Not able to start ipmi_devintf.ko”.
My solution to this problem was to install all of the CentOS 5.5 updates, and then install HP PSP 8.25. Before restarting the server, I renamed the directory "/opt/hp/hp-OpenIPMI/bin/2.6.18-194.32.1.el5" to "/opt/hp/hp-OpenIPMI/bin/2.6.18-194.32.1.el5.bak". Then I created a link "2.6.18-194.32.1.el5" in "/opt/hp/hp-OpenIPMI/bin" that pointed to "/lib/modules/2.6.18-194.32.1.el5"/kernel/drivers/char/ipmi". This is a little less efficient than the HP IPMI driver if it worked, but it does everything the HP IPMI driver does. A visit to the "HP System Mamangement Homepage at "http://localhost:2381" proves that.
Wait, there was one more thing. The array configuration utility did not come up automatically. On the "HP System Mamangement Homepage" when I clicked on the "Array Configuration Utility" link it showed a blank page.
To fix that, I created a startup script for the "Array Configuration Utility" called "cpqacuxed" in "/etc/init.d":
#!/bin/sh
# HP Array Configuration Utility
#
# chkconfig: 2 99 99
# description: HP Array Configuration Utility for remote access
#
case "$1" in
start)
echo -n "Starting cpqacuxed"
/usr/sbin/cpqacuxe -R
echo "."
;;
stop)
echo -n "Stopping cpqacuxed"
/usr/sbin/cpqacuxe -stop
echo "."
;;
*)
echo "Usage: /sbin/service cpqacuxed {startstop}"
exit 1
esac
exit 0
I then installed the script by running "chkconfig --add cpqacuxed".
After a restart, everything on the "HP System Mamangement Homepage at "http://localhost:2381" works.

Forth Problem

Step 8a says that after running "audit2allow -a -M mysemanage", we should run "semodule -i mysemanage.pp". I ran it, and it returned errors: " libsepol.link_modules: Tried to link in a non-MLS module with an MLS base.", "libsemanage.semanage_link_sandbox: Link packages failed", and just in case I had doubts, "semodule: Failed!"
A little googling around yielded the following solution: run "checkmodule -m -M -o mysemanage.mod *.te", "semodule_package -o mysemanage.pp -m *.mod", and then "semodule -i mysemodule.pp". That did not return any errors.

Fifth Problem

Enabling Samba. The information provided at http://wiki.samba.org/index.php/Samba_&_Active_Directory is excellent. But it had problems, too. I got to the step for "net ads testjoin", and it returned "ads_connect: No logon server". This is ridiculous since the "kinit" command succeeded just fine. So I tried "net ads join -S -U Administrator". That prompted me for a password, and it worked. Then the "wbinfo -u" command did not work. A restart of the "winbind" service fixed that. By the way, the "winbind" service on CentOS 5.5 does not have a letter "d" at the end of its name. The article mentioned that "libnss_winbind.*" must be present in the system /lib directory. But my CentOS 5.5 is 64 bit, and the directory name is /lib64, and it does not have all of the libraries. Some of the library files are in /usr/lib64. But that did not really matter, as it turned out.
So now our Windows domain users can all login to this CentOS box.

Sixth Problem

Enabling XDMCP remote access. This server is behind a firewall, so I wanted to give internal users remote desktop access. Enabling XDMCP is never easy, and on CentOS 5.5 is even more so. The information provided on CentOS' website for setting up gdm is no longer valid. The configuration file is not at its usual place, nor with its usual name. Instead of placing it inside "/etc/X11/gdm", it is now in just "/etc/gdm". Instead of using the name "gdm.conf", CentOS now calls it "custom.conf". Instead of uncommenting "DisplayManager.requestPort" and changing it to 177, it is now in the security section, and the setting is "DisallowTCP=true". I changed it to "DisallowTCP=false". Enabling XDMCP now also requires that we set "Enable=true" in the "xdmcp" section.
XDMCP is a pain even without these problems. I opened a bunch of ports on the CentOS 5.5 box: UDP 177, and TCP 7100 for the X font server. Not only that, the remote user's machine needs to be opened up as well, such as TCP ports 6000-6005. But after that, remote X servers work fine.

Tuesday, February 1, 2011

SharePoint 2010 SPGridView Paging with ObjectDataSource

This is supposed to be simple: You setup an ObjectDataSource with paging, and you setup page size, pager mode, pager position, and pager visibility of the SPGridView. You would then expect that the SPGridView would show a pager when needed.
Well it is not that simple. The pager never shows up.
The solution turns out to be that you must set PagerTemplate of the SPGridView to null before data is bound to the SPGridView. A good place to do this is in the event handler of the "DataBinding" event of the SPGridView. Once it is set to null, the pager shows up and works perfectly.
I guess using pager template with ObjectDataSource is out of the question.