Welcome to my WebLog

The virtual home of Alon Fliess

<August 2008>
SuMoTuWeThFrSa
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456


Navigation

Sela

Subscriptions

News

It is impossible to know everything, but we should try!

Article Categories



A new localized Blog

Hi

I have opened a new Blog at : http://blogs.microsoft.co.il/blogs/alon/

This blog is for the .Net community in Israel.

 

posted Sunday, April 23, 2006 5:17 PM by alon with 0 Comments

.Net runs my house!!!

I have just finished my (first version of a) .Net compact framework based remote control client for my intelligent home electrical system. I developed the software using the beta version of VS 2005. I am using C++/CLI for the server side and C# on my IPaq. I am using Web Services over WiFi. Just look at the picture: (Yes it is localized :)

 

 

I may write soon an article about, the architecture and implementation of this cute piece of software and technology.

posted Wednesday, June 08, 2005 11:21 PM by alon with 0 Comments

C++/CLI "initonly" and "literal" vs native C++ "const" and "static const"

You know, sometime if you write the right question right, you get the answer right away.

I am reading the new C++/CLI draft (http://www.plumhall.com/C++-CLI%20draft%201.10.pdf) and I wonder why they had to invent two new keywords, the "literal" and the "initonly".

"literal" is like the C# "const" while "initonly" is like the C# readonly. In ISO C++, there is the global or static const for literal and const (in member declaration) for "initonly". So I asked: why not using "static const type var;"? And I see the answer, "static const type var" is it a literal (native C++) or "initonly" static class member (C++/CLI)?

They had to come with new keywords, just to distinguish the case of "initonly" and "literal" for static members of a class. Of course the emitted IL uses the CLI (CLR) semantic of “literal” and “initonly“, so there are some other restrictions then the C++ “const“ keyword, such as the ability to change the value of an “initonly“ member in the body of the constructor, and some restrictions of the types that you may use for the “literal“ declaration. There is another (good one) restriction for the “initonly“, you can not cast the const away.

posted Thursday, April 14, 2005 10:03 PM by alon with 0 Comments

Implementing Policies in .Net (Another Template vs. Generic Episode)

I just wrote an article about the need for static class interface, and why C++/CLI is (almost) the only language that (will) support compile-time polymorphism. If you are familiar with the GOF Strategy pattern, you know that it lets you change an algorithm without breaking the Open/Closed principle (OCP).  A Policy is like Strategy, but instead of runtime late-binding polymorphism, it uses compile-time polymorphism and the resulting code is a hard coded call to the specific policy implementation. Read the article to find out how to implement Policy in C# and in C++/CLI and why a static class interface is a must.

posted Thursday, April 07, 2005 12:44 AM by alon with 0 Comments

Controlling Output cache

I have heard a lecture of David Platt about ASP.Net 2.0 that was held as part of the ASP.Net 2.0 tour. He talked about the new @SQLDependency directive that allows a Web Form cache to be invalidated according to a database table changes. At first this looked like a great cache policy improvement, but then many people in the audience have realized that it leads to coupling of the Presentation Layer with the DB layer as opposed to using the middle tier business logic layer. For example if I change the database schema, I have to go and change the SQLDependency tag on each and any page that uses it. Another issue that came up was whether the SQLDependency support other databases such as Oracle.

The answer to all those questions is that the cache mechanism is capable to any custom policy even on ASP.Net 1.1, You just have to register a delegate to set your own policy:

This example is extracted from the documentation:

public void Page_Load()

{

      Response.Cache.AddValidationCallback(new HttpCacheValidateHandler(Validate), null

}

public void Validate(HttpContext context, Object data, ref HttpValidationStatus status)

{

      if (context.Request.QueryString["Valid"] == "false")

      {

         status = HttpValidationStatus.Invalid;

      }

      else if (context.Request.QueryString["Valid"] == "ignore")

      {

         status = HttpValidationStatus.IgnoreThisRequest;

      }

      else

      {

         status = HttpValidationStatus.Valid;

      }

}

So feel free to create your own cache policy.

The only ability that I think that the ASP.Net @ directive is missing is the ability to add my own directives that will change the policy, something like:

@MyDependency …

For example, they could let us create a custom attribute that we could put in the page <% %>

 

Alon.

posted Sunday, February 20, 2005 12:59 PM by alon with 0 Comments

More XP SP2 Info for Web Developers

This is an excellent document for changes in XP SP2 for Web developers.

Pay attention to the last section (General Tips), it shows how to figure the browser version from client side script.

The link: http://msdn.microsoft.com/security/default.aspx?pull=/library/en-us/dnwxp/html/xpsp2web.asp

Note: This way of browser version detection did not work when I tries it on XP SP2 RC1. It worked well on RC2 installed machine.

posted Saturday, July 10, 2004 11:54 PM by alon with 0 Comments

Using Windows Firewall NetFwMgr from .NET application

There are two ways to use WF com object from .Net code:

  • Create the NetFwMgr dynamically using class ID and Activator.CreateInstance()
  • Use .Net interop assembly.

I prefer the second method. It is easier to use and make me feel better.

 The first method involves these two calls:

  1. NetFwMgrType = Type.GetTypeFromCLSID(new Guid("{304CE942-6E39-40D8-943A-B913C40C9CD4}"));

  2. //Create an instance of the object

  3. NetFwMgrObject = Activator.CreateInstance(NetFwMgrType);

The second method looks like this:

1.  using NetFwPublicTypeLib;

2.   //Get the FW Manager

3.   NetFwMgr mgr = new NetFwMgrClass();

4.  //create new application object

5.   NetFwAuthorizedApplication app = new NetFwAuthorizedApplicationClass();

6. app.Name = "CalcServiceHost";

7. app.Enabled = true;

8. app.ProcessImageFileName = @"C:\...\CalcServerHost.exe";

9. app.RemoteAddresses = "192.168.0.142";

10.  app.Scope = NET_FW_SCOPE_.NET_FW_SCOPE_LOCAL_SUBNET;

11.  //add application

12.   mgr.LocalPolicy.CurrentProfile.AuthorizedApplications.Add(app);

 

The only problem with the second method is that we have to add a reference to a type library which does not exist. Here comes the trick:

Use the MIDL compiler on the idl file of the NetFwMgr that resides in the include directory that you have installed with the XP SP2 Platform SDK. This will create the type library that you can refer to (using tlbimp.exe or via visual studio).

>cd C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\

>midl netfw.idl

Probably Microsoft will give us a PIA or something else to use the WF APIs from .NET app.

You may use the same MIDL trick to use the new attachment services as well.

For more Windows XP SP2 Links, refer to this article.

posted Tuesday, July 06, 2004 11:56 PM by alon with 0 Comments

Yes, Yes, Yes BT GPRS Works

I don't know what my last setting modification was, but now it works….
Maybe an administrator at Orange has changed setting there, or I have changed something, but it works, and it is great!!!
To be connected, anytime, anywhere, with my PDA and Laptop, Yes!

 

Alon

posted Friday, June 11, 2004 9:20 PM by alon with 0 Comments

New mobile phone, new toy, new headache...

My company decided to move to other cellular company. They have replaced all our phones. When they ask what kind of phone I'd like to have. I sad I did not care as long it will have a BT (Bluetooth) and a GPRS. I just wanted to connect my IPaq 5450 and my laptop to the internet. Guess what, BT is great, I synchronized the phone contacts with the IPaq and through the IPaq 802.11 I synchronized my desktop also as well as my laptop. The problems started when I tried to use the GPRS. I have searched the Internet, talked with the helpdesk at Orange, tried everything, and what I get is BT connected, Disconnected and an unknown error message in the IPaq that suggest me to Reboot the machine. After a day of trying I realized that there are three kinds of people in the world:
1. People like me that will do everything to make the technology work. They will search the Internet, They will try any settings, for example, they will not install Windows again, but will find how to fix the problem (even if it'll take more time then reinstalling)
2. Those that don't care about great new technology or they give up and save them self the headache.
3. Those that do want the new features and they in position to ask someone else (or they don't care to spend the money) to setup every thing for them.

And then I realized that all those company managers, owners and other very rich people are from the third group, and this is why we have to spend days and nights to make some new piece of technology in the right setup.
So, it someone can tell me how to set a BT GPRS between Nokia 6310i and IPaq 5450 PPC 2003, I will very appreciate it.
Thanks
Alon.

posted Friday, June 11, 2004 6:37 PM by alon with 0 Comments

Time for SAB

Yes, It's time for SAB - Scripting Application Block

If there is no support to VSA and we don't know anything about it's replacement. We should create SAB...

What do you think?

Alon

posted Wednesday, June 09, 2004 6:53 AM by alon with 0 Comments

To VSA or not VSA - This is the question...

Hello World

I thought that it will take me a while before I'll post a new remark, but I have to share this with you. I spend most of the day by searching, learning and deciding how to add scripting capabilities to a .NET project. I have found three main ways to do it:

  1. The obvious way – use .NET scripting technology, VSA: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting06112001.asp
  2. DIY – use reflection, CodeDom and such to create your own plug-in and scripting capabilities: http://www.divil.co.uk/net/articles/plugins/scripting.asp
  3. Use the good old VBScript technology – a great article from Roy Oshorove: http://weblogs.asp.net/rosherove/articles/dotnetscripting.aspx

With all my respect to Roy (and I do have) my customer wants to use .NET technology. Actually I have told him about VSA and he liked it. However after chasing all day for more information about VSA and try to find the VSA SDK (I even registered & downloaded the VSIP with hope that VSA SDK is hiding there…) I have found this response (http://www.dotnet247.com/247reference/msgs/38/194372.aspx)

"At this time we are not accepting new evaluations for VSA although we will
continue to support customers already in the program. We are evaluating
alternatives for the next version of VSA. In the meantime, we recommend one
of two approaches. If you are looking just for runtime customization and you
don't need an IDE you should use the ICodeCompiler interfaces in the .NET
Framework. If you need an IDE you should investigate integrating into Visual
Studio via the Visual Studio Industry Partner Program
(http://www.vsipdev.com/). We recently announced new levels of VSIP,
including free access to the VSIP SDK. Integrating into Visual Studio via
VSIP offers a more complete solution than VSA, offering WinForms and C#
support for example, neither of which is supplied by VSA. We appreciate your
patience and understanding as we work on our future direction. We look
forward to sharing more information with you as it becomes available".

Hope this helps

Mark

If anyone knows anything about the replacement of VSA, I will be glad to know. Also there should be some official guide from Microsoft telling what to do until their next .NET scripting technology. Unless I missed something they should have a page that announce the current state of VSA (It is not reasonable to search the Web for an answer)

Usually when I do software architecture for a new project, I try to choose the current technology that will be promote using an easy path to a newer technology in the future. For example Microsoft tells you today not to use Remoting internals (custom sinks, etc.) if you want an easy upgrade path to Indigo. Actually the best way to be prepared to Indigo is by using Enterprise Services. The same idea goes with scripting capabilities. I can create my own custom interfaces and use CodeDom and reflection, but I really don't know how much work I'll have to do when a new scripting technology will be available. At least they should give some whitepapers, please.

Alon.

posted Tuesday, June 08, 2004 9:44 PM by alon with 0 Comments

Hello

Web Log!!!

It's a history for me, this is my first post to my first Blog. It's amazing how people find new application types for the Internet. We thought that we have everything we need. Mail for asynchronous messaging, Web for static, and or application front-end, FTP for file transfer, Messenger & ICQ for instance messaging (synchronous).

But, now this, a Web Log: A way to tell the world what you think about it, and to get feedbacks from the world. You may think about it as a combination of all those other applications and in a way it is, and this what makes it so great.

So, my name is Alon Fliess and I am a Chief Technology Officer in a company named Sela – Software & Education Labs. In my everyday life I spend my time doing everything regarding to software and especially Microsoft technology based solutions. I like to see myself as a software architect (part of my job), but I am also teach, and consult other software engineers.

In my new Blog I will try to share with you my insight about many of the issues I run into every day. I will also try to ask you, the smart audience, what you think about those issues (This is the idea of Blog, isn't it?)

Until my next post

Bye

Alon

 

posted Tuesday, June 08, 2004 5:52 PM by alon with 0 Comments




Powered by Dot Net Junkies, by Telligent Systems