Friday, April 03, 2009

ANSYS and Intel

I consider my job at ANSYS quite exciting. I get to work on some amazing software with great people. We get to push the limits of engineering simulation and computer technology. In case you've ever wondered what our software does, here's a video shot by Intel showing how we leverage their latest hardware.

Labels:

Wednesday, April 01, 2009

Why did I go to Best Buy?

The rumors are true. Best Buy sucks.

I went to Best Buy today to look at new laptops. I wasn't really planning on buying one at Best Buy due to the wonderful reputation they have. After looking a few minutes I find a nice Dell XPS 1530 that s being discontinued for $739. I know this is a good deal as I had configured a similar laptop at dell.com a few days ago for almost $1400. A supervisor stops by and asks if I need help. I respond I'm interested in the laptop. I then ask if price is open box, floor model, etc. He laughs and assures me I'll get a new laptop in a box. I want to see some more specs. He takes me to a kiosk and punches in the SKU. It brings up a screen similar to this, and I notice two things:

1. The price is $1059 instead of $739.
2. Big red text at top of window says "Item out of stock at store."

Supervisor notices #1 and says, "Hmm, the price is more online. That's odd since they should be the same. Oh well, we price match anyway." Supervisor then walks away.

Five minutes pass. Salesman stops by.

"Do you need any help?"

"I'll take the laptop."

"We don't have any in stock. And I can't give you floor model since we don't have a power cable for it."

"Okay. Can you check another store?"

"Sure. I'll be right back."

...

"The Erie, PA store (over 3 hours away) has 7 left at same price. But, they won't send us any for two weeks since the are doing inventory. Sorry I can't help you."

So, I leave and figure I'll buy laptop online. But wait, online price is ~$300 higher. I call online customer service and describe situation.

"Sir, stores have more leeway than we do for pricing. We cannot match the store's prices online. How much cheaper was it in the store?"

"$300 cheaper."

"Man, that's a great deal. Sorry I can't help you."

I now begin ranting at work. A guy next to me mentions his sister lives in Erie, and is coming home this weekend. She could pickup the laptop for me. Great. I call Erie store to buy laptop over phone. I start explaining whole situation again.

"So, I'd like to buy laptop and have somone pick it up for me."

"I am sorry sir. To pickup laptop, whoever purchases the laptop needs to come to the store and show ID and credit card. Sorry I cannot help you."

Grrr. I am now mad enough to call corporate customer service and explain situation to them.

"Hmm. Wow. Hmm. It doesn't sound like there's a whole lot I can do."

"So, this laptop is available 3 hours from me and also online. But, in order to get one I need to drive over 6 hours roundtrip or pay an extra $300."

"Yes, well. I guess I could call the store for you and talk to them."

"They explicitly told me they needed ID and credit card for pickup."

"Hmm. Well, the ball seems to be in your court sir as to what you want me to do."

"It sounds like you can't do much."

Best Buy has lost another customer for life. 


Labels:

Thursday, October 30, 2008

Biggest Flaw in .Net...Fixed?

OK, so maybe I am biased about the default security settings for managed code on a network share being the biggest flaw in .Net. However, it has to be one of the most aggravating ones (especially when considering deployment options). I never understood how allowing unmanaged code to run on a network share, but not managed code by default was security.


The problem is that failing to run managed code WHILE STILL ALLOWING UNMANAGED EXE's to run, does not provide any security (because hackers will simply use unmanaged code) but does cause nontrivial deployment headaches (manage apps can't be run from network locations).

Anyway, it's now fixed!!! Just grab .Net 3.5 SP1. Thanks to MS (and Vance) for making this change.

Labels:

Thursday, May 22, 2008

SIL, mono, and COM on Linux

A developer named Mark Strobert contacted me a while back about the feasibility of using mono and it's COM Interop implementation to port Windows software written using C# and COM. I told him it should be possible, and we discussed one of the main problems being the lack of a COM infrastructure on Linux. I hadn't heard from him again for a while until...

he emailed and informed me that they were open sourcing their basic COM implementation, a.k.a. libcom. In looking over their blog/wiki, it seems as if the use of mono's COM Interop and their libcom is holding together fairly well. I won't say this is the first real world test of COM Interop in mono, as Shana has used it quite well to implement the System.Windows.Forms WebBrowser control. However, the fact that mono's COM Interop implementation is being used by others is exciting to me (if anyone is keeping their mono COM Interop use in the closet, drop me a line to let me in on the secret).

The developers are using mono to port and develop software in order to support a faith based organization that is involved in literacy, linguistics, and translation. I won't go on any further, because if you're interested you can click around their site (or Linux development site) to see better information than I could explain here.

Labels: ,

Tuesday, October 30, 2007

Test

This is only a test...

Labels:

Tuesday, August 07, 2007

Mono.XPCOM

With a little prodding from Miguel, I finally spent some time trying to play around with mono's COM Interop support and XPCOM. The important thing to note is that COM Interop in mono should (and does) work with XPCOM. Most of my troubles have been due to a lack of XPCOM knowledge, not any technical issues with COM Interop. I haven't worked out all the issues, but below is a little test case I am working on. (side note: there is a serious lack of decent, standalone XPCOM samples/tutorials available on the web IMO)

class XPCOMTester
{
[STAThread]
static int Main (string[] args) {
int hr = NativeMethods.XPCOMGlueStartup (IntPtr.Zero);
nsIServiceManager sm;
hr = NativeMethods.NS_InitXPCOM2 (out sm, IntPtr.Zero, IntPtr.Zero);

nsIComponentRegistrar cr = (nsIComponentRegistrar)sm;

cr.autoRegister(IntPtr.Zero);

Guid kEventQueueServiceCID = new Guid("be761f00-a3b0-11d2-996c-0080c7cb1080");
IntPtr ptr;
sm.getService(kEventQueueServiceCID, typeof(nsIEventQueueService).GUID, out ptr);

nsIEventQueueService eqs = (nsIEventQueueService)Marshal.GetObjectForIUnknown(ptr);
eqs.CreateThreadEventQueue();

nsIEventQueue eq = eqs.GetThreadEventQueue(IntPtr.Zero);

Guid IPC_SERVICE_CID = new Guid("9f12676a-5168-4a08-beb8-edf8a593a1ca");
sm.getService(IPC_SERVICE_CID, typeof(ipcIService).GUID, out ptr);
// or
// sm.getServiceByContractID("@mozilla.org/ipc/service;1", typeof(ipcIService).GUID, out ptr);

// Do more XPCOM stuff here
//

NativeMethods.NS_ShutdownXPCOM(sm);
NativeMethods.XPCOMGlueShutdown();
return 0;
}

}


Interfaces are defined as follows (taking nsIServiceManager as an example):


[Guid("8bb35ed9-e332-462d-9155-4a002ab5c958")]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[ComImport()]
public interface nsIServiceManager
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSigAttribute]
void getService ([MarshalAs (UnmanagedType.LPStruct)] Guid clsid,
[MarshalAs (UnmanagedType.LPStruct)] Guid iid,
out IntPtr result);

[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSigAttribute]
void getServiceByContractID ([MarshalAs (UnmanagedType.LPStr)] string contractID,
[MarshalAs (UnmanagedType.LPStruct)] Guid iid,
out IntPtr result);

[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSigAttribute]
PRBool isServiceInstantiated ([MarshalAs (UnmanagedType.LPStruct)] Guid clsid,
[MarshalAs (UnmanagedType.LPStruct)] Guid iid);

[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSigAttribute]
PRBool isServiceInstantiatedByContractID ([MarshalAs (UnmanagedType.LPStr)] string contractID,
[MarshalAs (UnmanagedType.LPStruct)] Guid iid);
}



The above samples does have one problem at this point; the all to GetThreadEventQueue fails with a class not registered error. Again, I think this is my XPCOM ignorance I am fighting. If anyone actually has any interest in using mono and XPCOM, or has any advice, please send it my way.

Also, I have started working on a Mono.XPCOM interop library that would contain definitions of standard XPCOM interfaces like the ones used above. Any advice as to where to put this code (google)?

Labels:

Monday, February 26, 2007

Three COM Interop Updates

COM Callable Wrappers

First, COM Callable Wrapper support is now in svn. This means that managed objects can be passed to C++ and interacted with as if they were unmanaged COM objects. It still needs some more work, but most basic use of this functionality should work.

User Base Doubles

Previously, I seemed to be the only person interested in using COM Interop, especially on Linux. However, I had an exchange with someone on IRC last week who is trying to port their C#/C++ COM application from Windows to Linux. They are investigating using COM Interop instead of having to write a C wrapper layer with pinvokes.

Mozilla/XPCOM

Theoretically, the COM Interop functionality should work with Mozilla/XPCOM or any COM like system at least on Windows and Linux on x86 and x86-64 architectures (COM Interop depends on the binary layout of vtables). I always planned on trying COM Interop on XPCOM but never had the time. This weekend I took an hour or so and tried to hack something together. Since Monodevelop has an ASP.Net designer that uses Mozilla and one of the future goals is better DOM access, I decided to hack something together inside of the editor.

The good news is that it works! I can traverse/access the DOM without any glue/wrapper library. I just need to define some interfaces in C# and get a pointer to the DOM. The bad news is that strings in Mozilla/XPCOM really stink. I couldn't figure out how to marshal the strings correctly, thus making the exercise less than complete. If anyone knows what a DOMString is, please post a comment. If it ends up being a fairly simple type it can be marshalled that would be great, however if it's just a C++ class (as I currently fear) some unmanaged glue code will be needed to convert the string to something usable by the marshaller.

Labels: ,