Current Stories
Wednesday, 6. January 2010
Porting Lua/CGILua/Orbit/Haserl to an Embedded System01/06/2010 02:22 PM Well..this was lot more painful than it needed to be, so I thought I'd document it for posterity (aka Google to find
I had to port a web app development environment to an EmbeddedArm TS-7260 running Linux 2.4 because the current environment consisted of a bunch of cgi shell scripts that "printed" HTML code back as web pages.
(0) Thursday, 24. December 2009
Installing QEMU on Windows w/ Internet Access12/24/2009 02:25 PM This was far more painful than it needed to be after following this tutorial so thought I'd mention that last step that was missing for me. The local LAN connection and the OpenVPN TAP driver connection have to be bridged. Your network connections should look like this after you're done:
Those two connections are bridged and you set your host system's bridge IP address in the Network Bridge's properties. Then when starting QEMU, you give it these parameters:
-net nic -net "tap,ifname=OpenVPN Connection"
And in your QEMU VM, you set an IP address in the same subnet as your host IP (e.g., 192.168.0.1 and 192.168.0.10). You tell the QEMU VM to use the same gateway and DNS server as your host machine as well.
I needed QEMU to run an ARM emulator running Debian to compile apps for a TS-7260 board.
(0) 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)