Wednesday, November 19, 2014

DevExpress WinForms GridView RepositoryItemButtonEdit Glyph - image not showing

Glad I spent the last couple of hours tracking this down.

If you've set your ButtonEdit's button to Kind = Glyph and assigned it an Image and the image still doesn't show - you need to set the ButtonEdit's TextEditStyle to HideTextEditor. If you use DisableTextEditor, the button won't show.

Brilliant, really. The button and image have nothing to do with the text editor, but changing the text edit style makes a difference.

Thursday, March 17, 2011

Attribute only valid on v:image

Ran into an error in IE6 on a site I was developing:

"Attribute only valid on v:image"

The error message popped up on a Google Map canvas I had embedded in the page whenever a user interacted with the map.

The culprit was a combination of DD_belatedpng and a rule included by default in html5boilerplate where all tags were being fixed by DD_belatedpng when the page loaded. Removing the img selector from this rule resolved the error.

Tuesday, August 25, 2009

FusionCharts, IE6, and "Unknown runtime error"

FusionCharts' JavaScript file makes use of innerHTML to replace a placeholder <div>'s content with the generated SWF. However, on IE6, this causes an "Unknown runtime error".

I am working with version 1.2.4. I have jQuery 1.3 loaded on the site, so I replaced four instances of innerHTML calls with $().html() syntax:

Line 237:
{ n.innerHTML = obj.getSWFHTML(); },false );
became
{ $(n).html(obj.getSWFHTML()); }, false);

Line 242:
{ n.innerHTML = obj.getSWFHTML(); } );
became
{ $(n).html(obj.getSWFHTML()); });

Line 246:
n.innerHTML = this.getSWFHTML();
became
$(n).html(this.getSWFHTML());

Line 251:
n.innerHTML = this.getSWFHTML();
became
$(n).html(this.getSWFHTML());

Saturday, July 25, 2009

jQuery execution after image load

If you need to run JavaScript that's based on some attribute of a loaded image (e.g. height or width), use a callback with $(window).load() instead of $(document).ready().

Friday, June 5, 2009

Pure T-SQL (Geo) Distance Calculations

Awesome post by Joe Finsterwald (http://www.wtfdeveloper.com/Default2.aspx) shows how to implement geographical distance calculation functionality in pure T-SQL.

Monday, April 27, 2009

T-SQL Epoch Date Conversion

I needed a way to convert a BIGINT containing a date in SSE (seconds since epoch - 1/1/1970) format into a DATETIME. The following query does the trick:

SELECT DATEADD(DAY, CAST(sse_value AS BIGINT)/86400000, CAST('19700101' AS DATETIME))

Thanks to some guy named Steve Kass for pointing this out on DevelopmentNow.

Saturday, April 11, 2009

Safari color issues?

If you're experiencing color issues with your images in Safari, make sure that an embedded color profile was not saved with the image. Open the image in Photoshop; File --> Save As; uncheck Embed Color Profile; save image.

Wednesday, January 7, 2009

Another IE z-index bug workaround tip thingy

If you're having trouble getting z-indexes to work right in IE, the order of your style declarations in your css file might matter. Try putting the style code for the element you want to stack on top at the bottom of your css file and see if the problem persists.

Monday, December 29, 2008

Followup: IE6 PNG Alpha Transparency Fix

I, like many others, ran into the issue of <a> links not being click-able when they sit on top of an element upon which the alpha fix has been run.


A hint I got off of this site gave me the answer I was looking for: The element containing the filtered png must not have a position set, and the links within that element must have a position set.

Thursday, December 4, 2008

Vertically & Horizontally Centered <div>

Ran across this beautiful CSS example of a perfectly centered <div>:


#mydiv
{
position:absolute;
top: 50%;
left: 50%;
width:30em;
height:18em;
margin-top: -9em; /*set to a negative number 1/2 of your height*/
margin-left: -15em; /*set to a negative number 1/2 of your width*/
}

Wednesday, November 19, 2008

FTP/SSL through a NAT firewall

This was a helpful article in understanding connectivity issues when attempting to use FTPS through a NATed firewall:

http://geekswithblogs.net/Lance/archive/2005/08/23/50912.aspx

I'm using FileZilla Server to receive files from someone else and needed to set up FTPS. Specifying a particular port, and then opening that port, solved the problems I was having (i.e. 425 errors).

Monday, October 27, 2008

Using jQuery to make LI elements hover-able in IE6

Another necessary hack, this time to overcome IE6's non-support of the hover pseudo-class for LI elements.

This is to be used in situations where navigation is structured using UL, LI, and A elements and styled via CSS.  Please note that additional selectors will be required when implementing this solution: the standard selector (using li:hover notation) and the alternate selector (using li.over notation to support what this JavaScript is accomplishing):


$(document).ready(function() {
// Hack to make li's 'hover-able'
if (document.all && document.getElementById) {
$("#mainnav > .menu ul > li").each(function() {
this.onmouseover = function() { this.className += " over"; }
this.onmouseout = function() { this.className = this.className.replace(" over", ""); }
});
}
});

IE6 PNG alpha transparency solution

I know a bazillion solutions have been posted to the interwebs to solve this problem, but I wanted to make a note of one that I found to work quite well:

Thursday, September 25, 2008

JavaScript HTMLEncode function

Found this neat trick on another blog (http://lunarmedia.com/blogs/lunarmedia_blog/archive/2006/10/23/120405.aspx) to escape characters for presentation in HTML:

function escapeHTML (str)
{
   var div = document.createElement('div');
   var text = document.createTextNode(str);
   div.appendChild(text);
   return div.innerHTML;
}; 

Thursday, September 18, 2008

IDIOTIC WebResource.axd workaround

I was tasked with moving an ASP.NET 3.5 website from one web server to another.  Everything worked great on the second server, except I was getting 404 errors anytime an embedded resource was requested with a WebResource.axd URL.

I went all over Google looking for the answer, and found a workaround that works, but is absolutely ridiculous:

Place an empty WebResource.axd file at the location that is 404'ing.

I'm sure this has something to do with HTTP handlers and priorities and the like, but whatever the real issue is, it is so obscure that I'm going to use this workaround for now and move on.

Ugh.

Friday, August 1, 2008

The remote certificate is invalid according to the validation procedure

I'm calling an ASP.NET web service from an ASP.NET web application. The two applications are on different servers. The web service requires SSL and presents the application with a self-signed certificate. Since this is an internal app, I want the client application to trust the web service and its self-signed cert.

There are lots of suggestions on how to do this in your code by coding a delegate method to accept all server certificates regardless of origin:

ServicePointManager.ServerCertificateValidationCallback =
delegate(object sender, X509Certificate certificate, X509Chain chain,
SslPolicyErrors sslPolicyErrors) { return true; };
I don't want to do this, though, because this same code will be rolled out to production and it seems sloppy to me to allow all certificates to validate carte blanche.

So, I set out to download the internal SSL certificate and install it in the client computer's Trusted Root Certification Authorities cache. That still doesn't work!

Thanks to Ferry Onderwater's entry at http://www.arcencus.nl/Blogs/tabid/105/EntryID/39/Default.aspx, I see now where I went astray. By default, the Certificate snap-in installs certificates for the current user only. I needed all users to trust the certificate.

Solution:
  • Start a new MMC.
  • File --> Add/Remove Snap-In...
  • Click Add...
  • Choose Certificates and click Add.
  • Check the "Computer Account" radio button. Click Next.
  • Choose the client computer in the next screen. Click Finish.
  • Click Close.
  • Click OK.
  • NOW install the certificate into the Trusted Root Certification Authorities certificate store. This will allow all users to trust the certificate.

Tuesday, July 29, 2008

SharePoint: Errors 6482, 6398

The Event Log on our MOSS 2007 server was filled with alternating error codes 6482 and 6398.

6482:
Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (dc8cedfd-9340-42bb-adee-57e75040cdf6).

Reason: Retrieving the COM class factory for component with CLSID {3D42CCB1-4665-4620-92A3-478F47389230} failed due to the following error: 80070005.
...

6398:
The Execute method of job definition Microsoft.Office.Server.Search.Administration.IndexingScheduleJobDefinition (ID 66aead00-c73c-4e06-a1ce-ac86070bb9da) threw an exception. More information is included below.

Retrieving the COM class factory for component with CLSID {3D42CCB1-4665-4620-92A3-478F47389230} failed due to the following error: 80070005.
...

---

After a little bit of Google researching, I found that the service account used by the "Windows SharePoint Services Search" service did not have appropriate rights to launch, activate, and access the DCOM component oSearch.

Give the service account Local Launch and Local Activation permissions in the "Launch and Activation permissions" portion of the oSearch DCOM component properties dialog. Also, give the service account Local Access permissions in the "Access Permissions" portion of the properties. Save the changes and restart the "Windows SharePoint Services Search" service and you should be good to go.

Thanks to the folks at Tahoe Solutions for posting this on their blog: http://tahoesolutions.blogspot.com/2008/01/event-6482-and-6398-errors-in-event.html.

Thursday, July 24, 2008

Accessing subsites' lists via the MOSS 2007 Lists.asmx web service

I spent a little bit of time trying to figure this one out. I'm playing with the exposed web services that MOSS 2007 provides, trying to figure out how to manipulate lists via this API. My web reference is set to http://company.com/Clients/_vti_bin/Lists.asmx, but I am getting the same response as if the web reference were set to the site root (i.e. http://company.com/_vti_bin/Lists.asmx).

Thanks to user in.the.dark on MSDN forums (http://forums.msdn.microsoft.com/en-US/sharepointdevelopment/thread/80be9abc-f9e0-49b6-8ebc-8f90ddbf27a2/), a workaround is to set the URL programmatically, like so:

using (com.company.Lists lists = new com.company.Lists())
{
lists.Url = "http://company.com/Clients/_vti_bin/Lists.asmx";
XmlNode listColl = lists.GetListCollection();
}

listColl now contains the subsite's lists, rather than the root site's lists.

Monday, June 16, 2008

Calculating Work Days

I ran across the following T-SQL function to calculate the number of workdays between a given start date and end date. (This does not exclude non-weekend non-workdays such as holidays.)

Thanks to Jeff Moden for this function, which I found at http://www.sqlservercentral.com/articles/Advanced+Querying/calculatingworkdays/1660/:

SELECT
(DATEDIFF(dd, @StartDate, @EndDate) + 1)
-(DATEDIFF(wk, @StartDate, @EndDate) * 2)
-(CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)
-(CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)

Thursday, June 12, 2008

ASP.NET Menu control & "downlevel" browsers

I ran into this fix when trying to get an ASP.NET 2.0 Menu control to render correctly on Safari. It turns out that ASP.NET thinks Safari is a downlevel browser (meaning incapable of rendering XHTML), so it sends a funky (and generally non-functioning) rendering of the Menu control down to the browser.

This isn't guaranteed to work in all cases, but in my case, adding the following Page directive did the trick:

<%@ Page ClientTarget="uplevel"... %>