Blogs

Spell Checker Service

Submitted by Robert Szeleney on Mon, 2006-11-20 12:23.

A spell checker service has been implemented making it very easy to bring spell checking support to your application.

An application which wants to spell check just has to talk with the spell checking service, completely hiding the complex actual spell checking.

A short command line utility example to check a simple word and print suggestions if the word is not correct:

#include "libdcs/libdcs.h"

int main(int argc, char *argv[])

{
	sDCSInterface *pInterface;
	sDCSMessage   *pMessage;
	HRESULT hr;

	int iCorrect;
	int i;
	char str[255];

	char pWord[255];

	printf("Enter word to check: ");

	gets(pWord);

	DCS_RegisterInterface("Application.Spell.Source", &pInterface);

	DCS_AllocMessage(&pMessage, "Check");
	DCS_AddMessageString(pMessage, "Word", pWord);

	hr = DCS_SendMessage(pInterface, "Service.SpellChecker.Requests", pMessage);
	if (hr != S_OK)

	{
		printf("Spell checking service not running.\n");
		exit(1);

	}

	if (DCS_WaitForMessage(pInterface, NULL, &pMessage) == S_OK)

	{
		if (DCS_MessageGetInteger(pMessage, "Correct", &iCorrect) == S_OK)

		{
			if (iCorrect)
				printf("Word is correct.\n");

			else
			{
				printf("Word is not correct. Suggestions:\n");

				DCS_AllocMessage(&pMessage, "Suggestions");

				DCS_AddMessageString(pMessage, "Word", pWord);
				DCS_SendMessage(pInterface, "Service.SpellChecker.Requests", pMessage);

				if (DCS_WaitForMessage(pInterface, NULL, &pMessage) == S_OK)

				{
					i = 0;
					while (1)

					{
						sprintf(str, "Suggestion%d", i);
						if (DCS_MessageGetStringPtr(pMessage, str))

						{
							printf("%s\n", DCS_MessageGetStringPtr(pMessage, str));

							i++;
						}
						else
							break;
					}

				}
			}
		}
	}
}

This utility will output:

Enter word to check: heavn

Word is not correct. Suggestions:
heaven
heaving
Haven
haven
heave
heavy
Havana
having
heavens
Evan
Han
hen
Bevan
Devan
Kevan
heaver
Hahn
have
heaven's

As usual, you can easily disable/enable the service with System Manager.
This service will also be used by SkyOS GUI widgets, making it possible to auto-spell-check text in controls like edit fields and every text editor based on a text control.



SkyOS "Netcast"

Submitted by Kelly on Mon, 2006-11-13 01:47.

Just to go along with the new poll, it seems like for those of you that wanted to see some sort of a multimedia show, most of you liked the idea of one with video, audio, and screen content combined into one. I'm still trying to figure out exactly how to best accomplish this, but before I finalize anything, I just wanted to take a show of hands to make sure that there is some real interest in this. It is likely to take a bit of work on my part (no worries there), but I just want to make sure it isn't going to go to waste.


I was asked about the format of the show earlier. My initial thinking is that we would try to put one of these out just before or as a new beta is being released, to go over the new features, answer questions, and give an update about what is coming up next after the beta being released.



Wrapping up. Flash Support.

Submitted by Tomasz Dominikowski on Sun, 2006-11-12 12:12.

Alright, it seems we're close to releasing another beta build for our beta testers. The new USB functionality is finally working for Adamk "Mr Special Hardware", so we're ready in that department. If USB doesn't work for you, we won't believe you. No, but seriously, we just need to sort out some printing issues experienced by a few of our alpha testers and we're good to go. SkyOS is really looking good and ready as ever. For a beta build, that is.



A few words on desktop Communication Service

Submitted by Robert Szeleney on Tue, 2006-10-31 13:32.

Desktop Communication Service

The desktop communication service is a powerful interprocess communication system, used to communicate between applications, services, drivers and the kernel.

Internally, communication is based on messages which are based on DataCollections. Such a DataCollection Object is able to store an unlimited number of various datatypes like strings, values, etc.

Communication itself is done between interfaces, regardless where the interface exists. (kernel or user mode, application or driver, ...). This way it is very easy to, for instance,
send a message from a device driver to user applications.
Lets consider the USB stack and device attachement.
When the USB stack initialized a new just attached device it will send following message:

MessageType STRING "Attachement"
DeviceType STRING "Printer"
DevicePath STRING "/dev/usblp0"
Product STRING "Desktjet 5550C"
Manufacturer STRING "HP"
Status STRING "Ready"

to the interface Notify.Device.Attachement.*

The * in the interface name means: Send this message to all applications waiting for messages on interfaces starting with Notify.Device.Attachement.
For instance, on a fresh SkyOS installation, there are two applications waiting for messages on this interface. The notification panel - which informs you with a little message window at the bottom left side of the screen - waits for messages on Notify.Device.Attachement.Application.NotificationPanel. Additionally, the HardwareChangeService waits on Notify.Device.Attachement.Service.HardwareChange, immediately displaying the printer configuration dialog when you attached the printer.

Communication between applications is also done using the Desktop communication interface. For instance, sending this message:
MessageType STRING "Next Song"

to Notify.Media.Player.Control will cause all running mediaplayer applications to switch to the next song.

But sending the same message to

Notify.Media.Player.Control.MediaLibrary

will only tell MediaLibary to switch to the next song. Other media applications will continue playing the current song.

So, lets say you want to write an application displaying the current battery level. Thats quite easy:

#include "skyos/libskyos.h"
#include "libdcs/libdcs.h"
#include "skygi/skygi.h"

s_gi_msg m;

HRESULT Callback(HANDLE hInterface, sDCSMessage *pMessage,
char *pSource,
float fLevel)
{
printf("Battery level for '%s' is %f %%\n", pSource, fLevel);
return S_OK;
}

int main(void)
{
HANDLE hNode;

RemoteInterface_Create("Notify.Power.Battery.Change.MyApp", Callback, &hNode);
RemoteInterface_AddParameter(hNode, "Source", REMOTE_INTERFACE_PARAMETER_STRING,
"Level", REMOTE_INTERFACE_PARAMETER_FLOAT,
NULL);

RemoteInterface_Enable(hNode);

while (1)
GI_MessageWait(&m, NULL);
}

Thats all. When running this application, everytime the battery level changes you will see something like this:

Battery level for 'Primary battery' is 98%
Battery level for 'Primary battery' is 97%
Battery level for 'Primary battery' is 96%
....
....

Many similar things can be done with just this few lines of code, like :

  • reacting when the user made network interface changes or new proxy settings
  • new weather data arrived
  • new devices attached
  • devices removed
  • disks mounted/unmounted (e.g. Open viewer window or add desktop icon)
  • a song finished playing
  • new software has been installed
  • a gesture was drawn onto the screen
  • a failed login
  • an operation was not allowed because of security policy
  • etc.

Additionally you can perform actions by just sending such messages, for instance:

  • Power done, logout
  • Remote control applications (like mediaplayer, ...)
  • Soft-detach devices
  • etc.

To conclude, the Desktop Communication Service allows easy, fast, consistent and powerful communication between the kernel, drivers, services and applications.



Poll Explanation: SkyOS *Cast

Submitted by Kelly on Tue, 2006-10-31 03:14.

So I figured I would take this time to explain what I meant when I posted the poll question, "What would you think about a SkyOS *cast?" I've been listening to podcasts for the better part of two years now, and I thoroughly enjoy them, and find them to be a wonderful way to catch up on all the various tech news (of course it is not the only way, or even the primary way, but a wonderful way none the less). Additionally, I work for a company that revolves very heavily around screencasts (similar to a blog, an online form of media where the content is your computer screen, rather than simply audio). Finally, my background lies very heavily in video production, so I'm of course very into video, and the *cast version of that medium would be a videocast (or whatever you kids are calling it these days).