Categories

  • people from to throw things at?? How about people who will split their paychecks? That would count.. F.ing lame!
  • An excellent post on delivering real-time updates from .NET to JavaScript via WebSockets by using WebORB for .NET: http://t.co/8ONjyw59
  • We're working on some cool samples demonstrating Sencha component integration with WebORB's websockets and data management. Stay tuned.
  • For all Flexers out there, check out the following blog post, looks like a problem in ArrayCollection serialization: http://t.co/qbZuTEhy

Archives

Midnight Coders Latest News is Out!

A little delayed, but our February newsletter is out. This newsletter covers:

  • Connecting your Android apps to Java and .NET
  • Connecting your Blackberry Playbook apps to Java and .NET
  • Deploying your Java and .NET apps in various Cloud environments
  • Upcoming Webinars
  • Case Studies: Israeli Air Force and SA Media Group
  • Community Spotlight: Kurt Gramoll, PhD at the University of Oklahoma

If you didn’t get the newsletter via email, you can Read it Here.

Up next…QuizORB challenge for money, prizes and recognition…stay tuned!

When connect() never triggers a NET_STATUS message…

Let me save you about four hours of debugging.

You find yourself in the following situation: in your Flex client, you’ve allocated an instance of flash.net.NetConnection, and added an event listener, myNetStatusListener(), for its NetStatusEvent.NET_STATUS message. You call the instance’s connect() method, and your app runs fine, on every platform, and in every browser.

Except when running in a VMWare Windows virtual machine on top of the Mac OS. Then, and ONLY then, connect() never triggers a NET_STATUS message to myNetStatusListener() …not with “success,” not with “failure,” not with “rejected,” nothing.

I don’t know what the ultimate cause of this problem is, but I know how to work around it:Change Network Adapter from NAT to Bridged

  • in VMWare’s “Virtual Machine”->”Network Adapter” menu,
  • select “Bridged (auto-detect)” instead of “NAT”, as shown in the screenshot at right (click to enlarge).

Problem solved.  I think.

I hate bugs like this, because without knowing its ultimate cause, I can’t be sure that its work-around won’t break something else.  Say, for example, that you’ve got a problem with some other app, which can only be fixed by setting VMWare’s “Network Adapter” setting to “NAT”. The two fixes are mutually exclusive. You can fix one, or the other, but not both.

Sigh. Time does not permit me to dig deeper into the ultimate cause of this problem. If you know, please enlighten me!

Sometimes, programming is a twisty maze of little passages, all alike

— Jim

P.S.: Now that this bug is worked-around, some new Messaging samples will be uploaded shortly.

Server-side CPU Usage in WebORB

A month ago, Joel Kennedy posted a question on Stack Overflow (which I saw for the first time today), entitled Unable to deploy and use WebORB enabled C# program. On StackOverflow, I answer the question by referring to this blog post.

Joel writes that “I get the feeling I am making some silly mistake.”  I know EXACTLY what he means, because I made EXACTLY the same mistake, just this morning.

The Mistake: Forgetting that, by default, a new instance of the service class is instantiated (by WebORB) each time any of its methods is called.

The Fix: Declaring the attribute [ApplicationActivation()] on the service class, so that the same instance of the service class is used across the life of the invoking application.

His service returns the CPU usage of the server on which it’s running. Here’s a bare-bones example of how to use the [ApplicationActivation()] attribute on such a service class:

using System;
using System.Diagnostics;
using Weborb.Activation;

namespace examples.weborb
{
    [ApplicationActivation()]
    public class CPU_Usage
    {
        private PerformanceCounter cpuCounter;

        public CPU_Usage()
        {
            cpuCounter = new PerformanceCounter(
                                "Processor",
                                "% Processor Time",
                                "_Total");
        }

        public string GetCurrentCpuUsage()
        {
            return cpuCounter.NextValue() + "%";
        }
    }
}

Notice the [ApplicationActivation()] attribute, on line 7 above, decorating the CPU_Usage class. WebORB’s activation attributes are described in WebORB 4 for .NET’s online developer guide.

Here is the code for a simple Flex application that invokes the CPU_Usage service class’ GetCurrentCpuUsage() method via WebORB:

<mx:Application
	xmlns:mx="http://www.adobe.com/2006/mxml"
	layout="absolute"
	width="216" height="92"
	backgroundColor="#FFFFFF">

	<mx:Script>
		<![CDATA[
			import examples.weborb.CPU_Usage;
			import examples.weborb.CPU_UsageModel;

			[Bindable]
			private var model:CPU_UsageModel = new CPU_UsageModel();
			private var serviceProxy:CPU_Usage = new CPU_Usage( model );
		]]>
	</mx:Script>

	<mx:Button click="{serviceProxy.GetCurrentCpuUsage();}"
			   label="Get CPU Usage"
			   horizontalCenter="0" top="10"/>
	<mx:Label text="{model.GetCurrentCpuUsageResult}"
			  horizontalCenter="0" top="55"/>
</mx:Application>

I hope that helps! :)

— Jim

“Later version of .NET” error? Check local ASP.NET version.

Here’s how to avoid a problem that just bit me.

I was trying to deploy a new sample (showing WebORB Data Management for Flex, WDMF) to our  public Web server, and the sample refused to run, saying that it was built with a later version of .NET than my Web server’s version of IIS was configured to use.

WTF? I was very careful to build all of my server-side code to target .NET 2.0, to be maximally-compatible. Besides, the sample in question was 100% client-side code…the server-side code had been generated, compiled, and auto-deployed by WebORB, so I couldn’t have messed it up…aha.

The problem was that my local ASP.NET web server, on my development machine, was using .NET 4. Therefore, any code generated, compiled, and auto-deployed by WebORB’s console would be built within this same environment…and thus use .NET 4, too.

To fix this, I went to Windows->Control Panel->Administrative Tools->IIS->ASP.NET, clicked through to weborb4, right-clicked to bring up its Properties… page, selected the ASP.NET tab, and switched its ASP.NET version from 4 to 2. The image below shows the final screens. Problem solved.

Now, if I had compiled the server-side code myself, then I could have set all of the project’s properties, such as its .NET version, myself. But I’m way too lazy to do any work that I can have WebORB do for me instead.

So, now you know: if your production deployment of WebORB for .NET complains that a WebORB-generated/compiled/deployed assembly was compiled for a later version of .NET, check the version of ASP.NET used in the IIS virtual directory that houses your development machine’s WebORB console. Be sure that it’s not higher than the deployment environment’s version.

Happy coding! :)

Midnight Coders' October 2010 Newsletter is Online

Check out our October Newsletter online.  We’ve added many new features and have much to share with you.

Here’s what you can expect to find:

Awesome Product News

  • Added support for H.264 streaming media in both WebORB for Java v.4.1 (available now) and WebORB for .NET v.4.2 (coming very soon)
  • WebORB for .NET v.4.2 will now include:
    • Response caching
    • Apache NMS support
    • NHibernate support
    • MP3 playback
    • JSON client support
    • Basic data paging

ROI Whitepaper Maximize Online Application ROI through Efficient Integration

Call to Action

  • WebORB/Amethyst Update
  • Visual Studio Magazine – we solicited your help and it worked.  Thanks .NET Developers
  • InfoWorld – need your help with a review here
  • Technical Writers Wanted – if you’re interested in getting published we can help you.  We and our industry partners have many topics that need to be written about.

Great Customer Stories

Complete our Registration Form to receive our newsletter via email (see form at bottom of page).

More Updates on WebORB for Java

As promised, we’re going to keep pushing out more releases ASAP based on customer feedback and this is what we have for you on release number 4.0.2:

  • Added support for deployments in IBM WebSphere and Oracle WebLogic;
  • Enhanced ActionScript code generation for Java enums used in Spring beans;
  • Fixed a problem with data validation in data model creation wizard (WDMF);
  • Transfered all hard coded WDMF column to type mappings from code to the config file;
  • Fixed a problem with configuring date/time and thread name logging;
  • Fixed a problem with serialization of Number (primitive wrapper) types initialized to null. WebORB serializes these objects as NaN values.

If you’d like to track development, post bugs and/or suggest new features, please join us on our Issue Tracking System. We want to hear from you and we value your feedback.

If you’d like to download the latest release, simply Click Here.

Happy Coding!

Adobe Flash Development in Microsoft Visual Studio Is Easy!

Recently we announced an important technology partnership with  SapphireSteel Software that will enable developers to fully utilize the .NET framework for Flash and Flex development. Previously, .NET developers were required to learn and use a second IDE, such as Eclipse, if they wanted to develop Flash/Flex applications.  Now .NET developers can use their favorite IDE, Visual Studio, to rapidly develop and integrate these applications to services written in .NET.

SapphireSteel’s Amethyst removes the barrier to easy Flash/Flex to .NET development by providing a client-side development environment inside of Visual Studio. Midnight Coders’ WebORB removes the complexities of integrating multi-tiered environments and provides a graphical environment for data management, real-time messaging, streaming and MSMQ integration.  The partnership between SapphireSteel and Midnight Coders will produce a seamless integration between Amethyst and WebORB, enabling full scale (client- and server-side) development and integration inside Visual Studio. This will allow developers to be fully productive and the development process much more efficient, because developers won’t need to switch back and forth between two IDEs and they will simply be able to do more with Visual Studio, such as:

  • drag & drop design, editing and debugging of Flex, Flash and AIR applications
  • client-to-server-to-database integration and debugging
  • data modeling and management with full CRUD capabilities
  • integration with Azure
  • runtime engine

The integration between WebORB and Amethyst is expected to be complete by end of year.  Please subscribe to this feed or contact us directly if you are interested in learning more.

Simple Remoting ROI

My previous blarticle, WDMF, FoodAndDrinks:

  • Walked through the construction of a super-simple application that used WebORB Data Management for Flex (WDMF) capabilities, and
  • Showed that WebORB’s code generation, tied to its run-time encapsulation of n-tier enterprise architecture best practices, delivered an ROI of more than $23K.

In this much shorter blarticle, we’ll explore the ROI of using WebORB to handle remoting between a Flex-based client and .NET-based services, without the use of WDMF.

Choosing a Sample Service

Within WebORB’s console’s services panel, click down to

	.NET Assemblies->weborb.dll->Weborb->Examples->DataBinding

…as shown below.


I’ve checked the “Generate project file” checkbox, in the lower-right corner of the image above.

Calculating ROI

Now, I’ll click the “Calculate ROI” button (below the generated code window, on the left — see above), to find out what generating this code would save me in development costs.

Up comes the dialog box shown at right, showing the answer: $820.

Now, that’s not much, compared to the $23K saved by using WDMF to access the simple foodanddrinks database. However,

  • in an enterprise app, you’re going to save this kind of money for every service you access, which is going to add up fast, and
  • this code is not just generated, it also tested and debugged, which enables even greater savings of time, frustration, and money.

Bottom Line

If you’re doing simple remoting, using WebORB can save you a small fortune…and if you’re accessing a database, using WDMF can save you a BIG fortune.

Simple WDMF Walkthrough, with ROI

Last week, I struggled to install Microsoft SQL Server, gave up, and installed MySQL. This week, I’ll start working my way through the sample applications and documentation for WebORB Data Management for Flex (WDMF).

This blarticle will document a step-by-step walk-through of the creation of a WDMF-based application.

WDMF has been in WebORB for a few years now, but it has not been well-documented. These blog posts won’t fix its formal documentation — I’ll start addressing that soon — but they are a step in that direction.

Loading the Database

First, I loaded, into MySQL, the foodanddrinks sample database that ships with WebORB 4 for .NET. You can find it at

	C:\Program Files\WebORB for .NET\[version]\examples\flex\datamanagement\gettingstarted\FoodAndDrinks-MYSQL

…in which [version] stands for the version number of your installation of WebORB (say, 4.0.0.5).

WebORB 4 for .NET — which I’m going to call just ”WebORB” henceforth in this post — has, in its Management Console, a tab labelled “HELP/RESOURCES”, under which there’s a link labeled “Examples”, as shown below:


Clicking the “Examples” link brings up a tree menu, as shown below, which includes an entry labelled “FLEX EXAMPLES”.

Clicking the tree control through FLEX EXAMPLES->Data Management (WDMF)->Database Setup brings up the screen shown below:

Although the discussion in the main screen (“MySQL Database Installation”)  refers to MySQL Query Browser, which has been deprecated (as of December 18, 2009) in favor of MySQL Workbench, it is otherwise correct. (Updating WebORB’s documentation to correctly use MySQL Workbench instead of MySQL Query Browser has become another task on my to-do-list.) In MySQL Workbench’s Object Browser, the loaded foodanddrinks database looks as shown at right.

Connecting WebORB to the Database

Now that the foodanddrinks database is loaded into MySQL, we need to make WebORB aware of it. To do that, we’ll go back to WebORB’s management console’s “DATA MANAGEMENT” tab, which brings up a suite of data management control regions/pods, as shown below:

Having done all that, in the lower-left corner of the image above, see the word “DATABASES”? Just to the right of it is an icon of a vertical cylinder with a little green ‘+’ sign, which, if you hover over it, brings up the tooltip text “Ad New Database”. That’s exactly what we want to do — add the foodanddrinks database into WebORB — so we’ll click on the “Add New Database” icon. That brings up WebORB’s “Database Connection” dialog box, which I filled out as shown below (two images). The values you enter may differ.

The other image above shows the foodanddrinks database listed in WebORB’s management console’s DATABASES pod, with its tables (account, order, orderline, and product).

Building a Data Model

Now we need to create a data model based on the foodanddrinks database. We’ll do that by dragging and dropping it from the DATABASES pod up-and-right to the DATA MODELS’ table-display area, as shown below.

Dropping the database into this area brings up the “User Data Model” dialog box shown below.

I used the acronym “FAD” (Food And Drinks) to identify the namespaces; I’m not sure if that’s “best practice” or not (once I find out, I’ll update this post).

Exploring the Data Model

Notice that, in the ‘User Data Model” dialog above, I’ve checked the “Generate Test Drive” checkbox. Hold that in mind.

After creating the FoodAndDrinks data model, WebORB’s console looks like this:We see “FoodAndDrinks” listed in the DATA MODEL pod, and we see its tables listed in the table-display area. After resizing the window to make it  little smaller, and hovering the mouse over the “product” table, we see two little icons appear, as shown below.Hovering over the left-hand icon reveals the tooltip “Show records,” and pressing it displays a wealth of information, as shown below.
There is so much information presented on this screen that it’s hard to do it justice in a single blarticle. In this blarticle, I’m not going to dig deeply into this screen; I’ll come back to it in later blarticles.

Validating the Data Model

Our next step is to validate the data model. See the green tick-mark icon immediately above the “account” table in the table-display area? Hover the mouse over that (in the console, not over the image of the console in this blarticle!) and you’ll see a “Validate Model” tooltip, as shown below.

Click on the “Validate Model” icon. Of the three tabs below the the table display area — Table Data Preview, Output, and Validation Errors — the console will switch to Output, as shown below.
No errors — so far, so good. ;-)

Generating Code

Next, we’ll generate code, by clicking the “Build” icon — the one that looks like a gear, just rightward of the Validate Model icon, as shown at left. After the very slightest pause, entries in the Output tab will indicate that the code was successfully generated.

WebORB for .NET can generate code for either VB or C#; I chose C#. One might wonder (as I did) why WebORB generates code using C# 2.0, when C# version 4.0 was released earlier this year. Shouldn’t WebORB keep up with the latest versions? In this case, no — older is better, because it is the most widely-compatble. The latest C# compiler will accept C# v2 code, but older C# compilers won’t accept C# v4 code…unless it doesn’t use any of C# v4’s new features. And if you can’t use any new features, why not stick with the old version? Many of the features of C# 4 are super-cool (code contracts!  yea, Bertrandet al.!), and could add a lot of value to WebORB’s users, but we can’t (yet) impose C# 4’s use on many of our customers, who are still using older versions (for their own reasons).

Auto-Deploying the Service

Now..a magic trick!     :-)

Skip to icons rightward of the gear/Build icon, and you’ll see a icon that shows the Earth with a little green arrow; its tooltip is “Auto deploy server code”. Click it.

Now, what did these last two button-clicks do, exactly?

  • Generated code for the server, and test-drive code for the client.
  • Compiled the server-side code.
  • Deployed the server-side code to WebORB.

As we always do after deploying a service to WebORB, let’s go to its SERVICES management console to verify that the service has been deployed properly. After clicking the Refresh icon (two blue arrows pointing at each other’s tails), and clicking down the .NET Assemblies tree control we find — voila! — the FoodAndDrinks.dll in the list, with a bunch of services listed in its FAD_Server namespace.

I think this auto-deployment is downright magical. (I can say that, because I’m new here, so I’m not patting myself on the back.) WebORB for .NET does it using .NET APIs, whereas WebORB for Java does something quite similar using a different set of APIs (obviously).

But wait! There’s more!

To see the “more,” first, we’ll pop over to Flash Builder and

  1. Create a new Flex Project (specifying Flex SDK 3.5, since that’s what WebORB’s code generator currently emits), naming it “FAD_TestDrive” (or whatever);
  2. Add the WebORB path name to the Flex project’s compiler options (-services “C:/Program Files/WebORB for .NET/[version]/\web-inf\flex\services-config.xml”), where [version] is your WebORB version number (e.g., -services “C:/Program Files/WebORB for .NET/4.0.0.5/\web-inf\flex\services-config.xml”);
  3. Open the zip file at location “C:\Program Files\WebORB for .NET\[version]\weborbassets\wdm\output\FoodAndDrinks.zip”;
  4. Extract the files to the default location (“C:\Program Files\WebORB for .NET\[version]\weborbassets\wdm\output\FoodAndDrinks\”;
  5. Select the extracted “\FoodAndDrinks\client\src” folder, drag it to Flash Builder, and drop it on the root of the FAD_TestDrive project hierarchy, clicking the “Yes To All” button on any warning dialogs that might come up;
  6. Select the extracted “\FoodAndDrinks\client\libs” folder, drag it to Flash Builder, and drop it on the root of the FAD_TestDrive project hierarchy, clicking the “Yes To All” button on any warning dialogs that might come up;
  7. In Flash Builder’s Package Explorer, right-cick on the file testdrive.mxml; from the menu that pops up,  select “Set as Default Application” (thanks, Cyril!).

The resulting Flex project should look something like the one shown in Flash Builder’s Package Explorer at right.

WebORB generated this client-side project because we checked the “Generate Test Drive” checkbox in the “User Data Model” dialog box, way back in the “Building the Data Model” section of this blarticle. Remember when I told you to “hold that in mind”? This is why.

Running this Test Drive project brings up a bare-bones UI that communicates with the foodanddrinks database via WebORB, of which one screen is shown below.

This TestDrive UI is not cool-looking, but it works, and it works properly. It implements full CRUD (Create, Read, Update and Delete) for each table in the foodanddrinks database, with proper transaction processing, paging (see the “Page size” control in the upper-right corner of the image above?), and client notification.

This process has been so simple and painless that it’s easy to underestimate what’s been accomplished behind the scenes.WebORB’s generated code and run-time libraries, together, implement an architecture of design patterns and best practices that encapsulate the wisdom of the ages in n-tier enterprise application architectures, and make that wisdom available at the push of a button. It reminds me of an old joke.

A retired power-plant engineer’s quiet gardening is interrupted by a panicked call from his young replacement.”The plant has stopped! It’s producing no power at all! I’ve tried all of the emergency re-start procedures and nothing works! You’ve got to come back and fix it this week, or we’ll be bankrupt! We’ll pay you $100,000!  Come quick!”

The old engineer moves steadily through the silent power plant, examining every dial, switch, gauge, and lever. In less than an hour, he zeroes in on a single switch. He flips it, and the power plant roars back to life. The plant’s managers celebrate, patting each other on the back, until the old engineer says, casually, “I’ll take that $100,000 now, please.”

“You can’t be serious!” the plant manager cries. “We’re not paying you $100,000 to flip a switch!”

“That’s right,” the old engineer says. “I flipped the switch for free; the $100,000 is for knowing which switch to flip.”

Calculating ROI

With that in mind, there’s one more icon on WebORB’s console’s DATA MANAGEMENT tab that bears exploration in this blarticle: the “Calculate ROI” icon. It’s the little green dollar-sign icon, in the upper-right corner of the image below.

Pressing the “Calculate ROI” icon in WebORB’s data management console brings up the dialog below, which shows — for a given set of assumptions — the money saved by using WebORB rather than hand-writing (and testing, and debugging, and documenting, etc.) all of this code yourself.

With the default assumptions (which seem like reasonable defaults to me), using WebORB to produce the simple foodanddrinks database and its FAD_TestDrive application saved an eye-popping $23,645!

Using WebORB to handle remoting is way cool, especially when you’ve got to support a bunch of different client & server technologies at the same time. But I’ve gotta think that using WDMF is where you can save the really serious money. The bigger the project, the more you’ll save.

Now, WDMF has been in WebORB for a few years now…but it has never been documented before, aside from a few samples. WebORB 4 for .NET, released just a few months ago, included over 40 pages of WDMF documentation, making it easier to point-and-click your way to the highest-possible ROI.

So you can afford celebratory food and drinks all around.

Whee!   :-)

Installation problems? Me, too!

I’ve spent two solid days trying to install some variant of Microsoft SQL Server and its GUI tools for use with WebORB for .NET on my Windows XP machine.

There seemed to be a zillion version dependencies — OS, .NET Framework, SQL Server, Windows Installer, Public key Token = b77a5c561934e089, MSXML6, Visual Studio, Windows PowerShell, Management Studio, blah, blah, and blady-blah blah. Each possible combination led to a different show-stopping installation bug. Hammering the Web for fixes and workarounds turned up…nothing much.

All of this time, of course, my productivity was zilch, zero, nada, nul. Every tick of the clock was counting against me.

I got so frustrated, I bought a copy of “SQL Server 2008 for Dummies.” It didn’t help, either.

Then Cyril, my own personal Hero of Ukraine, said “why don’t you just use MySQL? It’s much easier.”

As a former Microsoft employee (1992-2000), it simply hadn’t occurred to me to use anything other than Microsoft’s database with WebORB for .NET. Obviously Microsoft’s own database software would be easier to install and use on its own OS, right? The promise of brain-dead-simple, problem-free, well-supported, cross-product integration is, after all, the entire reason for Microsoft’s existence.

MySQL was installed and working in half an hour. Why so long? Because while it was downloading, I had lunch.

Think, for a moment about what that means. It means that the relative quality of every other aspect of SQL Server means absolutely nothing to me, because I can’t install it. SQL Server could be faster; more secure; more robust; better integrated with Visual Studio; more scalable; organic, zero-calorie, free-range, and all-natural…but those features might as well be on the Moon. They might as well not exist. They are completely out of my reach.

Whereas MySQL “just works.”

Obviously, my experience with SQL Server isn’t “typical,” because SQL Server is selling pretty well, which it wouldn’t be if people “typically” couldn’t install it. Still…

The bottom line: My appreciation of the importance of WebORB’s installation experience has just gone way up. To those of you who have downloaded WebORB’s developer mode and had trouble installing it (you know who you are!): I feel your pain. I know where you’re coming from. Improving WebORB’s installation experience has gone way up on my priority list. I don’t want any of WebORB’s users to feel the intense frustration that I just went through.

Meanwhile, if you do have trouble installing WebORB, please let me know (jim [att] themidnightcoders [dott] com). I’m not yet in a position to fix the problem (sigh), but the more info I get now, the more rapidly and completely I’ll be able to help fix the problem later.