Speaking at …
Reading blog rolls for years, I rather often meet posts of different “socially recognized” ones, which proudly inform us, that they are going to speak at some conference. And what’s very common is that the subject of their messages are literally that they are “speaking”.
What does that mean? That the main fact they provide us is that “they are speaking”, and not that “some important subject will be explained in their speeches”. Otherwise they would say that first.
What can I conclude? That most of them are just egoistic monkeys that in fact using the corresponding issues to promote themselves and collect more bananas, rather than they are really interested in sharing their information, which is (according to my understanding) the purpose of the conferences.
Other monkeys use the chance to participate in such sessions to promote themselves by asking “interesting” questions in these sessions…
It’s funny that some people thought that socializing the network may boost building selfless society. As I see it, it’s just a way for offline losers to find the bunch of other losers of the same kind and to gain respect among them to feed their ill and hungry ego with fast junk.
Well, personally I don’t mind. What I’m truly happy about is that people I respect for real are trying to spread the good by deed, rather by dissimulating word.
Eclipse Maven Integration
Honestly, I was pretty unsure regarding Maven at all. “Why should I port my projects from Ant, where everything is plain, simple and predictable? Single point integration jars are connected to their dependent projects, shared ones are extracted to a Libraries project. Deployment is as easy as checkout and build…” – I convinced myself.
But soon I’ve realized that if our team’s Product is no more than a chain in the string of Products and Components which are unified into the Solution, than why the hell should our code base not to be like that? It’s so nice that lots of Environments has their packaging systems which make installation simple and aesthetic… So if you work in Java and harmony and beauty are not just senseless terms for you, believe me, you should use Maven.
The main Maven’s advantage over Ant is that each dependency, called artifact can be (and commonly is) an independent project with its own history of versions and dependencies. So, if you want your project to be dependent of any library, you can just find it in one of major Maven repositories, add its id to your pom and – voila! it works.
Then, when time comes to deploy your stuff, you pack it and do the same – upload your stuff to another maven repository. Here the cycle closes and the universal happiness has been achieved.
Now, regarding the subject. There are 2 Maven Eclipse plug-ins in the market – m2eclipse and q4eclipse. Both of them recently were accepted as Eclipse native incubation projects as M2E and IAM. I tried them both starting from the second, but as it always happens, the first was the better one. M2E is very stable, comfortable and easy to understand w/o any documentation, while IAM is pretty buggy and unclear.
So I chose M2E to work with and it took just about 3 hours to convert all my projects to poms, configuring all their dependencies and then converting the projects into Maven managed ones. With the last action, all the Eclipse dependencies convert into Maven dependencies, the build is replaced with Maven build and it guarantees that there will be no surprises in production builds. And then you can proceed with LB/Continuum/CC with no time spent to understand why nothing doesn’t get built correctly.
Now what’s remaining is to reintegrate the changes from the sandbox branch and help the team to not be too scared of the changes
Last Singleton
Hooray!
Today I’ve eliminated the last misused occurance of singleton pattern in the monsterous project I’m currently involved in.
LinkedIn WordPress integration
I’ve just discovered (with a passive help of comrade Cal Evans) that LinkedIn added an application to embed WordPress blog entries into the profile.
There are two options for that – one is to share all the entries in there, and the second – to just share what was labeled as LinkedIn.
Not sure why exactly does it, but it seems kind of groovy to me
Aptana “steals” PDT code
Long time ago I set up Google alerts to receive new search results related to myself. And today I’ve discovered that Aptana steals “prepares derivative work of“ PDT code.
The only visible “derivation” there is they changed package names, though.
Design Patterns
Recently I’ve seen the inter-blog discussion by some PHP guys I don’t know which touches among other things the issue of design patterns. And when they define design patterns they use some canonical or less definitions which seem a bit fuzzy to me.
When I think of design patterns, I always think about patterns of design, thus to define them you first need to define both of them well. With design it’s pretty easy. So let’s talk about patterns.
Pattern, as you surely know, my dear friend, is nothing but a recurring event. But how would you detect recurring events? To do that you need first to detect events, which are no more than time objects. And detecting recurring objects requires memory and ability to compare, which in one word is “intelligence”. Now, knowing the known patterns is nothing but remembering them, which doesn’t require intelligence, while detection of them actually is their usage, since using patterns is already a pattern.
Therefore, design patterning is a way of making designing and observing the design to be more harmonious, or a way of saving designer’s and observer’s intelligence. However, it’s very simple to save intelligence by just not designing the creation. But bad design is nothing but just a very complex design. A design which is created unconsciously is actually a noise and is not harmonious. So using/creation of design patterns is an investment of intelligence in order to save it in the future.
And when not to use patterns then? Only when you:
1. Know to do it perfectly.
2. And you don’t really care if anyone would observe the done.
3. And you will never need to make a similar deed.
I know only one such a task: physiological dying.
Prototype styled Google Analytics javascript snippet
Recently I’ve created a prototype styled javascript snippet to enable google analytics on one of my sites. Save this code in google.analytics.js file and include it from the head tag of the page just after including of the prototype.js:
gaTrackerId = 'ss-ddddddd-d'; // insert your tracker id here
document.observe('dom:loaded', function() {
var gaJsHost = (
'https:' == document.location.protocol
? 'https://ssl.'
: 'http://www.'
) + 'google-analytics.com/ga.js';
var script = new Element('script', { 'src': gaJsHost});
var gaTrack = function() {
if (
!script.readyState
|| /loaded|complete/.test(script.readyState)
) {
var pageTracker = _gat._getTracker(gaTrackerId);
pageTracker._trackPageview();
}
};
script.observe('load', gaTrack);
script.observe('readystatechange', gaTrack);
document.body.appendChild(script);
});
Copying nodes between XML documents with Java DOM
Today I had an atomic task of creating a most convenient way to copy nodes from one XML document to another with Java’s DOM implementation. Googling did not help me much in it, so I will share the solution here in case someone would be challenged too.
So, imagine you have multiple XML documents like this:
<document>
<section>
<node attribute="value" />
</section>
</document>
…, another one like this:
<storage><sections /></storage>
… and you wish to read the multilple documents and to put the <section> nodes into the <sections> node of the second one respecting all the structure.
To do that you should:
1. Create the XML document builder:
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
2. Get the <sections> node of the target file:
File target;
Document targetDom = builder.parse(new InputSource(new FileReader(target));
Node targetSections = targetDom.getElementsByTagName("sections").item(0);
// TODO this is not the best way to use that.
// I advice XPath instead.
3. Iterate over the source files and get the <section> nodes:
File[] sources;
for (File source : sources) {
Node sourceSection = builder.parse(new InputSource(new FileReader(source))
.getElementsByTagName("section").item(0);
// continued inside
}
4. Copy the node into the target document:
targetDom.appendChild(targetDom.adoptNode(section.cloneNode(true))); // 'true' means we want to clone children too
5. Write the target back to the file:
TransformerFactory.newInstance().newTransformer().transform(
new DOMSource(targetDom),
new StreamResult(new FileWriter(target))
);
That’s it. Note, this code lacks error handling and probably won’t work directly after copy-paste, but just shows you the usage of the classes.
Why Eclipse Equinox P2 Update Manager sucks
As you all know in Eclipse 3.4 there is a new Update Manager (more correctly – Plug-in Manager) which is intended to be better.
The update managing side of it is an improvement indeed. But the first thing raised my alertness is there is no place to point where do I want my selected plug-ins to be installed. Well, I thought it’s just a default selection and manually downloaded the plug-ins and dropped them into the famous dropins directory (of course with keeping directory structure). And then after restarting eclipse I discovered that there is no such a thing like hierarchy of plug-ins and plug-in locations at all. That’s too bad.
Now, let’s say you installed all the plug-ins. Then if you want to update them, you don’t have a overall progress bar. And this is a network connection related progress. Isn’t it stupid?
Another glitch: My wireless connection to my neighbor’s hub suddenly aborted. So what does it do? It shows me an error dialog behind the modal dialog of progress information. I’m not even mentioning that there is no retry/ignore options.
Now they say: you can replace the new p2 with the good old Update Manager. But for that you must restore several configuration files from 3.3.2. I understand, this is my stupid mistake that I first completely destroyed my previous installation (I can allow it to myself at home), but it’s still annoying.
Blog RSS feed