Tag Archives: technology

Creating daily log files

In the (wild) old days when the only thing we had to work with computers were the command line we use to store output of important processes to a (text)file so it can be viewed and worked on afterwards. Event today in a support and administration environment these skills are very handy.

The process of doing this was/is called ‘output direction’ or ‘pipe output to’ since the standard output ‘device’ was the console (command window). So taking the application output away from the console meant redirecting it to a ‘file’ – since in a sense the ‘console’ could also be seen as a file that gets stuff outputted to (a temporary one).

Anyway, say you want to save the output of a command line utility like ‘dir’ to a file – you would use the following:

dir *.txt > dir.txt

All this does is execute the normal ‘dir *.txt’ command but store the output to the file ‘dir.txt’. This only outputs the standard ‘console output’ to the text file. If the output file already exists it gets overwritten. Actually there are two types of ‘standard outputs’: 1 – the normal successful and 2 – the standard error output. Using only the ‘>’ operator is just a shortcut for ‘1>’ which only outputs the ‘standard successful’ output i.e. the previous example is the same as:

dir *.txt 1> dir.txt

The second type of output is the ‘standard error’ output. To get this output you use the ‘2>’ operator e.g.

Someexe.exe 2> errors.txt

If you want to combine the outputs – that is both normal and error outputs you can use this:

Someexe.exe > errors.txt 2>&1

Lets say you want to keep a history of all previous outputs – then you want to use the ‘append’ operator ‘>>’:

Someexe.exe >> output.txt

If the file ‘output.txt’ does not exist yet it will be created. Otherwise and new output will simply be appended. If you want to combine all of these – that is combine normal and error ouputs plus append to the output file you can use this:

Someexe.exe >> output.txt 2>&1

Now, say you want to use part of the date when creating, listing etc. files. Unfortunately this tip depends on the date-time format settings of the machine you are running it on. For my example I use the ‘yyyy/mm/dd‘ format. To get the year you can use the following:

set year=%date:~0,4%

To get the month you can use ‘%date:~5,2%’ or day ‘%date:~8,2%’ – again this only works for the ‘yyyy/mm/dd’ format. If your date-time format is different you have to change the ‘~x,y‘ parts where x is ‘from’ and y is ‘to’ character positions.

Now using the example above you can use:

dir %year%*.txt

to file all files with a name that start with the current year (e.g. 2012blablabla.txt)

You can use the same technique when creating output files, e.g.

dir *.txt > %year%List.txt

This way you can create daily log files e.g.

set year=%date:~0,4%
set month=%date:~5,2%
set day=%date:~8,2%
Someexe.exe >> %year%%month%%day%.log

Mission accomplished… for now.

A new year – 2012

A new year has come and perhaps some things might be different (if you believe all that Mayan calendar stuff etc.) but mostly it probably would be a case of ‘more of the same’ with few sporadic changes here and there. Sounds like a weather forecast…

On the personal front there is at least Mass effect 3 to look forward to and ‘moa’ hitting the big 4 later the year (like in 40).

On the technology front, hopefully this year would be the (start of) year of Microsoft entering the successful tablet market (lets not mention the previous attempts that went nowhere). I’m still not impressed with the Windows 8 metro interface – for traditional PC’s and the fact that they (Microsoft) is again abandoning their own supporters (.Net and specifically Windows applications). Seems it is the one thing you can count on from them – no matter how much they push something they eventually will drop it and the whole community that supports it.

Apple had a few good years but I suspect that will come to an end soon as there are now too many competitors and mr Jobs is not with us anymore. They have been loosing more and more court cases and their products are not that much more ‘better’ than the rest. However, expect them to hang around for a while as they have become so big that quick failure is not that easy anymore.

Google and the Android/Chrome crowd may reaching new heights and Firefox (and IE) will continue to loose market share. That is a bit of a sour point – ever since Firefox started to do things ‘Chrome’ style they have been chasing the ‘others’ in the market instead of leading by example. I’ll still use Firefox for a while though… IE will probably loose even more ground this year as no one takes it seriously anymore. The bad name that IE6 gave it (plus the anti-trust case remnants) will prevent any new market share growth soon.

If by chance the Mayans had it right then at least we don’t have to worry anymore about global warming, corrupt politicians, no good sci-fi, invasion from Mars or anything remotely as bad. But enough of the moaning and groaning…

Or maybe I must just admit I’m getting old…

 

Phone cameras

First off, I’m no super expert on cameras or optics but this is something that bugs me about all these ‘photographers’ that think their phone is a super camera.

These days just about every phone out there – even the cheapies, have some camera built in. The trouble is they are all pretty much useless for doing real photography. The reason is pretty simple – physics (or more specifically – optics).

You can have a super camera sensor but if the lens is not good the output picture will still be crappy. The opposite is you can have an average sensor with a good lens and your pictures should be good. Why? The reason is simple – a good picture requires more photons/light – plain and simple. The tiny lenses on all camera phones make it impossible to generate a really good picture. This is still one area in ‘life’ where bigger ‘is’ better. The bigger surface area you have to capture photons/light the better. Ask astronomers why they keep on building bigger and bigger telescopes despite all the progress in other areas of technology. You need to capture more light to get a better picture – especially if you want to zoom in and crop. Of course, the bigger the lens the more difficult it is to make it.

I still have an old Canon S3-IS which is ‘only’ a 6 megapixel camera but its pictures are still better than any of my modern camera phone pictures (which has something like 8MP sensor). As explained above the sensor size has little to do with the picture quality (within reason). The only real advantage of a phone camera is that I’m more likely to have tit close by most of the time – oppose to my bigger cameras.

The same basically applies to things like tablets – like the iPad and so on. Basically any device that has a ‘little’ peephole camera will have the same issue.

All I can do when I see one of these ‘modern day’ photographers is to smile…

QuickMon Version 2.3 and Installers

I’ve now updated the QuickMon installers to include some ‘new’ functionality that allows you to choose to install the Windows service as part of the MSI installation.

There are still a few possible quirks – like what happens when you choose not to install the service initially (and do it manually afterwards) or when uninstalling the MSI (without removing the service manually) and then installing a new version ‘and then ‘choosing to install the service. In that case you get an error message that the service is already installed (duh as if you don’t know), the MSI Installer fails and rolls back completely. The solution (one of them) is to simply install the MSI and not choose to install/register the service in Service Manager.

Installers

I’ve learned a whole bunch of new ‘things’ about the standard VS installer during all of this. Mostly how limited the build-in Installer technology is but also some tweaks you can do to still (despite) get something good out of it.

Here is a few tips I came across:

1. When you add a ‘Checkboxes’ custom dialog to the ‘User Interface’ of the installer and want to use the checkbox value as a condition in one of the Custom Action it must look like this e.g: ‘CHKINSTALLSERVICE=1’  (without the quotes). I tried all kind of weird combinations like =”True”, =”1″ etc. that didn’t work…

2. You can have the MSI Installer call the ‘Installer’ classes housed inside your service project (and automatically install it) by adding a ‘Custom Action’ – ‘Install’ action. The default for it is to look for any installer classes inside the assembly. Similarly you can add the same for ‘Uninstall’ but this requires that the service has actually been installed (which is a problem for me since the user can choose not to install it at all)

3. Adding the “-install” and “-uninstall” parameters is nice and all but please remember to run it under an Administrator account (elevated) otherwise it simply fails with an “Access is denied” error. If you understand why then it seems obvious but for people that do not know about this it could be a pain (the error message does not tell you why ‘Access is denied…’)

4. The whole ‘backwards compatibility ID generation thing still baffles me. Upgraded projects (from VS2008 to VS2010) does not show it and the default on VS2010 is false. If not set it seems each time you install a newer version any copy of your shortcuts (like pinned to the taskbar) becomes ‘invalid. This is really a big pain (yes, it is probably easy enough to just unpin/pin again to fix it…)

5. The whole ‘Target platform’ thing is a mess – especially when the solution is under source control. Why do you have to check out the whole project just to change the Target platform setting to rebuild the MSI installer? Why is there not an option to build ‘both’ x86 and x64 at the same time (separate directories or something)?

6. Yes, using a better Installer tool like Wix will probably help… still need to learn how to use it. Anyone have some good tutorials somewhere? 🙂

 

Firefox 7

And there they release 7. So far can’t see any major differences as far as I’m concern (other than a few broken add-ins which hasn’t been updated)

Post PC world

I read somewhere this morning (one of the RSS feeds from techreport.com) about someone (not pointing fingers) that made another claim that we are going into the ‘post-pc’ world… Right, I almost burst out in loud laughter!

Definition

So what exactly is a ‘personal computer’? Or more specifically, what do you understand from the words ‘personal’ and ‘computer’? Surely anything that has computing power – like a classical ‘PC’, smart phone, tablet, laptop, abacus 😉 etc. and is a personal ‘possession’ can be classified as a ‘personal computer’… sorta. Yes, even that fancy stupid little iPad/iPhone etc falls under that description. Actually, it is just another iteration of the ‘personal computer’ idea. Nothing more. Move along fruity fanboys.. 🙂

Conclusion

The conclusion I can make about these statements (like mentioned in the first paragraph) is that it is merely a ‘sales’ pitch from someone trying to sell or market something they will get some benefit from. Period.

Desktop computer

Now here is a device that may be becoming a bit ‘old’. But I doubt it will disappear anytime soon. All we really still need from them is to be able to ‘verbally’ respond back to our commands… er wait, that is my 2051 comment for pc’s… Anyway, Don’t always believe what those sales/marketing crooks tell ya. All they really want is your money!

Windows 8 – A couple of follow-up thoughts

I must admit I haven’t done extreme testing or anything hectic with it yet but there are a couple of irritating things about the Windows 8 Developer Preview. Hopefully these will only be issues that is due to the ‘test/beta’ status of Windows 8 and that they improve some things along the way.

At the moment I have two big’ish issues with the Developer Preview.

1. The Metro interface – I don’t have an actual problem with it as such except that you don’t have the option to easily disable it and return to the more classical Windows 7 desktop. It may be great for tablets or other portable devices with touch screens but not on a work related PC – and definitely not for legacy applications.

2. Internet connectivity is absolutely required – Not everyone has super fast and uncapped connections – even today. For me the problem is even worse because I have to run it inside a VM (VirtualBox) on a network where it is not allowed to have such test stuff accessing the Internet. The problem it creates is that this developer preview ‘absolutely’ requires a connection even to do something as simple as adding Windows components (through the add/remove programs control panel). Why it has to go to the Windows Update site just to get something that should be on the local install media is beyond me!

On the positive side I’m really impressed with the boot-up speed. General performance/response is really good (yes, even inside a VM). I only have 2GB memory allocated to it and it doesn’t feel too sluggish – but yes, I’m not running any hectic applications inside it.

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 😉 )