Monday, February 20, 2012
Gotcha’s in gSOAP Version 2.8.7
1. The header file generated by wsdl2h can have syntax errors. For example, the class definition of a common class like xsd__base64Binary looks like this:
/// Built-in type "xs:base64Binary".
class xsd__base64Binary unsigned char *__ptr; int __size;
The curly brackets are missing. It turns out that the configuration file had it listed that way. wsdl2h does not care about that, and spits it out without complaints. The same thing happens to an enum definition:
/// Built-in type "xs:boolean".
enum xsd__boolean false_, true_ ;
The name of the enum type is then later used as a class name.
Obviously the code will not even build.
2. The C++ file generated by soapcpp2 incorrect merges two WSDLs into one.
Fortunately wsdl2h allows more than one WSDL. It is a rather common situation that one would need to access more than one SOAP service, and being able to generate code from multiple WSDL’s is quite critical.
But then soapcpp2 would merge them all into one. If you have ServiceA and ServiceB, you will get only ServiceA, with the members of ServiceB actually contained in ServiceA. The default endpoint URL is a concatination of the two service URLs in one:
endpoint = "http://serviceA http://serviceB";
Of course, calling the methods in these proxy classes would be problematic.
Although some of the big name companies like IBM are using gSOAP, but I don’t know how they can be using it as is, unless they are all coding in plain C, not C++.
So we have to go either all the way to a managed language such as Java or C#, or we have to stay with plain old C.
Friday, January 20, 2012
Updating to CentOS 5.7 on a HP Proliant DL380 G5 Server–The Saga Continues
Recently we updated our CentOS server from version 5.5 to 5.7. Many updates were accumulated since the original installation, so I decided to bite the bullet and install them all.
The installation of the updates were straightforward. I did it from the desktop of the GUI, and everything installed without any problems.
But restarting the server was not so straight forward. Since we installed HP PSP, and it was tweaked to work with CentOS 5.5, I certainly did not expect it to work so easily.
Sure enough, the server would reboot itself when it tried to load the IPMI driver.
So at the startup of Linux, I hit the “I” key to go into interactive start up mode. I skipped all of the HP drivers, and the server booted all the way up.
Then I uninstalled all of the HP PSP packages. I downloaded the latest version 8.7 HP PSP and installed it. HP has moved the installation instruction, so the link in my previous post no longer works. Now you can find the same instructions here:
The new version of PSP actually works better than the older one: it works right after installation. No tweaking was required.
There is one thing, however: SNMP had to be re-configured. Before re-configuring SNMP, the management webpage on port 2381 showed a bunch of blank rectangles.
I checked the messages log in /var/log. It showed a couple of bogus errors:
- The “Network Manager” does recognize bonded network adapter type, and logs errors in the messages log. So I removed “TYPE=BOND” from the /etc/sysconfig/network-scripts/ifcfg-bond0. This line was inserted by the CentOS Network Manager GUI, and its absence has no effect on the adapter.
- The slave adapters of the bonded adapter, namely eth0 and eth1, had configurations that caused the “Network Manager” to log errors in the messages log. Although the slave adapters do not have IP addresses, the “Network Manager” looks for them in the configuration files anyway. Somehow it grabbed the MAC address lines and thought that they were the IP addresses. Since the MAC addresses start with “0”, the “Network Manager” logged errors saying that “IP addresses cannot start with 0”. Again since the CentOS Network Manager GUI put the MAC addresses in the configuration itself, I tried to remove them to see if the errors would go away. Well they did not. The “Network Manager” complained that “IP addresses were missing”, even though none are needed for the slave adapters. So I put the MAC addresses back and then set DHCP to be “on” for these slave adapters. These adapters will never go out and acquire IP addresses since they are inactive, but this made the “Network Manager” stop logging errors in the messages log.
On the “System Management Homepage” on port 2381, I wanted to test SNMP traps. Unfortunately the test does actually simulate any hardware trap that the HP SNMP Agents would take notice. Even though in /opt/hp/hp-snmp-agents/cma.conf we setup the trapmail line to send emails, none was sent when I clicked on the test button. Only when I unplugged one of the two network cables that generated traps that the HP SNMP Agent would take notice, I got 60 emails in a fraction of a second.
So the test button on the “System Management Homepage” SNMP settings page only tests notification mechanisms that are not really relevant to the HP SNMP Agents. In order to see the trap messages for this test, one needs to run “snmptrapd –f –Le <hostname>” on the command line, and watch the output on the screen. Please note that in the /etc/snmp directory, there needs to be a file named “snmptrapd.conf”, and it needs to contain the line “disableAuthorization yes”. Otherwise “snmptrapd” would not show anything. The “<hostname>” part must match exactly what is in the “snmpd.conf” file. Using IP address or other aliases will not work.
The HP SNMP monitoring is not very reliable. From time to time the “System Management Homepage” on port 2381 would show a bunch of empty box and indicate the system status is ok. After a reboot, all the boxes will be populated again and everything would go back to normal.
It looks like that we just need to watch this server very closely.
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
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:
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:
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.