Now, we all write pages and HTML5 apps that must work in Mac/Linux/Windows/iPhone/iPad/S3/Nexus... you name it.
And sadly not all browsers behave the same, so a common problem is that you have to bind your code to all sort of events.
My friend Luis Diego send me a nice javascript library that tries to use the microsoft win8 idea of unified all these events under an umbrella of pointer events.
Pointer.js is the library proposed there. I tried it on my HTC WP7 and not everything works. On my pc works very nice and still need to tried on some mobile devices.
I might need some tune up but is a great start.
If you try to upload large files you might get an exception like
HttpException: Maximum request lenght exceeded.
This problem occurs because the default value for the maxRequestLength parameter in the section
of the machine.config or Web.config file is 4096 (4M).
So any file with a size bigger will fail.
However I think that the max size that you can write here is 2G 2097151
Some info can be found here: http://support.microsoft.com/default.aspx?scid=kb;EN-US;295626
So to change that for 512mb use something like:
<configuration>
<system.web>
<httpRuntime maxRequestLength="524288" />
</system.web>
</configuration>
It happen to me that I had a website working perfectly in my IIS and when I went to publish it it looked completely distortionated.
Why !! The eternal why.
I ended finding that it had something to do with the compatibility mode of IE, but why was it changing. It looks like it has some relation with the IIS version. Not sure why.
But the fix is to do something like:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<httpProtocol> <customHeaders> <add name="X-UA-Compatible" value="IE=edge" /> </customHeaders> </httpProtocol>
</system.webServer>
This meta tag instructs the IE to set the compatibility mode to the highest value.
You can use other values as IE7 or IE8So just put that and your site will look nice again :)
Today someone asked what is a way to send messages between two .NET exes.
mmm Well. Interesting question. There are several approaches.
1. .NET Remoting
.NET remoting is not a new technology but is a core part of the
.NET framework and it's always available:
For an example see this code from: http://www.codeproject.com/Articles/62813/NET-Remoting-Events-Explained
2. Named Pipes
This is vb.net example: http://support.microsoft.com/kb/871044
3. WCF
WCF is a great option even if you have legacy VB6 code you can use the SOAP Client to communicate
with the service:
This link http://www.aspfree.com/c/a/VB.NET/Calling-a-Web-Service-using-VB6-with-SOAP-30/
shows an example calling a Coldfusion Service but use it as a base for calling
a WCF service
You can also integrate WCF with COM+ http://msdn.microsoft.com/en-us/library/bb735856.aspx
4. Windows Messages
There is a nice project that wrap it all up for you so you can use this solution:
http://www.codeproject.com/Articles/17606/NET-Interprocess-Communication
If you were looking for HTML5 and CSS3 support, web standards update is a great choice.
However this install tool does not work if you installation is not in the defualt Visual Studio directory:
C:\Program Files\Microsoft Visual Studio 10.0\Common7
One way to fix it is to run the Web Standard update and after the update look for the default dir:
C:\Program Files\Microsoft Visual Studio 10.0\Common7
and copy and merge its contents in your current instalation directory
Is very simple. To get the control with the focus do something just use the FocusManager.GetFocusedElement()
See: http://msdn.microsoft.com/en-us/library/system.windows.input.focusmanager(v=VS.95).aspx
You can also add an extension method like:
public static class FocusExtensionMethods
{
public static bool HasFocus(this Control c)
{
return FocusManager.GetFocusedElement() == c;
}
}
My friend Jesus has been working on an interesting task. We has been implementing some code so we can connect
a WIA compatible scanner with a Silverlight App.
Once he got the scanner to work, he had to send that data to the Silverlight app.
Something like:
var stream = new MemoryStream(data);
BitmapImage bmp = new BitmapImage();
bmp.SetSource(stream);
During this interesting test the infamous Catastrophic failure was raised. This exception
is caused if the data is in an invalid or unsupported format. You can see about this issue in
these links:
http://connect.microsoft.com/VisualStudio/feedback/details/436047/silverlight-3-bitmapimage-setsource-catastrophic-failure
http://forums.silverlight.net/p/232426/569554.aspx
However, Jesus found a interesting solution. Use an appropriate encoder. He found this page:
http://blogs.msdn.com/b/jstegman/archive/2009/09/08/silverlight-3-sample-updates.aspx
With references of Encoder for: .ICO, BMP and GIF
With this code you can do something beautiful like this:
Stream file = …
// Decode
Texture texture = Silverlight.Samples.BMPDecoder.Decode(file);
//Texture is another class in this sample that will return a writeable Bitmap
//And with that texture object you just load the image like this:
WriteableBitmap wb = texture.GetWriteableBitmap();
wb.Invalidate();
img.Source = wb;
Nice!!!!
Azure Storage easily gives you 10TB of storage.
So a common question, is how can you upload information to your Storage Account.
FTP is a standard way of uploading files but is usually not available in Azure.
However is it possible to implement something that mimics an FTP but allows you to save data to the
FTP server?
Well I thought on trying on implementing something like that but luckily several guys have already
done that.
Richard Parker has a post on his blog and has also posted the source code in
codeplex FTP2Azure. This implementation works with clients like FileZile. It only does
Active connections.
Maarten Balliauw also did some similar work. He did not provided the source code but
he does active and passive connections so a mix with Richard’s post can be interesting.
What is the ROT?
“Using ROT (Running Object Table) is a great way to establish interprocess communication between two windows applications. From a purely logical aspect, one application registers a pointer to an instance of a class in the ROT, the other one gets a pointer pointing to the same instance of the registered class and therefore can use the same instance of the class via this pointer. The class that is registered has to be a COM class, otherwise it can be written in any language. The application that will retrieve the pointer from the ROT can be written in any language that can use COM, as ROT gives a pointer to a COM interface.”
Can it be implemented in .NET?
Sure a .NET application can be exposed thru COM and then its pointer can be gotten and consumed by other applications querying the ROT.
And excelent example can be found here: http://www.codeproject.com/KB/COM/ROTStuff.aspx
As always it has its caveats. Be careful.
Obvious replacement?
Well if what you want is (Interprocess Communication) IPC,there are several options in .NET :
* Classical .NET remoting which is very simple and stable to
* Named Pipes see an example here http://bartdesmet.net/blogs/bart/archive/2007/04/12/getting-started-with-named-pipes.aspx
* or WCF with Named Pipes, an example here http://www.codeproject.com/KB/WCF/WCF_CommOptions_part1.aspx
WCF can be an interesting option specially if we were doing things like DCOM and Remote monikers.
In Silverlight you can put an application in FullScreen mode using code like the one exposed here:
http://msdn.microsoft.com/en-us/library/cc189023(v=vs.95).aspx
However that does not allows you to start the application in FullScreen, because the application
can only enter in FullScreen with an user event.
So, one possible approach is to use javascript. So you can do something like this:
<HTML>
<HEAD>
<script LANGUAGE="JavaScript">
<!--
closeTime = "2000";
function closeTimer() {
setTimeout("newURL()", closeTime);
}
function newURL() {
newURLWindow = window.open("FullScreenModeTestPage.html", "redirect", "fullscreen=yes");
self.close()
}
//-->
</script>
<BODY onLoad="closeTimer()">
<center>
<H1>YOU WILL BE REDIRECTED; NEW A NEW WINDOW WILL OPEN IN FULLSCREEN; PRESS ALT+F4 TO CLOSE IT!</H1>
</center>
</BODY>
</HTML>