Category Archives: Technology - Page 3

Blowing up the planet… kinda..

Nice article from Phil Plait (The guy from Bad Astronomy) wrote an article about the math to do exactly this. Turns out it isn’t that easy (if possible/practical at all) but if you really, really really need to do it….

3 reasons we can’t blow up a planet sci-fi style

There is an easier way to solve the problem of you wanting to ‘kill’ a planet – just leave and find another one that would make you happy. It’s much easier and better (for us still living on this one…)

Windows 8 – Initial impressions

Well, I managed to get the Windows 8 Developer Preview installed (in a VM, see previews post) and my initial feeling is…. {drumroll} well, I like it mostly. There may be one or two little things that is ‘different’ or weird or feels wrong but mostly it looks good and works good.

Unless you have some kind of touch-screen (which I don’t) I doubt I’ll use the ‘Metro’ menu screen much. It may make sense on a phone device or tablet where you can use touch but with the mouse and keyboard – I don’t think so. I’ll fall back to the more traditional start-menu with task bar as soon as I can (when I can figure out how…)

The Windows Task manager has been changed quite a bit. There are lots more information available and the way it has been laid out looks better – What took them so long! šŸ™‚

Unfortunately virtually none of the example apps on the Metro menu work – probably since I don’t have a network connection set up for the VM. Ok, so I figured out that some apps simply fail to start because the screen resolution was too low. A warning message might have been useful.

The Ribbon control in Windows Explorer is actually nice (at least I seem to like it after getting use to ribbons using Office etc). Only pain is the lack of the ‘fine-zoom’ for the View-Layout like we use to have in Windows 7. That was sometime useful because I could resize image thumbnails to something between one of the preset sizes. That is not possible anymore.

Something I had some trouble with initially was how to get a plain command prompt window from Metro. Launching apps from the metro interface that’s not there already is at first not an obvious thing. Then I discovered that just by starting typing in the keyboard the search functionality kicks in and you should find what you’re looking for. I just wonder how good it would be for things that are not in any paths included by the search engine…

Another thing I could not initially figure out is how to get the machine to do a shutdown… Weird I know but apparently it is only available after you logged off or go to the ‘Settings’ screen and click on the ‘Power’ button. Perhaps in the tablet/phone world you might want to use different ways to put the machine to ‘bed’ but for a PC where you don’t want it running all the time this is a pain.

Well, let my ‘play’ some more…

So far so good Windows 8 team šŸ™‚

 

Update: One thing I forgot to mention – which is more a VM/VirtualBox issue, is that hardware virtualization must be enabled in the BIOS otherwise things don’t work so lekker… switching off hw-virtualization is possible but then things would be real slooooowwww’

Another Update: If you like to disable the Metro interface and return to the more ‘classical’ Windows 7 look try this (at your own risk): rename C:\Windows\system32\shsxs.dll to something like shsxs.old (but don’t delete it in case you have to restore it)

Windows 8 Developer Preview in a VM

Well, I managed to download the developer preview (full 64-bit one) and tried to run it using VirtualBox. Unfortunately the standard settings of VirtualBox doesn’t work for this Beta/Alpha/Test version for Windows but fortunately someone managed to figure out how to change the settings to at least get this VM started (without the lovely new BSOD)

See http://forums.virtualbox.org/viewtopic.php?p=200748

Now touch wood everything else in the set up works.

Microsoft Access Database Engine for 64-bit

Wow I must have missed this one when it was released but it (has the potential to) solves some problems with accessing Access databases (*.mdb) from a 64-bit process. I haven’t tested it yet and the description mention that you can only use the 32-bit driver on Windows XP (sp3) but at least it should work for Windows 7 (and yes that other one…Vista as well).

Download link: Microsoft Access Database Engine 2010 Redistributable

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13255

 

Quickmon

Background

Even as a developer you sometimes need to keep an eye on some things running on computer systems. If you are in a support or administration role it is even more important. Over the years I have developed or was involved in the creation of multiple systems in this ‘space’.

History

Years ago (14+ wow, feels like another life-time) I single-handily created and worked on a help desk tracking system called VHelpdesk first and then later renamed to Logidesk. That was back in my Vircom/Logical/3Fifteen days. At some point a version of this tool/system was even used by the Botswana government (via a service provider company). Those were interesting times… This system exposed me to the needs of service/operational oriented people that is/was helping other people in the IT world. You only really appreciate the needs of help/service desk people once you have to think like them.

In more recent years I’ve been more involved around the ‘BizTalk’ world – first for development but the last couple of years more on management and administration. In the process I had to create a lot of tools to help myself and others with these tasks. EventScavenger is one of those tools – but it is not the only one. Some of my tools are even used by others – even those in a full time production 24×7 environment. Yes, this is a little bragging – but if I don’t do it no one will šŸ˜‰

There’s an art to it

Creating monitoring systems properly is sort of an art by itself – then again any decent computer system requires that. There is a fine balance between functionality, complexity and user experience. In short, your users define what the system must do. Never forget that! Sometimes you are lucky – if you are your own user you first hand know what you want. Similarly, if the users are people that does the same as you it is fairly easy to create that system.

Monitoring verses Alerting systems

Before I go on about monitoring systems lets first define the difference between monitoring and alerting – as I use them. Monitoring is purely the action of gathering information about the state of something and then record it so it can be viewed afterwards. Alerting is something that builds on-top of or extend monitoring to automatically alert users when some desired (or usually undesired) state is reached. As an example, EventScavenger is just a monitoring tool. It does not notify anyone or anything if it encounters some error logged by some machine’s event log. Microsoft SCOM is an alerting system (and more – it not only alerts but can actually automatically run some corrective script to attempt to fix something that has gone wrong).

Quickmon

A year or three ago I created something simple to monitor multiple types of computer system related entities with a plug-in architecture. I never really finished it properly but surprisingly it actually works to this day. Al it does is to gather some state data and present it as a simple icon on the taskbar (or originally in the XP day the notification area). You can open a detail window that display the state of each ‘agent instance’ to see what its individual state is. Further, you can also open an even more detail presentation of the particular agent’s details.

There are multiple agents – each with a different function but they all implement the same (.Net) ‘Interface’. Adding a new agent type is as easy as implementing the required interface and ‘registering’ the assemble/dll with the main app. The idea is/was that it should be extendable without having to change the main app at all. The agents I created so far (but never went on further) are: Ping, Service state, File count and one special one to monitor the number of suspended BizTalk instances (this was the one that gave me the idea). In the main app you can create a list of agents, mixing any number of them, duplicates of the same type of agent with different configs etc. This list of configs can be saved to a file (plain xml) so you can have multiple sets of things you want to monitor.

Agents

As an example: the Ping agent. This agent is configured to ping a list of machines – each entry has a maximum allowed ping time and time-out time. When the main app calls this agent instance it only returns one value – the ‘worst’ state of all the states of all the ‘pings’. If (any) one ‘ping’ times out the total state is ‘error’. If any one ping exceed the maximum allowed value the total state is ‘Warning’. Otherwise the total state is ‘Good’ or OK. You get the idea. How/what an agent define as error, warning or good is up to the implementation of that particular agent.

Other than the main GetState() method the agent must also support (Windows Form) interfaces for (1) ‘editing’ its config and (2) displaying details about the states of things it monitor.

What has become of Quickmon

Quickmon sounds all nice but at some point the complexity and time (and willpower) to go on stopped me to develop it further. As it is it works like explained above but I have some new and additional ideas I would like to add. The ‘current’ version is purely visual monitoring tool. It does not record history. I never completed an easy way to initially set up the app with its registered agents (have to be done manually so far). It was created in .Net 2.0.

Funny thing is, I started using it again ‘as is’ but I decided to start a new project based on the same idea and extending it. The only issue (again) is time.

New project

The new project will take the old Quickmon concepts like a plug-in architecture, grouping or rolling up resulting states and having each agent define its own functionality. Some new ideas I have are:

  • Adding alerts/notifications – also using a plug-in architecture. e.g. Log file, RSS feed, SMTP, database table.
  • Make it into a Windows service (but also still have a UI part)
  • Having dependencies between agents – e.g. If a machine is not pingable then don’t bother checking any service states…
  • Adding some more agents – e.g. Disk space, Database/table size, Event logs (touching on EventSavenger grounds here) etc.

One problem with all these ideas is that the more functionality I add the more complex it becomes to manage – this is true for any project. Also, it might start competing on territory where commercial products are – like SCOM… and I don’t want that…

I have started with this project and have some working ‘bits’ already. Perhaps I must see if there are others that might be interested in collaborating on this project – just an idea. Any takers?

 

Space, the final frontier?

Being a bit of a space/science nut and also a sci-fi lover I often read articles related to these things when I get a chance. Yesterday I happen to stumble across a few images of some old space station ideas dating back to the 60’s/70’s with the O’Neil cylinder/Three island concept. People that time had really grand ideas where we would be by ‘now’. Perhaps it was a bit ambitious but at least they dreamed and saw some hope for ‘all mankind’.

Fast-forward to present time. We have no big space stations, regular space trips, no bases on the moon or mars, no traveling to the stars – not even (tangible) plans for any of these in the immediate or near future. Seems everyday things like politics, money, power (the political kind) are too important for anyone to still have great dreams for ‘man kind’. Funny, all those things are the ones our ‘mothers/fathers’ warned us about to avoid… but we don’t listen, like usual.

Even on the fictional track of life things are dying. When last did we have a good sci-fi show (space oriented)? I’m busy watching the whole Babylon 5 series on DVD and this is probably what started making me think about these things. I long for the times I had ‘time’ (and the willpower) to do proper reading of a good sci-fi book. The last book I was busy with but somehow abandoned was the third Rama book (like in Rendezvous with Rama).Ā  Damn, I must make time for that again… Why did sir Arthur C Clarke had to go and die? I miss him!

Why did ‘we’ stopped dreaming big?

The future of development on Windows

Thanks to a link on Slashdot (yes, I read that too) I came across an article on Arstechnica about the (possible) future of development on the Windows platform in the future.

After the initial announcement that Microsoft is changing the fundamental way Windows 8 and writing custom applications they went into a ‘information freeze’ and are not giving more info on the subject. The reaction of several bloggers and the speculation that follows isn’t making things better. The Html5 and JavaScript message may not be the all and everything.

However, from the leaked (or released) testing versions so far it seems the situation is a bit more complex but perhaps not as bad as some developers are fearing. The author of the article goes on explaining the history around how longhorn was planned but ultimately dropped to support only existing (at that time) technologies. It can only be that the internal politics inside Microsoft causes so much turmoil and the ‘old’ side won. A lot of newly planned technologies got dropped in the process and the result was Windows XP without all those features promised (like WinFX etc). Then that Windows XP and the hackers story started and further derailed any possibility of new technology getting into the core platform. Even now with Windows 7 the .Net framework and related technologies are really only an ‘add-on’ and not used by the core of the OS. This is (according to the article) where Windows 8 is going to change things again – big time!

If the article proof to be accurate then there may be some hope for Microsoft still. The problem is just that old enemy – themselves, as internal fighting against change might make things more difficult. However, because of the changes in the market recently (last few years) Microsoft might not have the luxury anymore to just play around and ignore the internal politics. They have been surpassed by several competitors (yes, not just Apple) and survival is not guaranteed anymore. Any bugger-ups now can actually cause the company to go the way of the dodo. They better get it right. Perhaps with this thread hanging over their heads they are taking things more seriously and that is why they are not talking openly anymore about internal changes. The only next planned release of a build of the new Windows is scheduled around September so we’ll have to wait and see if/how things have changed.

In the mean while it might be a good thing to continue learn how to use XAML and WPF… (even though WPF is giving me headaches šŸ˜‰ )

User interfaces

The following is just some ideas/thoughts/comments on user interfaces.

There are lots of things that can and has been said about computer user interfaces. Ever since the first computers the way a person interact with a computer has been changing – but very slowly. If you go by popular science fiction then we should be talking and even mind controlling computers by now but I don’t think we’re quite there yet, if ever.

The last 2 decades or so most development into computer user interfaces has revolved around the Graphical User Interface (GUI) and the keyboard and the mouse. Now and then some different way to interact with the GUI has come along like touch screens and even the failed light pen. Voice input/output has been tried but this is generally the exception. I can’t help thinking about Star Trek when I think about interacting with a computer by voice… ‘Computer, tuna mayo sandwich please!” – of course you need a replicator as well šŸ™‚ In those scenarios there (usually) were no real GUI to talk about as well. Ah, we can only dream…

The point it that most of these interfaces still use some computer screen with text and pictures (graphics) to display what the computer ‘is thinking about’. Most of that is also limited to 2D interfacing – with the exception of games where you ‘play’ a character moving around a virtual 3D world. I have seen attempts of creating a generic 3D GUI but it was ‘still’ displayed on a 2D monitor (with keyboard and mice as user input). Even today with more and more devices that uses ‘touch’ like in touchscreen we’re still stuck in a 2DĀ  world. It turns out processing voice and sound as input is very ‘computing heavy’. Outputting sound/graphics is of course very easy but that is generally a ‘dumb’ or scripted way of dealing with a computer. Any tape recorder could do that – like what they did in the 60’s/70’s. However, if you want to interact with a computer the input part is also, if not the most, important.

To my knowledge, even the best speech recognition software today still take a lengthy time to be ‘trained’ to (fairly) accurately accept some voice commands. Even then it is usually only from one person. If another guy comes around the whole story has to be done from scratch (almost). Also, most ‘applications’ don’t support that way of user interfacing anyway. You really have to admire our human brains for doing these things without all that effort! We are much better at interfacing verbally and visually with each other. It’s a shame that our machines that we create cannot do anything similarly (by that I mean to do these things so easily).

The same I suppose can be said about ‘graphical’ input but at least it seems things in that department is changing a bit. With Microsoft’s Kinect technology it is becoming easier to interact with a computer (mostly graphically). It is a shame that they first only released it for a gaming console (despite that they claim it is more than a gaming platform). At least now with the new SDK we can start using it for a PC as well. Unfortunately I don’t have one – and the wife won’t allow it soon for financial reasons.

In the mean while I’m also still stuck in the 2D interfacing world, writing programs that still use the keyboard and mouse. But it isn’t all bad really. This way has served us for many years and probably will for many more. ‘If it isn’t broken don’t fix it’. Still, I can dream.

 

Windows 8 and compatibility

Yesterday I saw an article on Ars technica about how Microsoft is planning to give Windows 8 a totally new API (Application Programming Interface) that will break compatibility with most existing and past development tools – like Visual Studio. If this proof to be true then I think Microsoft has just signed their own death warrant (from an individual developer point of view). So much for having a usable Operating System (from a developmental view). All the experience we ‘developers’ gained the last decade or so will be basically useless (except HTML and JavaScript).

In a way I can understand why Microsoft would be doing such a thing. They are desperately trying to play catch-up in the market and needs to do more and more radical things just to stay relevant and alive . They have never been strong in creating a development technology and sticking with it. There is too much internal politics and infighting going on. The result is that they are failing faster and faster each time. But don’t count them out yet – Apple was once in that position and jumped back into life. For Microsoft’s sake lets hope they can also do it. Perhaps they must use their billions while they still have some to buy Steve Jobs šŸ˜‰ – or ask uncle Bill to come out of retirement.

I must admit I really like C# so it would be a sad day if I have to hang up my C# ‘gloves’, so to speak.
Well, if I have to abandon the development knowledge gained the last decade I would rather choose something that will not limit me to Windows and Microsoft only. Ironically it will probably turn out to be something in the line of HTML and JavaScript. Perhaps Microsoft has a good idea there but it won’t help them keeping the skills in ‘their court’ since these are open standard technologies. In the next couple of years things could get really interesting (or chaotic…)

Multilingual applications

Living in the good old S of A it is natural for us to be bilingual or even multilingual. So what do we do if we have to create software that can/must be used by people of multiple language backgrounds? Traditionally Microsoft had the concept of resource files that you can use to create multiple versions of the same application for different languages or locales. Problem with this is once the executable has been compiled it is also fixed. What happens if you want the application to be multilingual at ‘run-time’?

Well, I’ve had to do something like this for myself. I first looked at resource files but it just did not solve the whole issue on its own. So I started creating something for myself that works for my application. Part of the solution still use .Net resource files for storing xml data that gets use in the language look up procedure. The idea is to load the text of controls and windows at the time the window open since control and window text get loaded at run-time anyway. The following is an explanation of the classes I created to facilitate my solution. It is a fully working solution and already in use inside a proper application. There may be other and even better or smarter solutions ‘out there’ but this one works for me.

LanguageHandler

This is the central class that handles all the language setting/reading etc. functionality. It encapsulate the list of ‘phrases’ used in the application and provides methods to retrieve words or phrases depending on a look-up key. Simply translating words alone is not good enough so the focus is on whole ‘phrases’.

The following is a partial view of the class without methods:

public static class LanguageHandler
{

private static List<Phrase> phraseList = new List<Phrase>();

#region Properties
private static string languageID = “en-za”;
public static Language AppLanguage {

get {

switch (languageID) {
case “af”:
return Language.Afrikaans;
case “en-za”:
return Language.English;
default:
return Language.Afrikaans; }

}
set {

switch (value) {
case Language.Afrikaans:
languageID = “af”;
break;
case Language.English:
languageID = “en-za”;
break;
default:
languageID = “en-za”;
break; }

}

public static string PhraseSource { set; get; }
#endregion

}

PhraseList.xml

The definition of the phrases can probably be stored in any data form but I choose a plain simple xml file to host the raw phrase data. This make it easy to maintain and port. It is also included into the application as a file resource although theoretically it could be located anywhere as long as the application can reach it.

The structure is also very basic as it is simply a serialized version of List<Phrase>

<?xml version=”1.0″ encoding=”utf-16″?>
<ArrayOfPhrase xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<phrase id=”someId” default=”Some default”>

<phraseEntry lang=”af”>Afrikaanse waarde</phraseEntry>
<phraseEntry lang=”en-za”>English value</phraseEntry>

</phrase>
<phrase id=”someId2″ default=”Some default 2″>

…

</ArrayOfPhrase>

LoadPhrases method

Loading the data is as simple as deserializing the data. I have a helper class (not shown) to simply take the xml file and deserialize it:

#region LoadPhrases
public static void LoadPhrases()
{

if ((PhraseSource != null) && (PhraseSource.Length > 0))

phraseList = SerializationUtils.DeserializeXML<List<Phrase>>(PhraseSource);

}
#endregion

GetLanguagePhrase method

The main (and only relevant) method for retrieving stuff from the class is GetLanguagePhrase. It simply takes one parameter – the id value of the phrase required.

#region GetLanguagePhrase
public static string GetLanguagePhrase(string languagePhraseID)
{

if (phraseList.Count == 0)

LoadPhrases();

Phrase phrase = (from p in phraseList where p.LanguagePhraseID == languagePhraseID select p).FirstOrDefault();
if (phrase != null)
{

PhraseEntry phraseEntry = (from pe in phrase.Phrases where pe.LangId == languageID select pe).FirstOrDefault();
if (phraseEntry != null)

return phraseEntry.Text;

else

return phrase.DefaultValue;

}
throw new Exception(“Undefined language phrase ID”);

}
#endregion

SetControlTextAndTip methods

To make it a bit easier to set the text (and tooltips if available) of controls (my implementation use WinForms) I created a few helper methods to automatically set the text on the control based on a phrase id specified.

#region SetControlText
public static void SetControlTextAndTip(string languagePhraseID, params ToolStripItem[] tsis)
{

string text = GetLanguagePhrase(languagePhraseID);
foreach (ToolStripItem tsi in tsis)
{

tsi.Text = text;
tsi.ToolTipText = text;

}

}
public static void SetControlTextAndTip(string languagePhraseID, params Control[] crtls)
{

string text = GetLanguagePhrase(languagePhraseID);
foreach (Control crtl in crtls)
{

crtl.Text = text;

}

}
public static void SetControlTextAndTip(string languagePhraseID, params ColumnHeader[] columnHeaders)
{

string text = GetLanguagePhrase(languagePhraseID);
foreach (ColumnHeader ch in columnHeaders)
{

ch.Text = text;

}

}
#endregion

The Phrase and PhraseEntry classes

These two classes are really simple. For the purpose of this article they could be a lot simpler but since I built a separate ‘editor’ they have a bunch of attributes to make editing easier. This editor plus a few method inside LanguageHandler will have to wait for another article.

[Serializable, XmlType(“phrase”)]
public class Phrase : IComparable
{

[XmlAttribute(“id”),
Browsable(true),
CategoryAttribute(“Identifier”),
DefaultValueAttribute(“”),
DescriptionAttribute(“Phrase ID”),
ReadOnly(true)]
public string LanguagePhraseID { get; set; }
[XmlElement(“phraseEntry”),
Browsable(true),
CategoryAttribute(“Value details”),
DefaultValueAttribute(“”),
DescriptionAttribute(“Phrase entries”)]
public List<PhraseEntry> Phrases { get; set; }
[XmlAttribute(“default”),
Browsable(true),
CategoryAttribute(“Value details”),
DefaultValueAttribute(“”),
Editor(typeof(MultilineStringEditor), typeof(UITypeEditor)),
DescriptionAttribute(“Default value. Use ‘\\r\\n’ to indicate crlf.”)]
public string DefaultValue { get; set; }

#region IComparable Members
public int CompareTo(object obj)
{

Phrase otherPhrase = (Phrase)obj;
return LanguagePhraseID.CompareTo(otherPhrase.LanguagePhraseID);

}
#endregion

}

[Serializable, XmlType(“entry”), TypeConverter(typeof(PhraseEntryConverter))]
public class PhraseEntry
{

public PhraseEntry() { }
public PhraseEntry(string phraseEntryDef)
{

if (phraseEntryDef.Contains(“:”))
{

LangId = phraseEntryDef.Substring(0, phraseEntryDef.IndexOf(“:”));
Text = phraseEntryDef.Substring(phraseEntryDef.IndexOf(“:”) + 1);

}

}

[XmlAttribute(“lang”),
Browsable(true),
CategoryAttribute(“Phrase entry”),
DefaultValueAttribute(“”),
DescriptionAttribute(“Language”)]
public string LangId { get; set; }
[XmlText(),
Browsable(true),
CategoryAttribute(“Phrase entry”),
DefaultValueAttribute(“”),
Editor(typeof(MultilineStringEditor), typeof(UITypeEditor)),
DescriptionAttribute(“Text”)]
public string Text { get; set; }

public override string ToString()
{

return LangId + “:” + Text;

}

}

Using it all

Using LanguageHandler is really easy. Typically in a form’s onload event I call a private local method that sets all the texts of the controls that need to be set. There is no real performance issue to worry about since all the phrase data is stored in memory. One disadvantage is that normally the form need to be closed and reopened if the ‘language’ has change. This is not really a problem since changing the language is something that should not happen often. Technically this private LoadLanguageResources method could be ran any number of times whenever you want. The only place where I usually call it multiple times is on the ‘Options’ dialog where you choose the language being used.

If you have to use the same phrase multiple times you can always store the value in a local string variable.

The following is a short example of how to use it:

static class Program
{

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{

…
if (Properties.Settings.Default.LanguageID == “English”)

LanguageHandler.AppLanguage = Language.English;

else

LanguageHandler.AppLanguage = Language.Afrikaans;

LanguageHandler.PhraseSource = Properties.Resources.PhraseList;
LanguageHandler.LoadPhrases();
…
Form mainForm = new MainForm();
…
Application.Run(mainForm);

}

public partial class MainForm : Form
{

….

private void LoadLanguageResources()
{

Text = LanguageHandler.GetLanguagePhrase(“AppName”);
LanguageHandler.SetControlTextAndTip(“File”, fileToolStripMenuItem);
LanguageHandler.SetControlTextAndTip(“NewPerson”, newPersoonToolStripMenuItem);
…

}

private void MainForm_Load(object sender, EventArgs e)
{

LoadLanguageResources();
…

}

…

}

Summary

As you can see the solution is not really complicated. I really like simple solutions that ‘just works’. This one has proven to be working for my needs so far. I have over 340 different phrases, some are very long themselves like message box prompts.