Current Stories
Wednesday, 11. November 2009
JQuery UI Dialog and ASP.Net button postbacks11/11/2009 06:40 PM When you use JQuery UI's Dialog plugin to bring up a div as a dialog, it usually pulls the div out of the form to do this and then ASP.Net elements don't work. I found this clean solution to this from Ravi's Software+Usability Blog:
In your dialog creation code, add an open event handler:
$('#divDialog').dialog({
bgiframe: true, autoOpen: false, height: 175,
width: 600, minWidth: 200, modal:
true,
open: function(type,data) {
$(this).parent().appendTo("form");
}
});
This will bring the ASP.Net elements back inside the form so they can post back to the ASPX page properly.
(0) Tuesday, 20. October 2009
ASP.Net LoadXml Doesn't Cache DTDs10/20/2009 03:32 PM Seems like a bad oversight on MS' part. Why would you want to read the DTD each time XmlDocument.LoadXml() is called? :-P
Someone was nice enough to write a caching XML resolver so you can save your bandwidth if you use LoadXml to parse files off a web site:
http://www.nablasoft.com/alkampfer/index.php/2008/05/20/xmldocument-xmlresolver-and-cache-the-schema-of-xhtml/
The actual code is:
public class CachedXmlResolver : XmlUrlResolver
{
public
override Uri ResolveUri(Uri baseUri, string relativeUri)
{
if (relativeUri == "-//W3C//DTD XHTML 1.0 Strict//EN")
return
new Uri("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
else
if (relativeUri == "-//W3C XHTML 1.0 Transitional//EN")
return
new Uri("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");
else
if (relativeUri == "-//W3C//DTD XHTML 1.0 Transitional//EN")
return
new Uri("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");
else
if (relativeUri == "-//W3C XHTML 1.0 Frameset//EN")
return
new Uri("http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd");
else
if (relativeUri == "-//W3C//DTD XHTML 1.1//EN")
return
new Uri("http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd");
return
base.ResolveUri(baseUri, relativeUri);
}
public
override
object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
{
if (!cache.ContainsKey(absoluteUri))
GetNewStream(absoluteUri, role, ofObjectToReturn);
return
new FileStream(cache[absoluteUri], FileMode.Open, FileAccess.Read, FileShare.Read);
}
private
void GetNewStream(Uri absoluteUri, string role, Type ofObjectToReturn) {
using (Stream stream = (Stream)base.GetEntity(absoluteUri, role, ofObjectToReturn))
{
String filename = System.IO.Path.GetTempFileName();
using (FileStream ms = new FileStream(filename, FileMode.Create, FileAccess.Write))
{
Byte[] buffer = new
byte8192;
Int32 count = 0;
while ((count = stream.Read(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, count);
}
ms.Flush();
cache.Add(absoluteUri, filename);
}
}
}
public
static Dictionary<Uri, String> cache = new Dictionary<Uri, String>();
}
(0) Monday, 12. October 2009
Notes 8.5.1 includes Designer at no charge!10/12/2009 05:08 PM In the early days of Notes, all the Notes clients included the "Designer" app that let power users create their own apps so most users could see how useful Notes was instead of having to wait for approval to get a corporate programmer to spend time creating something. This way, they could prototype something they knew best about and the official developers could make it act like standard apps afterwards. XPages is now more complete and very usable for applications that are more web-centric. Check the Lotus site for more details. (0) Saturday, 10. October 2009
DEP/NX Breaks Older C++ ActiveX Controls in .Net 3.5 Apps (including Web Apps)10/10/2009 Thought I'd write this up in case it saves someone else a few days of debugging in Windows 2008 Server. The cryptic error message you'll get in your Windows Forms or ASP.Net apps is "Unable to get the window handle for the 'AxBlahBlah' control. Windowless ActiveX controls are not supported." If you look at the stack trace a bit more, you'll find an Access Violation (thanks to Tom Frey for that hint). The reason for this is that some older C++ ActiveX controls that linked to MS' very own ATL libraries are not NX/DEP safe (i.e., they run code inside data segments!); ATL versions 7.1 and earlier (basically anything before Visual Studio 2005) do this funky stunt. So, your choice is to run your app w/ DEP disabled or if you're lucky, you can recompile those ancient ActiveX controls which is another PITA in itself because you have to get it to compile in a later version of Visual Studio and these controls inevitably have C++ quirks.
Windows 2008 is also missing linkinfo.dll by default, so if your ActiveX control uses wininet.dll, it can't be registered until you install the Desktop Experience feature (which includes Windows Media Player, etc.) in Win2008. Why oh why? :-P At least you can uninstall that feature afterwards; the linkinfo.dll seems to stay around.
(0) Saturday, 19. September 2009
US Patent Office Needs Revamp09/19/2009 01:56 PM You'd think that after the Unisys LZW/GIF mess (where a company used a badly protected/publicized patent to blackmail other companies for blood money), the USPTO would have made changes in how they issue patents or the requirements to keep a patent invalid...
(0) Friday, 7. August 2009
asp.net AJAX Bad Handling of Inline Codeblocks and Multiple Scriptmanagers08/07/2009 10:27 PM In the "why did they design it this way?" category:
- inline codeblocks (the "<%= %>" syntax) aren't support by MS AJAX calls but the "<%# %>" is supported for repeaters/grids for ajax calls; you have to replace the inline codeblocks with asp:literal's
- if you have multiple ScriptManager tags on a page (e.g., a webpart or control that needs it), instead of ignoring the extra tags, asp.net has to blow up w/ an error stating it isn't allowed; you can work around this by checking whether it's on the page already by following various tips on it, e.g. by doing this:
protected override void OnInit(EventArgs e)
{
Page.Init += delegate(object sender, EventArgs e_Init)
{
if (ScriptManager.GetCurrent(Page) == null)
{
ScriptManager sMgr = new ScriptManager();
Page.Form.Controls.AddAt(0, sMgr);
}
};
base.OnInit(e);
}
(0) Friday, 15. May 2009
Tapestry 5.1.x is faster than Struts!05/15/2009 05:02 PM This is pretty impressive because the Tapestry page life cycle is more complicated than Struts'. Howard has also committed to making updates to Tapestry from 5.0 backwards compatible, so 5.x is a major leap from the rip up and replace redesigns of all the previous major versions of Tapestry
(0) Saturday, 2. May 2009
Fix for Disappearing Windows XP/Vista Multiple User Logon Screen05/02/2009 09:23 AM I thought my system was just corrupted but it turns out this is a "feature" of installing VMWare Server. It replaces the MS GINA (Graphical Identification and Authentication) DLL with its own so that it can stop/start VMWare machines on startup/shutdown. There's a MS KB article on this if you want to disable VMWare's GINA DLL, but you'll have to start/stop VMWare machines yourself if you do this. (0)