Drawing with GDI+ under IIS - iis-7

I'm running a web application under IIS that we draw graphs with that are sent to the clients. We were previously running under iis6, while migrating to 2008 ( iis7 ) we have encountered some very weird issues with the graphing. I stumbled across the msdn docs for GDI+ stating that "GDI+ functions and classes are not supported for use within a Windows service." I suspect that my issues are probably related to further isolation of services http://msdn.microsoft.com/en-us/library/ms533798%28VS.85%29.aspx
My question is how the heck are we supposed to draw graphics? Raw GDI? OpenGL - but doesn't that still require a DC?

I had asked a similar question:
Why not use GDI+ from ASP.NET
I ended up switching to the LeadTools libraries.
Of course, you can choose any library that is not device dependent. GDI+ is depending on a device context which gives it a physical device to base it's graphics on. However, when running as a service, the graphics adapter is probably not available for use as it would be in a desktop environment.
You could also write your own graphics routines which draw to a bitmap. A bitmap is simply raw memory arranged in a certain format.

Not 100% on your particular situation given the details; but why not perform your graphics rendering with a simple asp.net application? You can use the System.Drawing namespace which wraps GDI+
If you need just barebones functionality for rendering graphics and delivering to clients over HTTP, you can also use an HTTPHandler

Related

D3D11 in Metro doesn't support D3DReflect? (Why Not?)

D3D11 in Metro doesn't support D3DReflect.
Why not?
My API uses this to dynamically get the constant buffer sizes of shaders.
Is there any other way to get a constant buffer size dynamically in D3D11 without a ID3D11ShaderReflection object? Or get the constant variables by name?
What if I wanted to make a shader compiler tool for Metro?
What is I wanted to make an Art application that allowed you to dynamically generate complex brushes that requires shader generation. But this doesn't work.
Does Windows(Desktop), OSX, Linux, iOS or Android have these shader limitations?
No, so why on earth does Metro?
See http://social.msdn.microsoft.com/Forums/en-US/wingameswithdirectx/thread/9ae33f2c-791a-4a5f-b562-8700a4ab1926 for some discussion about it.
There is not an official position explaining why they made such restriction, but it is very similar to the whole restriction of dynamic code execution on WinRT. So your application scenario is unfortunately not possible.
Though, It would be feasible to hack/patch d3dcompiler_xx.dll and redirect all dll imports to call another DLL that would use authorized only APIs, but that's quite some work, and It is not even sure that this is legal (even by extracting the dll code from original d3dcompiler and rebuilding a new dll).
Another option for your scenario is to send the shader over the internet to a server that compiles and returns bytecode and reflection info... far from being perfect.
Among the platforms you mention, probably iOS is the one that could have the same restriction (I don't develop on this platform, so I can't confirm it).

Can Flex 4 or Actionscript access shared C or C++ library?

I'm having a Flex4/Actionscript application developed for access in a web browser. I need it to perform some math involving imaginary numbers (e.g. sqrt(-1)). I don't believe either Flex or Actionscript supports this.
However, I can put all of the math algorithms in a shared C or C++ library (as created by Matlab). Can Flex or Actionscript access these algorithms (and run them on the client)? Any better way to accomplish this?
Can Flex or Actionscript access these algorithms (and run them on the client)?
Sort of. You can use Alchemy to use C/C++ libraries in the Flash Player. I'm not sure exactly how it works. The project is experimental, but Adobe has announced they have a new version coming and that they will "commercialize" it. I assume that means tools will be rolled into Flash Pro or Flash Builder.
This was the technology behind the 2011 Adobe Max Keynote that displayed a game made with the Unreal engine running a browser.
Some quick searching came up with this AS2 library which may help without going the C route. ( Source ). You'd probably want to convert it to AS3, but I would expect that to be minimal.
As an alternative to Alchemy you can use FluorineFx Aperture Framework. It adds a feature to use LocalConnection to exchange data between AIR app and some sort of C++ dll. The advantage is that this dll is truly native, you can compile it in e.g. Visual Studio, use all the features of C++ without restrictions. The disadvantages are following: unreliable LocalConnection, limitation to use AIR, limitation to run on Windows only.
Another method we used on one of the projects is exchanging data between two separate applications: native and AIR, i.e. you have "server" application and "client" AIR. As "protocol" we simulated LocalConnection at first, but then switched to Windows Pipes as more stable. Another way is to use local sockets.

scanning a system for shared folders in lan

I am developing an application in flex 3 using action script 3.........
I have some range of ip address in LAN(wired or wireless both).....i want to check which all the systems available...and also want to see their shared folders.....can anyone give some code or reference in action script....
Thanks to everyone...
Actually, I don't think it's possible at all with Flex due to sandbox violation of the Flash Player and/or not supporting it.
I don't know if Air supports network access in this way. Check this out for more information on Adobe Air.
MysticEarth is right, Flex cannot access the operating system directly because of security issues that might arise.
However, you can solve it in two ways:
Adobe AIR 2.0 Command-Line Integration:
Server-side script
Adobe AIR 2.0 can now run native processes! So you could have it access your operating system, check the systems available, shared folders, etc. Here's an example on how to execute native processes with AIR 2.0
The current standard is to just use Flex and HTTP to a server side script. To do something like what you're describing, I would create a ruby/php/python script or whatever, send a restful GET HTTP request to that script (say GET /shared_folders), and have that search the OS for what it needs, and return it as XML. Then you can use Flex. If you don't want to do that, AIR 2.0 is the only option.

Profiling existing flash files

I'm trying to do some research on flash objects in browsers. For example memory usage etc.
With Adobe Flex Builder 3 im trying to do some profiling on swf files but the problem is that I can only do this on debug swfs. Almost all adds/games/video are release version. Is there a way to some testing on those?
There's a similar question, posting in here too as it's just as relevant in this thread:
It's important to note that the Flash Player implementation is different on each platform and to an extent each browser, so expect notable speed differences. So if you're developing a resource intensive application you should be using profiling tools specific to each OS you're targeting, like for example Instruments on OS X and of course test the performance in each browser.
I would say you will need to get the source. You could try a decompiler.
Look at the flash.sampler. You will need to run your content in the debugging version of the Flash player, but the content itself doesn't need to have been compiled with debugging symbols.
You can use the PreloadSWF option to inject an agent that can monitor. If you just want memory usage, that's a cheap API to call.

Image manipulation in asp.net/c# without System.Drawing/GDI+

Is there any alternative image manipulation library for .net? I would prefer something that is managed and open source.
I ask this because of two reasons:
I have encountered hard to debug GDI+ errors with System.Drawing in the past
I have read that using System.Drawing in asp.net web applications is not 100% supported.
Thanks!
edit: clarification, I know that System.Drawing can work asp.net web apps - I have used it in the past. I really just wonder if there are any managed image manipulation libraries for .net :)
You should look into the WPF Imaging libraries shipped with .NET 3.0. They're optimized and robust (used to run Aero, so you know they're efficient). They don't depend on the WPF dispatcher, are easily extensible, and officially supported. What more could you want?
I don't know of any fully-managed 2D drawing libraries that are either free or open-source (there appears to be a few commercially available, but OSS is the way to go). However, you might look into the Mono bindings to Cairo.
Cairo is a platform independent 2D drawing API. You can find more information about it at the Cairo homepage. The Cairo Wikipedia page also has some good info.
Cairo is also used fairly widely in the Open Source world, which to me says something about its robustness. Mozilla, Webkit, and Mono all use it, among others. Ironically, Mono actually uses it to back their System.Drawing implementation... go figure.
There might also be a way to use Mono's System.Drawing implementation as a drop-in replacement for the Microsoft implementation, though I'm not sure how or if that would even work. I would probably start by replacing the System.Drawing.dll reference with Mono's version, and then try to deal with any errors.
Anecdotal evidence #1: I have used GDI+ for on-the-fly image creation within ASP.NET with no problems. I'm not sure what the problems would even be.
With respect to (1), most of the hard to debug errors are due to not closing open handles (Dispose() in managed-land). I'm curious where you heard (2).

Resources