Wurbe is the informal web developers meeting group, from Bucharest Romania. Meeting #5 was focused on automated testing (unit, TDD, BDD, other stuff). This is my presentation:
Taming the big bad websites
Wurbe is the informal web developers meeting group, from Bucharest Romania. Meeting #5 was focused on automated testing (unit, TDD, BDD, other stuff). This is my presentation:
My previous article was focused on Linux monitoring. Often, you’ll have in your datacenter at least a few Windows machines. SQL Server is one of the best excuses these days to get a Microsoft machine in your server room – and you know what, it’s a decent database – well, at least for medium-sized companies like the one I’m working for right now.
It is less known, but yes you can have SNMP support out of the box with Windows 2000 and XP, and it doesn’t need to be the Server flavor [obiously it works the same in 2003 Server]:

After the server is installed, the SNMP service has to be configured. Here’s how:
Next step is Cacti integration. Unfortunately, there is no Windows-specific profile for devices in Cacti. Therefore if you have lots of Windows machines, you’ll have to define your own. Or, take a Generic SNMP-enabled host and use it as a scaffold for each device configuration.
Out of the graphs and datasources already defined in Cacti [I am using 0.8.6c] only two work with Windows SNMP agents: processes and interface traffic values.

It’s a good start, but if you are serious about monitoring, you need to dig a little bit deeper. Once again, the MIB Browser comes to save the day. It’s very simple, just search on the Windows machine for any .mib files you are able to find, copy on your workstation, load them into the MIB browser and make some recursive walks (Get subtree on the root of the MIB).This way, I was able to find some interesting OID for the Windows machine. For instance, .1.3.6.1.2.1.25.3.3.1.2.1 -> .1.3.6.1.2.1.25.3.3.1.2.4 the OID for CPU load on each of the 4 virtual CPUs [it's a dual Xeon with HT].

Memory-related OIDs for my configuration are :
Here’s a neat memory chart for a windows machine. Notice that the values are in “blocks” which in my case is 64kb. The total physical memory is 4GB.

Most hardware manufacturers do offer SNMP agents for their hardware, as well as the corresponding .mib file . In my case, I was able to install an agent to monitor an LSI Megaraid controller. Here is a chart for the number of disk operations/second:

In one of my next articles, we’ll take a look together at the way you can export “non-standard” data over SNMP from Windows, in the same manner we did on Linux, using custom scripts. Till then, have an excellent week.
“More and more pressure is on Microsoft to rush Longhorn. Apparently, a number of Microsoft licensees will get some sort of massive refund if the product isn't delivered in 2006, and the word on the street is that the code keeps breaking. My guess is that at the last minute the company will kludge together a workable system missing a lot of features.”
John C. Dvorak, Now What Do We Do? Dept. 13 July 2004
“In order to make this date (of 2006), we've had to simplify some things, to stagger it. One of the things we're staggering is the Windows storage work,” Jim Allchin, Microsoft's vice president in charge of Windows development, said in an interview with CNET News.com
CNET News.com Microsoft revamps its plans for Longhorn August 27, 2004
… at least that's what Mr. David Gristwood says in this (otherwise excellent) entry ('21 Rules of Thumb – How Microsoft develops its Software') on his MSDN weblog. Davis thinks that :
Even discounting the added development burden, with the addition of each additional platform the job of QA increases substantially. While clever QA management can minimize the burden somewhat, the complexity of multi-platform support is beyond the reach of most development organizations. Place your bets. Demand multi-platform support from your system software vendor, then build your product on the absolute fewest number of platforms possible.
What kind of 'portability' are we talking about in the context of software development at Microsoft ? He is probably making allusions to software being developed simultaneously for desktop and pocket Windows, which is in fact quite a challlenge for QA and for the developer team. But if it's a tongue-in-the-cheek reference to Java WORA, I found this entry to be somewhat funny. Let's – for the sake of the argument – suppose that you develop for multiple platforms and your QA team is able to thoroughly test only one of them. Basically, this means that your product is going to work OK on the main platform and have some flaws (most probably in the GUI area) on other platforms. How is this worse than having a product which purposedly works on a single target platform ? Humm, is JVM 'system software' after all ?
At first, this might seem a mind-boggling combination. What do
jython and PHP have in common (excepting the fact that I am a Python fan
and my current consulting task is in a PHP project) ?
Well, internationalizing a PHP app is pretty much a trivial task.
If you are a sensible PHP programmer insisting to use PEAR instead of randomly choosing a script from the tons of snippets
populating the “scripting websites”, I18N is probably the
safest choice.
Maybe – for you – application maintainability and performance are not exactly important concerns.
For me, they are. This is why I chose to store internationalized texts in files rather than database.
I'd rather keep the database for real data, which is created, modified, aggregated and such.
And I'd rather like to have an internationalized error message on the screen even if the database is down.
Now we know that we'll use I18N and text will be kept in some php files. However, I am no professional translator and
have no desire to translate or to manually maintain the correspondence between translators files and PHP files
(no, translators won't modify PHP code, stop this nonsense right away).
Code generation comes immediately in mind.
Basically, my first idea was to investigate wether the files used by the translators can be quickly transformed to PHP,
and if I am able to generate their formats from my own files (aka. “roundtrip internationalization process” ?).
Unfortunately, this is not an easy task – as the only clue was that the translators use Office tools such as Word or Excel, because they
rely upon some specialized translation software integrated with these products.
The easy choice is Excel, since it allows a better organization of data than having to search for tables in a Word document.
The hard choice is the tool that I'd use for automatically reading and even generating Excel files.
The difficulty comes from the fact I don't have Windows with Office installed on my desktop, just Gentoo Linux and OpenOffice.
Thus, I am unable to write a simple Python script which could perform my generation tasks via automation.
Fortunately, this is not the first time I am confronted with the issue.
I happen to know that there is a very nice Java tool that I wholeheartedly
recommend for your Excel processing needs :
JExcelApi.
Still, Java is a heavyweight programming language – it would be a really bad idea to fire up the
Automation scripts are already in cron and there's also a nice text document explaining translators where to get
their files and where to put them after modification. The resulting script is not exactly fast, but this is tooling
and not production so this should not be a problem after all.
Whatever your project contraints are, give Jython a try and you'll be amazed … As they put it on the
Useless Python site – If it were any simpler, it would be illegal.
Finally there's a trick not quite related with Jyhon, nevertheless interesting.
There is an easy way of solving the problem of translating phrases with real data inside them, with easy parameter swapping.
We'll use the good old sprintf but not directly. We'll pass through a not so popular but extremely useful function,
call_user_func_array. Suppose that our example needs the
user name and authorization profile description to display inside a nice message. All you have to do is to define placeholders
in I18N files which would fit as the first argument for sprintf. The following example should make it clearer:
| localization/en/login.php |
$messages = array( 'loggedin'=>'You are authenticated successfully as user %1$s with profile %2$s.' ); $this->set($messages); |
| localization/fr/login.php |
$messages = array( 'loggedin'=>'Vous avez le profile %2$s en tant qu'utilisateur %1$s.' ); $this->set($messages); |
| Simple passing of multiple parameters to I18N in PHP. Example function without error processing or data domain checking. |
#this is the multiple parameter function
function complexTranslation($i18n, $label, $params)
{
return call_user_func_array('sprintf',array_merge(array($i18n->_($label)),$params));
}
|
| Then, you have to initialize your I18N object. This can be done in a generic manner for all pages. |
#specific I18N initialization stuff require_once 'I18N/Messages/File.php'; $g_language_dir = dirname($_SERVER['PATH_TRANSLATED']).'/localization/'; $i18n =& new I18N_Messages_File($g_langCode,$script_name,$g_language_dir); |
| Finally, use the function. |
#translate the successfull login message $loginbox = Tools::complexTranslation($i18n,'loggedin',array($operator->name,$profile->description)); |
Today, a quick one.
If you work with a lot of projects, opening multiple Java files and performing big searches and refactorings from time to time, you'll notice that Eclipse becomes increasingly slower. This is somewhat similar with the infamous 'Windows rot'. Except, this time you have solutions other that complete reinstall.
Deleting “workspace/.metadata directory” is such a solution, but a violent one, since you lose all your settings and 'non-code' work. And while the settings can still be exported and reimported after the clean restart of Eclipse, there definitively is some data (such as the “Run” list) which has to be rebuilt from scratch. And if the list has tens of items, that's your precious worktime which is lost.
A nicer, less invasive solution is to delete only the resource history and the JDT caching. That means deleting all the content of the directory “workspace/.metadata/.plugins/org.eclipse.core.resources/.history” (but not the directory itself) as well as *.index files from “workspace/.metadata/.plugins/org.eclipse.jdt.core” and “savedIndexNames.txt” from this same directory.
I've also learned that some hard Eclipse crashes as well as dubious plugin uninstalls (via directory deletions) migh completely bork the workspace, then Eclipse isn't even able to restart … again, the trick is to delete “workspace/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml” and restart with default workbench. (see also one of my older posts).
Tested with Eclipse <=3.0M4 … YMMV
Last, week I got to visit Web Services & XML Integration Forum in Paris. It was an interesting day and I’ll probably come back with some more info, but for now I’ll just talk about what really impressed me. There was a nice triagle of expo booths somewhere in the ‘North-East’ area of the Forum, three little companies you might’ve heard about : Microsoft, Sun and Borland.
The difference was striking. Microsoft is by far more prepared for this public event. They weren’t using presentation rooms, but instead conferencing right there in the booth all day long (with a lunch break of course). Although the presentation rooms were at least 4 times larger than the space they prepared (3 benchesx2m apx), I think they’ve got the best coverage at the Forum. They and Adobe, but Adobe was slightly off-topic (PDF is king at Adobe, and for a reason).
Instead of using a classic projector, casting large shadows every time they wanted to point something on the screen, MS people installed a large (plasma, I think) flat-screen in their booth. They were the only ones I saw with wireless microphones, which gave them a lot of freedom to walk, wave hands and hypnotize the audience. But wait, there’s more … The Microsoft guys were talking “agile enterprise and processes” and one of them said once “you can put any backend database here, say MySQL for instance”. No, there is no confusion with “MS SQL”, the guy standing next to me was as stunned as I was. And to complete a superb marketing image, they wear no suits, no ties – everybody was relaxed and smiling. The only glitch was that the latest rage among MS employees seems to be cloning Bill’s haircut. I mean wake up guys, you can cut your hair in differents lenghts an shapes, you know…
Just a few meters away, in the much smaller Borland booth, there was also a plasma display. However, no real presentations showing. Just a loop of images, logos of products and the word SPEED written in large, red letters. Um, ok. After 30 seconds I had to walk, it was incredibly boring.
No crowd was gathered at Sun’s booth, neither. Some LCDs were displaying what looked like a non-interactive Project Rave demo and some screenshots of a Windows’look’alike Linux distribution, their famous Sun Desktop blabla whatever. WHY were they showing this at a Web Services & XML Forum ? But, probably Sun’s intentions were to scare away the visitors so they could watch undisturbed Microsoft presentations. In that case, they succeded extremely well. Plus, their unique positioning gave them a perfect view of the presentations – or was it Microsoft which strategically placed their flat screen in Sun’s direction ? Hmmm, makes you wonder.
Anyway, to conclude, I watched two Microsoft speeches (one about their Web services strategy and one about Biztalk). It was fun, it was interesting, it was well explained. But it was not Java – and I am a Java developer. Should I be – hmm, ashamed or something ? For not watching instead : what, the bored faces of Sun staff ? Or : Jbuilder logo and words in big red letters ? Java has what we call an image problem. Some steps were made (the java.com site for instance) but there’s still a long way to go. It’s a matter of ‘packaging’ and might seem useless and frivolous. But how will Sun impose ‘friendlier’ development tools if the language itself still has a cold, silent, sad, geeky image, competing with .Net platform which has a much “sexier” look ?
wx4j is a Java wrapper around the *tried and tested* wxWindows widget framework. The main idea may be similar with one which gave birth to SWT : hide native widgets behing a [more or less] thin layer of Java. By “native” I mean widgets for Windows flavours, Linux/Unix with GTK+ or Motif, and MacOS as well. However I see some interesting differences :
+++ source code is available for native wxWindows, however not available for native part of SWT ?!?
+++ wx has considerably more C++ than Java. Some layers such as event loop are native to the OS thus (afaik) faster than SWT's.
— what about wxEmbedded ? would be nice to integrate also … SWT has already made some steps in this direction
— I find somehow questionable the sanity of the “native” approach, because we'll eventually end up writing small Java control layers manipulating native GUIs and native data sources (OTL anyone ?). But then again, this might be a valid approach.
As well as in SWT, there is some ["non-Javaic"] memory management needed such as destroying transient windows containers and deleting memory used by drawing contexts … Although the library is extremely young the doc is quite useful, even showing non-obvious things like how to deploy a wx4j app with webstart.