tag:blogger.com,1999:blog-87423964447010278492024-03-13T11:09:25.637+02:00Java Мissionary + stuffMy thoughts on technology and... JavaLeni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.comBlogger43125tag:blogger.com,1999:blog-8742396444701027849.post-30453990858066702412016-07-24T22:51:00.000+03:002016-07-24T22:51:20.710+03:00Microservices mishaps: 1 query, multiple DBsI want to share my experience with the latest trend in software engineering - microservices.<br />
<br />
In particular, I want to explain a case I recently stumbled upon which made us hate the strategy we've got of <b>splitting the big monolithic application to microservices.</b><br />
<br />
The use case is relatively simple - one wants to make a query concerning multiple entities. They have relations between them nevertheless, the data ideally should be owned by separate microservices in an autonomous way.<br />
<br />
<h4>
The example:</h4>
Let's say that the product is a ERP-like and naturally we would have entities like company and invoices. Naturally, we'd went for microservice for the company - let's name it <b>company-srv </b>and one for invoices - <b>invoice-srv. </b>Both of these should own the APIs and DB<br />
<b><br /></b>
Now what happens when we want to make a query that is something like:<br />
<blockquote class="tr_bq">
Get all companies with more than 1000 invoices</blockquote>
or slightly more complex example:<br />
<blockquote class="tr_bq">
Get all <b>invoices</b> that haven't sent <b>email-report</b> last month for the <b>companies</b> that have this feature enabled.</blockquote>
<br />
How do you handle such responsibility - is it in invoice-srv's ownership and it should have a dependency on the other services? How do you keep the performance high with increased row count?<br />
<br />
Even if you handle this with additional relations between the 2 DBs between the autonomous services, let's add another more interesting factor to the situations.<br />
<br />
<h4>
<b>The more complex (and quite common) example:</b></h4>
Let's try to intertwine <u>permissions</u> - let's say that the user who is trying to see the results of the above queries, doesn't have permissions for some of the companies? Or even more intriguing - for some of the branches of the companies...<br />
<br />
Whose responsibility is it to orchestrate the query? Does it become a multi-query operation? Is there going to be a <b>permissions-srv ? </b>What about performance? Pagination?<br />
<br />
...<br />
<br />
All these are questions we ask when we pick microservices. Otherwise, it would have been a simple JOIN in the monolithic approach....<br />
<br />
Are we going backwards? :)<br />
<br />
PS:<br />
more on the topic this cool post: <a href="https://www.javacodegeeks.com/2016/07/hardest-part-microservices-data.html" target="_blank">https://www.javacodegeeks.com/2016/07/hardest-part-microservices-data.html </a><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-33048237200532449632016-06-03T12:32:00.000+03:002016-06-03T12:32:16.225+03:00Old projects reborn - MoneyTimerThis is another tool, I've tried to update in order to withstand the test of time - <b><a href="https://github.com/leni-kirilov/MoneyTimer" target="_blank">MoneyTimer</a></b><br />
<br />
<b>What does it do ?</b><br />
<pic></pic>It measures time and calculates every second how much time it costed all participants.<br />
Great for consultation meetings!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhPjZg4Wp1C1HUYCPZyC5B86l9-f8Iw1h3sCLqycZ79FcP6SdLlmPx-Ef1-i6qhzQtubg7xSazL-BoxGAT3Cspzfqd-UkplqU7-O62lD6aksIGYhnqYkQAUKdeI23K6OL97_k4H3nUNne8/s1600/Screen+Shot+2016-06-03+at+12.26.47.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhPjZg4Wp1C1HUYCPZyC5B86l9-f8Iw1h3sCLqycZ79FcP6SdLlmPx-Ef1-i6qhzQtubg7xSazL-BoxGAT3Cspzfqd-UkplqU7-O62lD6aksIGYhnqYkQAUKdeI23K6OL97_k4H3nUNne8/s320/Screen+Shot+2016-06-03+at+12.26.47.png" width="320" /></a></div>
<br />
<br />
You can try out the latest <a href="https://github.com/leni-kirilov/MoneyTimer/releases/tag/v1.0.1" target="_blank">release here</a>:<br />
<br />
<b>What I can learn from it?</b><br />
- Java 8 Lambda expressions<br />
- Simple Multi-threaded application<br />
- Swing<br />
<br />
<b>How to contribute: </b><br />
Check the <a href="https://github.com/leni-kirilov/MoneyTimer#how-to-contribute" target="_blank">instructions</a> at the github repo page.<br />
If you are wondering what to contribute: there's a list of ideas in the <a href="https://github.com/leni-kirilov/MoneyTimer/issues" target="_blank">issues page</a><br />
<br />
<br />
Tune in, because more complex ones are coming ...<br />
<br />
<b>PS:</b><br />
Check out my other project that can interest you. This time about HTML generation via XSL transformations - <a href="http://javamissionary.blogspot.bg/2016/04/old-projects-reborn-filesystem2html-tool.html">http://javamissionary.blogspot.bg/2016/04/old-projects-reborn-filesystem2html-tool.html</a><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-57441372672070550372016-04-29T21:42:00.004+03:002016-06-03T12:37:20.104+03:00Old projects reborn - FileSystem2Html tool<div style="text-align: justify;">
As everyone in the IT business, I have quite a few of my own projects. Most of them rot in solitude and are rather dusty... So, I decided as a way of exercise as well as a check how have technologies developed and my own views on code cleanness, tests' quality and overall project usability, to make them more development-friendly.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In short - I'm reviving my projects (both university and personal ones) so that they are easy to setup, run and contribute to if there's a willing person.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I'm starting with this small project: <a href="https://github.com/leni-kirilov/FileSystem2Html/">https://github.com/leni-kirilov/FileSystem2Html/</a></div>
<div style="text-align: justify;">
<br /></div>
<h4 style="text-align: justify;">
What does it do:</h4>
<div style="text-align: justify;">
- it's a simple Folder structure scanner</div>
<div style="text-align: justify;">
- it can build an HTML/XML report of the folder structure</div>
<div style="text-align: justify;">
- it can rebuild that folder structure elsewhere (without the content, obviously)</div>
<div style="text-align: justify;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNELXgtLUYUMRnqyZYBB0Uwsnqi6HkfsyL3tNyykMyFLgNqMOcolyYAmqMNSaW9qUNviQZoN6hXlWo7tTubSOzTYSvnctAxsukeSsTg4nh_h8Rl2qZzfS-W2MwquhZth8yMaOW2UWTWDnT/s1600/Screen+Shot+2016-04-29+at+21.33.25.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="161" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNELXgtLUYUMRnqyZYBB0Uwsnqi6HkfsyL3tNyykMyFLgNqMOcolyYAmqMNSaW9qUNviQZoN6hXlWo7tTubSOzTYSvnctAxsukeSsTg4nh_h8Rl2qZzfS-W2MwquhZth8yMaOW2UWTWDnT/s400/Screen+Shot+2016-04-29+at+21.33.25.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">My "beautiful" swing UI</td></tr>
</tbody></table>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Very useful if you like a certain folder structure, and don't have the time to remove all the files or whatever. You can easily mimic it. Quite a simple app.</div>
<div style="text-align: justify;">
<br /></div>
<h4 style="text-align: justify;">
Now to the <b>contribution</b> part:</h4>
<div style="text-align: justify;">
- It's an open source project </div>
<div style="text-align: justify;">
- Java 8 required</div>
<div style="text-align: justify;">
- built with Maven </div>
<div style="text-align: justify;">
- a list of TODOs and ideas where one can get started! I've listed ideas based on effort. </div>
<div style="text-align: justify;">
<b>I would start with the <a href="https://github.com/leni-kirilov/FileSystem2Html/issues?q=is%3Aopen+is%3Aissue+label%3Asize-small" target="_blank">small ones</a>. </b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The project builds automatically and measures code coverage (yes, there are unit tests there!) <br />
<b>(Thank you Travis-CI, Coveralls and Coverity!)</b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So that's pretty much it.</div>
<div style="text-align: justify;">
I can't wait until I see someone energetic about such a tool</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<i>Best of wishes!<br />Leni</i></div>
<div style="text-align: justify;">
<i><br /></i></div>
<div style="text-align: justify;">
<i>PS:</i></div>
<div style="text-align: justify;">
Please be gentle :) I know there's some pretty lame code out there!</div>
<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-13201359298032627062015-07-28T00:59:00.003+03:002015-07-28T00:59:59.917+03:00Gradle Daemon - boost your build performanceYou use Gradle and want to speed up a bit your build time? Nobody wants to wait for compilation, assembly etc. Let's try this easy to setup performance boost:<br />
<br />
If you enable <b>Gradle Daemons</b>, you can actually reuse the Gradle context that you've just created for your subsequent builds! It basically doesn't completely kill the process when a Gradle build finishes, but reuses the common framework classes and thus improving build time.<br />
<br />
I've tried it on my projects and the improvement was from <b>a 40s build down to 20s on subsequent builds !</b><br />
<b><br /></b>
Here's what you need to do and know:<br />
<pre class="programlisting" style="background-color: #3f3f3f; border-radius: 5px; border: 0px; color: white; font-family: 'Ubuntu Mono', courier, monospace; font-size: 16px; font-stretch: inherit; line-height: 1.3; margin-bottom: 1.5em; margin-top: 1.5em; padding: 0.8em; vertical-align: baseline;">touch ~/.gradle/gradle.properties && echo "org.gradle.daemon=true" >> ~/.gradle/gradle.properties</pre>
<br />
<ul>
<li>enables Gradle daemon for all your projects by default (don't worry you can turn it off for individual projects as well)<br /></li>
<li>if you use multiple Gradle versions, a different daemon is created for each one! This is a potential deal-breaker for some developers, but a good reason to align all your projects to a single version of Gradle.</li>
</ul>
<br />
<ul>
<li>in case you want to recreate the daemon, you can stop them all using:</li>
</ul>
<br />
<pre class="programlisting" style="background-color: #3f3f3f; border-radius: 5px; border: 0px; color: white; font-family: 'Ubuntu Mono', courier, monospace; font-size: 16px; font-stretch: inherit; line-height: 1.3; margin-bottom: 1.5em; margin-top: 1.5em; padding: 0.8em; vertical-align: baseline;">./gradlew --stop</pre>
And that's it!<br />
<br />
For more info check the dedicated page:<br />
<a href="https://docs.gradle.org/current/userguide/gradle_daemon.html" target="_blank">https://docs.gradle.org/current/userguide/gradle_daemon.html </a><br />
<br /><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-49053648549708061662015-06-29T23:18:00.000+03:002015-06-29T23:18:07.926+03:00Chocolatey - apt-get for windowsAs a Windows user, I was quite envious of Linux/OS X tools like <b>apt-get</b> or <b>brew... </b>But not anymore! I've just found the Chocolatey tool for Powershell which let's you easily find and install software on your Windows-powered PC.<br />
<br />
Let's see an example:<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF0CVi1u2I2xWIG2R_QJ0dKg6tMXbRrQ6RkrG0Nz10L8MO4dRMv6zOi-pdckHaQbtGGN9gcG8DOp4iNUZXE5eCdA5Os1IVIYo-9QVgjlE7Cvsqw2APOz6cOMlpM5Ugm_4IRwlYP1M79Kfi/s1600/chocolatey.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF0CVi1u2I2xWIG2R_QJ0dKg6tMXbRrQ6RkrG0Nz10L8MO4dRMv6zOi-pdckHaQbtGGN9gcG8DOp4iNUZXE5eCdA5Os1IVIYo-9QVgjlE7Cvsqw2APOz6cOMlpM5Ugm_4IRwlYP1M79Kfi/s1600/chocolatey.PNG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Searching for Slack and installing afterwards</td></tr>
</tbody></table>
<br />
<b><br /></b>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
This way you can maintain apps and versions on your PC using scripts.<br />
If you want to check if there's an upgrade to any of your programs, just write:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;"><b>choco upgrade all</b></span></blockquote>
If you want to give it a try yourself, visit <a href="https://chocolatey.org/">https://chocolatey.org/</a> and follow the instructions<br />
<br /><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-45146189577118598682015-06-03T20:50:00.002+03:002015-06-06T10:32:03.961+03:00Traveling back in timeWhat happens when you go to your parents' house is that you<br />
travel back in time...<br />
<br />
It's strange to see all the playgrounds that were once full with kids<br />
and laughter, covered in bushes and trees, so high that makes you<br />
understand just how much time has passed...<br />
<br />
You remember times when you laid the foundation of a new football field, nothing of it still remains.<br />
Even the goals are removed and most probably melted as scrap...<br />
<br />
Having looked through the window for just a minute, made me travel back in time 10+ years.<br />
And that makes me understand just how insignificant life is, as well as how visible and how powerful it can be - life passed by me and this playground very quickly, events occurred and had a long-lasting effect. Events most probably defined by life ... like those very lively trees that now occupy those grounds!<br />
<br />
Entropy, such a short word but describing so many things...<br />
...<br />
A great way to get out of my negative entropy-based chain of thoughts, is to reread Isaac Asimov's "The Last Question". I just love his work and this is one of his best, in my opinion.<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-8159139496954507692014-08-15T20:54:00.002+03:002014-08-15T20:54:24.485+03:00Automatic code coverage badge / reports for Java 8 project in Coveralls.ioRecently, I've setup a Java project hosted on Github to get automatically build using <a href="https://travis-ci.org/" target="_blank">TravisCI</a>. It's super cool to have a nice badge saying that your recent builds are green. But then I discovered I could have some more report using free tools like TravisCI. <br />For example - code coverage tool like <a href="http://coveralls.io/">Coveralls.io</a><br />
<br />
This is where it got interesting quickly. It's written on the official site that it supports only dynamic languages but nothing about Java. But a quick search in Google pointed me to a <a href="https://github.com/trautonen/coveralls-maven-plugin" target="_blank">maven plugin</a> which connects with Coveralls' API. So I decided to give it a try.<br />
<br />
Here are some useful links and hints for everybody trying to do it for his own project:<br />
<ol>
<li><b>Check if your project is Java 8</b>If it is, you have to use the JaCoCo maven plugin, since this is the only code coverage tool supporting Java8 compiled classes. Use at least version than 0.7.0 (according to this <a href="https://github.com/jacoco/jacoco/issues/74#issuecomment-38009596" target="_blank">bug report</a>)<br /><br />
</li>
<li><b>Configure it your pom.xml to use JaCoCo</b><br />
<span style="font-family: inherit;">You could use the <a href="https://github.com/trautonen/coveralls-maven-plugin#jacoco" target="_blank">snippet here</a> but with newer JaCoCo version<br /></span></li>
<li><span style="font-family: inherit;"><span style="font-family: inherit;"><b style="font-weight: bold; line-height: 1.45;">Configure in your parent pom.xml to use coveralls-maven-plugin</b><span style="line-height: 1.45;">Carefully read the </span><a href="https://github.com/trautonen/coveralls-maven-plugin#usage" style="line-height: 1.45;" target="_blank">README</a></span><span style="line-height: 1.45;"><span style="font-family: inherit;"> of the plugin. For security reasons don't publish your token on your repo.</span><br />
</span></span></li>
<li><b>Update .travis.yml to try to upload your coverage report to Coveralls.io</b><br /><span style="font-family: Courier New, Courier, monospace;">after_success: mvn clean test jacoco:report coveralls:jacoco
</span></li>
<li><b style="font-weight: bold;">Add cool coverage badge to your README</b><br />Like this one:<b> <a href="https://coveralls.io/r/leni-kirilov/MoneyTimer?branch=master"><img alt="Coverage Status" src="https://coveralls.io/repos/leni-kirilov/MoneyTimer/badge.png?branch=master" /></a> </b><br />
<br />
<span style="font-size: large;">Congratulations!</span><br />
You've succesfully integrated: Github + TravisCI + Coveralls.io + JaCoCO for a Java 8 Project<br />
<br />
Check out my example project which has successfully integrated all these wonderful systems. <a href="https://github.com/leni-kirilov/MoneyTimer">https://github.com/leni-kirilov/MoneyTimer</a> <br /><br />
Kudos to <a href="https://github.com/trautonen" target="_blank">Tapio Rautonen</a> for creating such a useful plugin and documenting it in an excellent way! </li>
</ol>
<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-89188049177831223672013-06-07T19:34:00.000+03:002013-06-07T19:34:30.044+03:00Eclipse and maven-properties problemToday, I'm going to share a problem which I think it's quite common:<br />
- <strong>importing Java Maven projects into Eclipse and expecting Eclipse to just work with it.</strong><br />
<br />
You do:<br />
1) sync from source control<br />
2) import existing maven projects to eclipse<br />
3) see many red errors in Eclipse.<br />
4) yeah , I forgot to set the Maven settings file<br />
5) still some projects are failing<br />
6) try to fix each problem 1 by 1<br />
<br />
Why does it happen like that?<br />
<br />
Most common is that it will set a Java Compiler version which is from the POM.xml but then the JRE environment specified could be... just not right. So your POM.xml says "compiler version 1.7", but the Maven projects you import are automatically assigned Java1.5...<br />
So errors like<br />
- You cannot use @Override here<br />
or for java1.7<br />
- new ArrayList<> constructor not found (or not valid expression).<br />
<br />
So you have to go to each project, reconfigure build path parameters to point to JRE1.7 manually, even though you have specified JDK1.7 as installed JDK.<br />Imagine fixing this manually for 20-50 projects (you've just been moved to moderately progressed project)<br />
<br />
Even if you explicitly set the Maven settings in the Preferences menu, you would not solve your problem.<br />
<br />
<strong>The single solution is to:</strong><br />
1) delete all projects (
only
from Eclipse )<br />
2) reimport them, because NOW you have set the Maven settings BEFORE the importing...<br />
<br />
Just crazy... not being able to automatically adapt the projects to the new maven settings file... not even "clean" and "maven update" help...<br />
<br />
Best wishes,<br />
Leni Kirilov<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-76239588722708451662012-09-18T01:48:00.002+03:002012-09-18T01:48:41.444+03:00Powershell - the good and the bad. The story of a survivor.<b>Today's topic is Powershell - it's usefulness and weirdness.</b><br />
<br />
It is the Microsoft super cool console which is used to provide command-line API for all of MS big products like Office, SQL Serveer, etc. It is build on top of .Net so every .Net class you write, you can take advantage of it in the command-line.<br />
<br />
It has it's advantages:<br />
- using objects and not strings for pipelining commands<br />
- the .net framework<br />
- ease-of-use - with just a few commands you can open up the Powershell world.<br />
- very readable<br />
- good help <i>about_xxx</i> articles<br />
<b><br />
</b> Let's start with the<br />
<div style="text-align: center;">
<b><span style="font-size: large;">Good Stuff</span></b></div>
<br />
Pipelining is a powerful feature. You can pass multiple result objects from 1 command to the next one just like this:<br />
<br />
<i><b>How you delete everything inside a folder ?</b></i><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;"><b>Get-Item</b> "c:\folder\" | <b>Remove-Item</b> -Force -Recurse <span style="color: lime;">#alias is dir or ls</span></span></blockquote>
<b><i>How to see how to use a command ? What are its parameters? What does it do?</i></b><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;"><b>Get-Help</b> "Get-Item" -Full <span style="color: lime;">#alias is man or help</span> </span></blockquote>
<b><i>What are the properties/methods of a process ?</i></b><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;"><b>Get-Process</b> | <b>Select-Object</b> -First 1 | <b>Get-Member</b> <span style="color: lime;">#alias is gm</span></span></blockquote>
<br />
With just <span style="font-family: "Courier New", Courier, monospace;">Get-Help</span> (or man), <span style="font-family: "Courier New", Courier, monospace;">Get-Member </span>(or gm) and <span style="font-family: "Courier New", Courier, monospace;">Get-Command</span> (to list all available commands/functions/aliases) , you can do anything!<br />
<br />
<br />
<b><i>You'll use pipelining all the time! It's really cool!</i></b><br />
<br />
<b>Some nice hits are:</b><br />
- filtering a collection of items by a property. Returns all folders with name ending with the string "project"<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">$folderList | ? { $_.Name -match ".*project" }</span></blockquote>
which is short way to write:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;"><b>Foreach-Object</b> $folder in $folderList | <b>Where-Object</b> { $folder.Name -match ".*project"}</span></blockquote>
<br />
- doing a repetitive task on many objects. Display<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">$folderList = dir | ? {$_.GetType().Name -match ".*DirectoryInfo.*" } </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">$folderList | % { <b>Write-Host</b> "$($_.Name) - $($_.CreationTime)" }</span></blockquote>
- errors<br />
When there is an error just get the automatic variable $Error (array of error objects) and check the last 5 errors $Error[0..5]<br />
<br />
<br />
Main usage of Powershell is doing some quick check on something in the Microsoft infrastructure or writing a script to automate a routine tedious task like creating a report or killing all not-responding processes at the moment.<br />
Overall system administrators will love it.<br />
...<br />
<br />
and here ends the good things... If you try to use it for something else, you'll hit many different obstacles:<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">Strange behaviour</span></b></div>
<b><br />
</b> <b>Functions want to return something!</b><br />
<b><br />
</b> In fact, every function you call that returns an object, and the result is not saved in a variable, is automatically transfered as a result. OK, but when you have multiple such calls inside your function, these results are added into an array and here's the<b> /unexpected behaviour/</b>...<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">function </span><b><span style="font-family: "Courier New", Courier, monospace;">myFunc</span></b><span style="font-family: "Courier New", Courier, monospace;">(){</span></blockquote>
<blockquote class="tr_bq">
<b><span style="font-family: "Courier New", Courier, monospace;"> Get-Process</span></b></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;"> </span><b><span style="font-family: "Courier New", Courier, monospace;">dir</span></b></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">}</span><span style="font-family: "Courier New", Courier, monospace;"><br />
</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">$b = </span><b><span style="font-family: "Courier New", Courier, monospace;">myFunc</span></b></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">$b.GetType() ---</span><span style="color: lime;"><span style="font-family: "Courier New", Courier, monospace;"> #it says array</span></span></blockquote>
<br />
The other way to stop this from happening is to enclose the call with brackets and [void] the result like this:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;"> [void] (<b>Get-Process</b>)</span><b><br />
</b></blockquote>
<b>The strange empty array</b><br />
<b><br />
</b> When comparing empty array to <span style="font-family: "Courier New", Courier, monospace;">$null</span> with the comparison operator<span style="font-family: "Courier New", Courier, monospace;"> -eq</span> (equals), doesn't return neither <span style="font-family: "Courier New", Courier, monospace;">$true</span>, nor <span style="font-family: "Courier New", Courier, monospace;">$false</span>...just ... nothing.<br /><br />
This is partially explained with the Powershell ability to auomatically flatten an array to its elements. When it's an empty array - the operation doesn't execute. But there's no error as well... or warning.<br />
<br />
Try this:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">@() -eq $null</span></blockquote>
and<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", Courier, monospace;">$null -eq @()</span></blockquote>
Also if you are used to separate each function parameter with comma, you will have a hard time!<b><br />
</b><br />
Using comma ( ,) will generate an array. Well, Powershell likes arrays a lot, and you will, too, but only after the initial struggle.<b><br />
</b><br />
<b><br />
</b> <b>Using it for plain programming</b><br />
<b><br />
</b> Unfortunately, when you want to use it to code features, and even small frameworks, you hit<b><br />
</b><br />
some obstacles like<br />
- Visual Studio doesn't support it... at all! No other IDE with satisfying experience, too<br />
- PowerShell ISE isn't feature-rich enough<br />
- only suitable is Notepad++ with word completion and many macros along the way...<br />
- no compile-time catching bugs like - unused variables, or undefined ones...<br />
<b><br />
</b> <br />
<div style="text-align: center;">
<b><span style="font-size: large;">Unfinished or just plain broken features</span></b></div>
<b><br />
</b> <b><br />Modules as Custom objects</b><b><br />
</b> As of Powershell v2, there is a new method to package commands (cmdlets) - modules (instead of snapins).<b><br />
</b><br />
So you can import modules into the runspace or import them as CustomObject, which has<br />
methods as the functions declared in the .psm1 file (module script file)<br />
<br />
These CustomObjectModules are very buggy when it comes to multiple imports and generating exceptings...Trust me. The latter is very nasty... <br />
I<br />
magine writing a few modules which should use each other - common utils, etc. And then you have an exception. <b>Now where exactly did the exception occur ? </b>Try to get catch it with try-catch - the Error record contains only the row/execution line of your current module in development! Nothing about the inner exception or error stack... !! Which is not useful at all.<br />
<br />
In order to be productive with these modules, I ended up writing my own ExceptionStackTrace building function which collected errors, line numbers, positioned the stack trace correctly, and stops when it reaches another stack trace (.Net one) which is descriptive enough... Well, I'm sure it could have been done better, but it works stable enough and I like that it solved this problem which should have been handled by the Powershell Team!<br />
<br />
Also nested imports fail from time to time with functions which cannot be found...<br />
I am seriously, not going to use Modules as CustomObjects anymore... Too bad. Almost like Object-oriented programming... but with serious issues...<br />
<br />
<b>Remoting</b><b><br />
</b> While Powershell provides nice API for remote calls - <b><span style="font-family: "Courier New", Courier, monospace;">Invoke-Command </span></b>for executing single scriptblock and <span style="font-family: "Courier New", Courier, monospace;"><b>Enter-PSSession</b></span> for interactive mode. They are thought quite nice, but unfortunately, the last few weeks I've come to the conclusion that they are quite fragile and I was often the observer of the following results:<br />
- OutOfMemory Error<br />
- Stopped execution without errors<br />
- WinRM was not configured correctly errors pointing to articles in MSDN which weren't specific enough.<br />
<br />
<br />
So basically here are my findings about Powershell Remoting:<br />
<br />
- complex requirements for remote machine for the remoting to work. Not a single full guide for this.<br />
<br />
- adding snapins remotely for machine with no Internet access - 2 minutes ! You have to turn off the Internet Options > Advanced > Security option to <b>"Check for publisher's certificate invocation"</b> and it will pass in seconds.<br />
<br />
- remoting stops without any error or logs. Hard to debug. Could be missing configurations/rights, could be low memory<br />
<br />
- slightly more complex remoting produces many errors. For example starting a new resource-hungry process on the remote machine results in OutOfMemory Error. Solved by increasing the memory per PowerShell property described at the end of the article.<br />
<br />
- inconsistent behaviour - different errors for unchanged code<br />
<br />
- lack of documentation for some of the features - only a few blog posts saved me a few hours/days<br />
<br />
<b>A few tips here:</b><br />
<br />
- the remoting script you run should be as light as possible and should just execute a file/script located on the remote machine. This was you can lower remoting data transfers(logs, commands, variables, etc)<br />
<br />
- for complex, time-consuming tasks use Invoke-Command xxxx -AsJob parameter. This way it will create invisible background thread, which will take even less resources. Actually, for my complex scenario , it proved to be the only working option...<br />
<br />
<blockquote class="tr_bq">
<b><span style="font-family: "Courier New", Courier, monospace;">Get-Item</span></b><span style="font-family: "Courier New", Courier, monospace;"> wsman:localhost\Shell\MaxMemoryPerShellMB </span></blockquote>
<blockquote class="tr_bq">
<b><span style="font-family: "Courier New", Courier, monospace;">Set-Item</span></b><span style="font-family: "Courier New", Courier, monospace;"> wsman:localhost\Shell\MaxMemoryPerShellMB 512 -Force</span></blockquote>
<br />
<strong>Conclusion:</strong><br />
<br />
Don't get me wrong. Using Powershell is overall an easy and straight-forward experience, but when you try something a bit more kinky and ... let's say that the 'fun' starts there.<br />
<br />
Best regards,<br />
Powershell-ill<br />
Leni Kirilov<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-90235906203560827022012-06-19T09:54:00.000+03:002012-06-28T08:53:06.925+03:00Be efficient - virtualize and automate your test infrastructureAuthor: <i>Leni Kirilov, PowerCLI QE team, VMware Bulgaria</i><br />
<br />
<div style="text-align: justify;">
I met my friend Michael, a software quality engineer, who is
validating the functional correctness and completeness of “Cake Wizard”.
Cake Wizard is an online store, consisting of a database of items for
sale, accounts, online payments, etc. It is an enterprise application
developed with JEE. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In the process of validating the product, Michael needed a dedicated
test environment. Michael told me he created a complete set of
automation tools for executing the tests, gathering the results, and
reverting the environment to its initial state. He was really proud of
his accomplishment. He also integrated download and installation of
product builds with a Git source control system for the test cases,
Jenkins/Hudson for scheduling jobs on the test run process, and a custom
test runner to execute JUnit… I was impressed! Michael had done a
really great job by automating so many things. But he mentioned that he
had many problems with automating the process. There were even lost test
run results due to bugs.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I suggested a different approach – <b>automation & virtualization</b>.
Michael looked confused, not to say surprised. <i>“But virtualization is
used only in production systems for better load-distribution, resource
utilization and cloud services… what does it have to do with automation
testing?”</i> I smiled…</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Nowadays, most testing looks like this: you get a physical
environment, execute tests on it, and revert it to a clean state by
using images. This approach is convenient because you don’t have to
configure everything all over again. But there are some negatives as
well. </div>
<div style="text-align: justify;">
- When you modify the hardware configuration, you must update the image, because it’s hardware specific;</div>
<div style="text-align: justify;">
- If the hardware configuration fails, you can lose all your data and test results, which is a potential risk for the project.</div>
<div style="text-align: justify;">
- The approach doesn’t scale well because a single hardware configuration can be at most a single test environment.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Virtualization has the same advantages as images-driven test environment setup and more:</div>
<div style="text-align: justify;">
- <i>Better utilization</i> – you can run more than one virtual
machine (VM) on a single piece of hardware as long as there are enough
resources. Provide your Quality Engineers their own environment to play
with!</div>
<div style="text-align: justify;">
- <i>Revert to a previous state</i> – cleanup is easy because VMs are
designed with that in mind. You can easily debug a problem by using
snapshots. They are quite fast, too.</div>
<div style="text-align: justify;">
- <i>Hardware failure</i> – it’s irrelevant for the virtualized
infrastructure. Since VMs are just files, you can back them up, in order
to minimize loss, in case of server crashes</div>
<div style="text-align: justify;">
- <i>Pool of resources</i> – no need to reconfigure and recreate images when you buy new hardware. You just add it to the pool of resources.</div>
<div style="text-align: justify;">
- <i>Maintenance & automation</i> – with minimal effort you can
replicate VMs by using virtualization and the already available
automation scripts. You can even create your own automation scripts! </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
My friend Michael heard my arguments but was still skeptical. He had
already created his environment and he asked me: “What’s the easiest way
to virtualize it? What are the first steps?”</div>
<br />
<b>Let’s see how easy we can use VMware virtualization to:<br />
- automate setting up a test environment,<br />
- set up the test software<br /> - collect test results</b><b><br /></b><br />
<b>
</b><br />
<div style="text-align: center;">
<b>[Set up and configure virtual test environment]<br />
</b><br />
<b><br /></b></div>
You need virtualization infrastructure, so let’s install VMware ESXi
Hypervisor. It provides tools to run and manage virtual machines.
Follow these <a href="http://www.youtube.com/watch?v=3UjSd8rbJvQ">instructions </a><br />
<div style="text-align: justify;">
You start your virtualized test environment by creating a empty
virtual machine (VM). You install the OS (Guest OS) and applications you
need <b>just once</b> and save the result VM. You can use it to clone and thus multiply the VM as many times as you need.</div>
<div style="text-align: justify;">
Let’s install Windows Server 2008 and a JBoss Application Server 6 on our VM and name it <b>“Manually created VM”</b>. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>Manually configuring a VM is OK only in the process of
learning the VM specifics. As Quality Engineers, we want to automate as
much as possible in our work. </b></div>
<blockquote align="justify">
“How do we automate a virtual test environment and what is the best tool?”
</blockquote>
<div style="text-align: justify;">
The preferred tool for virtualization automation is <b>VMware vSphere PowerCLI</b>.
It is closely developed with the VMware infrastructure suite (called
vSphere). We need only some of the many features which PowerCLI
provided, to create our test environment. The product platform is
Microsoft PowerShell (running on .Net) – powerful yet very user friendly
CLI (command line interpreter) which provides great console
commands(called cmdlets) for managing other Windows products like SQL
Server, IIS, Windows, MS Office etc. Even though PowerCLI is based on
Microsoft technology, you can use it to install and configure Windows,
as well as <b>Red Hat</b> Guest OS on your VM. Let’s see it in action:</div>
<br />
Download and install latest PowerCLI version from here: <a href="http://www.vmware.com/go/powercli" target="_blank">http://www.vmware.com/go/powercli<br />
</a><br />
To start using PowerCLI you should connect to your local VMware ESXi
Server (which you should have installed and configured beforehand).<span style="font-family: "Courier New", "Courier", monospace;"><b><br /></b></span><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>Connect-VIServer</b> 192.168.1.1 -User ‘administrator’ -Password ‘pass1234’</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;">#For later processing get your VM and store it in a variable.</span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;">$vm = <b>Get-VM</b> –Name “Test_Environment_VM_1”
<b><br /></b></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"> </span>
<span style="font-family: "Courier New", "Courier", monospace;"><b>Start-VM</b></span> <span style="font-family: "Courier New", "Courier", monospace;">$vm <span style="color: #6aa84f;"># you can start using your VM for configuration</span></span><span style="font-family: "Courier New", "Courier", monospace;"><br /></span></blockquote>
<b>It’s highly recommended to install VMware Tools on your VM –
it makes some of the trickier operations possible, improves VM’s
performance…</b><b><br />
</b>Let’s get all network interface cards of the OS installed on the VM and then configure them.<span style="font-family: "Courier New", "Courier", monospace;"><br /></span><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;"># get all network cards. GuestUser is the username required for login to the GuestOS</span>
</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;">$nics =<b> Get-VMGuestNetworkInterface</b> $vm -GuestUser ‘administrator’ -GuestPassword ‘pass1234′</span></blockquote>
<div style="text-align: justify;">
We have dedicated the 192.168.2.* subnetwork for our test infrastructure, so let’s update the VMs IP and DNS addresses:</div>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>Set-VMGuestNetworkInterface</b> $nics[0] -Ip 192.168.2.2 –Dns 192.168.1.2 -GuestUser ‘administrator’ -GuestPassword ‘pass1234′</span></blockquote>
<div style="text-align: justify;">
If you need a more advanced configuration for your Guest OS, you can take a look at the <b>OSCustomization</b>
cmdlets, which give you the ability to configure user accounts, active
directory, workgroups as the VM is created. There are examples in the
<a href="https://www.vmware.com/support/developer/PowerCLI/index.html">documentation</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
After you finish configuring your networking, you should create a
snapshot that saves the state of your VM. This is useful when you want
to revert this VM to a previous state. Let’s create a snapshot for
future use:</div>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>New-Snapshot</b> –VM $vm –Name <b>“After network configuration – 2012.02.20”</b></span><span style="font-family: "courier";">
</span></blockquote>
<div style="text-align: center;">
<b>[Create environment configuration files]</b><b><br /></b><br />
<b><br /></b></div>
<div style="text-align: justify;">
It’s good to keep various data about your environment. We create a hashtable called <b>$env1</b>. It can store the names of virtual machines, the servers’ IP addresses, DB table names, etc.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You can use the NIC objects to build this configuration file for future test executions or to form a report. The <b>$nics</b> variable contains all the information you need such as IP, DNS, Subnetmask, etc:
</div>
<blockquote align="justify" class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;">$env1[“IpAddress”] = $nics[0].Ip</span><span style="font-family: "courier";">
</span></blockquote>
<div style="text-align: justify;">
You can save the hashtable $env1 to a file and use it as
configuration for your “execute test” script. This way you can easily
switch between environments with various properties.<span style="font-family: "Courier New", "Courier", monospace;"><br /></span></div>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;">$env1 | <b>Export-CliXml</b> “d:\CakeWizard\Testing\Environments\env1_win2008.xml”
</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;">#to use the configuration you import it using this call:</span>
</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;">$env1Config = <b>Import-CliXml</b> “d:\CakeWizard\Testing\Environments\env1_win2008.xml”</span><span style="font-family: "courier";">
</span></blockquote>
<div style="text-align: justify;">
Now <b>you can combine all these one-liners in a short script</b> that configures VM’s networking and creates a report/config file with the current IPs that are in use.</div>
<br />
<i>Simple, huh?</i><br />
<br />
<i>“What about applications and integration with other systems like Source
Control Repositories or test execution systems like Hudson/Jenkins?”</i><i><br /></i><br />
<div style="text-align: center;">
<b>[Set up tests and test framework]</b><b><br /></b><br />
<b><br /></b></div>
For even greater customization, you can execute custom scripts in the
Guest OS! By copying files to the Guest OS and executing them, you can
automate the following action:<br />
- downloading and installing the software under testing;<br />
- syncing sources with tests and frameworks;<br />
- preparing reports;<br />
- managing Microsoft products via their PowerShell API;<br />
- pretty much everything you can think of!<br />
<br />
<div style="text-align: justify;">
You can copy different executable files, ZIP files with scripts,
DLLs… everything you want, to the VM’s local file system. Let’s sync the
tests from our source control repository. I’ve written a short script
to create workspace and sync everything with it.<span style="font-family: "Courier New", "Courier", monospace;"><b><br /></b></span></div>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>Copy-VMGuestFile</b> -LocalToGuest </span><span style="font-family: "Courier New", "Courier", monospace;">-VM $vm -Source <b>“d:\CakeWizard\tools\sources_sync.bat”</b> –Destination “c:\CakeWizard\tools\perforce_sync.bat” -GuestUser “administrator” -GuestPassword ‘pass1234′</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;">#execute the script we’ve copied</span></span></blockquote>
<blockquote class="tr_bq">
<b><span style="font-family: "Courier New", "Courier", monospace;">Invoke-VMScript</span></b><span style="font-family: "Courier New", "Courier", monospace;"> -ScriptText “<span style="color: red;">c:\CakeWizard\tools\sources_sync.bat</span>” -VM $vm -GuestUser ‘administrator’ -GuestPassword ‘pass1234′</span><span style="font-family: "courier";">
</span></blockquote>
<div style="text-align: justify;">
The ScriptText parameter can point to another script or be the script
itself. So that makes it pretty easy to be included in Hudson/Jenkins
job.</div>
<div style="text-align: justify;">
The script you execute returns live results to your screen while
working inside the VM. This is great for monitoring the progress of a
long test run or analyzing test run results. The best thing about the <b>Invoke-VMScript</b> cmdlet is that it can execute many types of scripts: Powershell, BAT for Windows and <b>Bash </b>for Linux systems!</div>
<div style="text-align: justify;">
Now that we’ve prepared everything, it’s good time to create another snapshot. Let’s name it <b>“Ready for test execution”</b> or <b>“Clean state”</b>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: center;">
<b>[Install product]</b><b><br /></b><br />
<b><br /></b></div>
Let’s upgrade to the latest build version of our product. We have a
Powershell script that does the job. Let’s see how to execute it:<span style="font-family: "courier";"><b><br /></b></span><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>Invoke-VMScript</b> -ScriptText “<span style="color: red;">c:\CakeWizard\Tools\upgradeProduct.ps1</span>″ -VM $vm -GuestUser ‘administrator’ -GuestPassword ‘pass1234′</span></blockquote>
<div style="text-align: center;">
<b>[Create report]</b><b><br /></b></div>
<div style="text-align: center;">
<b><br /></b></div>
You can generate a test run execution report after the test execution.
Our report holds information about the test id, test status, log files
and execution times.<span style="font-family: "Courier New", "Courier", monospace;"><b><br /></b></span><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>Invoke-VMScript</b> -ScriptText “<span style="color: red;">c:\CakeWizard\Tools\generateReport.bat</span>” -VM $vm -GuestUser ‘administrator’ -GuestPassword ‘pass1234′ </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;"># locally copy a report</span> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>Copy-VMGuestFile</b> -GuestToLocal
-VM $vm -Source “c:\Tests\Results\Report\*.*” -Destination “d:\TestResults\Report\*.*” -GuestUser “administrator” -GuestPassword ‘pass1234′</span><span style="font-family: "courier";"><br /></span></blockquote>
<div style="text-align: center;">
<b>[Clean up environment / Revert to snapshot]<br />
</b></div>
<div style="text-align: center;">
<b><br /></b></div>
When you run a test (again, you can use Invoke-VMScript to trigger
execution), you might pollute your brand new Test_Environment_VM_1.
Wouldn’t it be great, if you could always go back to a clean state of
your test environment? This way you can be comfortable with running even
the deadliest, most insane, build-crashing tests. Our new script for
creating a new test environment could do the trick, but there’s an even
easier way to fix the ruined VM – snapshots!<span style="font-family: "courier";"><br /></span><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;"># reverting the vm to a previous state </span><b><br /></b></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"> </span>
<span style="font-family: "Courier New", "Courier", monospace;"><b>Set-VM</b></span> <span style="font-family: "Courier New", "Courier", monospace;">–VM $vm –Snapshot “Clean state”</span></blockquote>
<div style="text-align: center;">
<span style="font-family: "courier";">“</span><span style="font-family: "courier";">Set up once – test multiple versions!” </span></div>
<span style="font-family: "courier";"><br /></span><br />
<div style="text-align: justify;">
You can easily customize these one-line scripts for your own use cases.
By combining all of the scripts, you will automate your virtual
environment! You are just a step away from provisioning multiple test
environments!</div>
<div style="text-align: center;">
<br />
<b>[Copy VM to create a new virtual test environment]</b><b><br /></b></div>
<div style="text-align: center;">
<b><br /></b></div>
A VM is just a set of files, so we can copy a VM by copying its files.
Let’s create a new environment called “Test_Environment_VM_2”.<br />
<span style="font-family: "Courier New", "Courier", monospace;"><br /></span><br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;">#change directory to ‘vmstores:’. It gives you access to the datastore tree.
</span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;">#navigate to your datastore and Test_Environment_VM_1 location and copy it</span>
</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;">cd vmstores: </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>Copy-Item</b> “.\Test_Environment_VM_1” -Destination “Test_Environment_VM_2” –Recurse
</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><span style="color: #6aa84f;">#now let’s register the new VM</span> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New", "Courier", monospace;"><b>New-VM</b> –VMFilePath “[datastore_name] .\Test_Environment_VM_2\Test_Environment_VM_2.vmx” –Name “<span style="color: red;">Test_Environment_VM_2</span>”| <b>Start-VM</b></span><span style="font-family: "courier";"><br /></span></blockquote>
And you are ready with your new environment and John can help you with testing “Cake Wizard”<br />
<br />
<b>Note – there is an easier way to clone a virtual machine – check VM templates, a feature available in vCenter Server.<br />
</b><br />
<b><br /></b><br />
<div style="text-align: justify;">
Virtualization makes your testing process quite agile and scalable – you
can create more VMs on which to run tests, than the number of the
physical machines you can buy or power up. Even your developer
colleagues can use the VMs for developing the software in the first
place!</div>
<div style="text-align: justify;">
You can also easily revert a VM to a clean state, without losing any time for configuration.</div>
<div style="text-align: justify;">
You can set up and configure the VM so that most of the things that you
can do with a physical machine are possible (except for testing
specific/special hardware devices).</div>
<div style="text-align: justify;">
You will no longer fear of hardware failures, because your VM can be automatically migrated with no downtime.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You can automate all these tasks with the highly-rated tool – VMware vSphere PowerCLI. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<i>Well, Michael, I think that now you understand the advantages of <b>virtualization in testing</b>.
As quirky as this concept sounds, you’ll find that the basics are not
that different from the classical approach. Do you have any other
questions, we can discuss over a cup of coffee?</i></div>
<div id="surveyMonkeyInfo" style="text-align: justify;">
<div>
<script src="http://www.surveymonkey.com/jsEmbed.aspx?sm=TQt9TykCxBZBMimrOHu1mg_3d_3d">
</script></div>
<br /></div><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com2tag:blogger.com,1999:blog-8742396444701027849.post-74726443221193594542011-08-21T17:32:00.000+03:002015-06-20T23:01:42.008+03:00Javascript - the things which make me dislike itHi<br />
<br />
My experience with Javascript is at novice level but on the project I had to use it for,<br />
as a Java developer I couldn't have noticed the following problems:<br />
<br />
<span style="font-size: large;"><b>1. No spell-checking</b></span><br />
<br />
This is a dynamically typed language meaning that it cannot auto-complete and cannot be type-safe<br />
because you cannot know a variable's type before runtime. You can assign any type to 1 variable after its initialization...<br />
Also it cannot be checked when you wrote "connectoin" when you actually meant "connection" and<br />
you will get a null pointer error only at runtime...<br />
<br />
<b><span style="font-size: large;">2. Low IDE support</span></b><br />
<br />
There is no IDE for Javascript. You basically use an editor that can highlight words (Notepad++) .<br />
You make your own discoveries at what helps you fight with writing Javascript code.<br />
<br />
<b><span style="font-size: large;">3. Debugging is not cool</span></b><br />
<br />
<span style="font-size: small;">Today's browsers have integrated debugging tools for web-pages and generally Javascript but nevertheless it's still not as comfortable as setting breakpoints and then following the execution one step at a time.</span><br />
<br />
<br />
<span style="font-size: small;">Those are the few things that got me basically away from Javascripting ...</span><br />
<br />
<span style="font-size: small;">If you don't agree with my points, feel free to provide arguments against my theory.</span><br />
<br />
<span style="font-size: small;">Best regards,</span><br />
<span style="font-size: small;">Leni Kirilov </span><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-27154569318810726902011-08-20T17:02:00.000+03:002011-08-20T17:02:19.038+03:00A diffrent software architecture - LMAXIt was an interesting afternoon to read the article that the famous Martin Fowler had written a month ago.<br />
<br />
It's about a different kind of architecture, how it worked and how the software engineers got to that solution of their problems. The project is about processing multiple concurrent orders and the platform had to provide low latency. The team managed to create a system that copes with 6 million transactions per second.<br />
The strange thing is that they do it on a single-threaded application with in-memory database approach (caches).<br />
<br />
They have tried other more-conventional approaches like multi-threading and the Actor approach but the performance of the Queue was limiting them, also the need to synchronize threads and interactions between them, context switch at CPU level was drawing performance back.<br />
<br />
So they decided to separate input/output and processing into different modules.<br />
Each input event gets unmarshalled and all its required pre-processing (IO operations and credit card verification operations for example) are done before hand and inserted into a the main stream that is processed by the business logic unit.<br />
<br />
The team also create special implementations for collection classes so that they use caches better. They processed events not in a Queue approach but with a ring buffer and on it were running several processor modules - one for unmarshalling, one for backup (Journal) and Replicator and finally the Business Logic Processor. They are in a constant race and there are rules that prevent 1 from getting ahead of the other and processing a data field that isn't ready yet. This ring buffer has enormous size (20 million items)<br />
<br />
The main idea is that CPU can process fast sequence of operations which are simple (therefore very optimized by the Java compiler), and using in-memory caches (no SQL queries), this could push the performance of a system high.<br />
<br />
Also another gain for the team is that they don't have to cope with complex techniques like transactions, inter-thread communications etc...<br />
<br />
<br />
I think I've just covered the basics of this software architecture approach. If you are interested enough, do visit the original article at -> <a href="http://martinfowler.com/articles/lmax.html">http://martinfowler.com/articles/lmax.html</a><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com1tag:blogger.com,1999:blog-8742396444701027849.post-14296715598002328502010-10-19T10:42:00.008+03:002010-10-19T17:37:51.747+03:00DevReach 18+19 October Sofia, Bulgaria (part7)22...continued<br />
<br />
<a href="http://www.devreach.com/Event/Sessions.aspx#ASP.NET-provider-model"><b><span style="font-size: large;">Dynamic State Storage Using the ASP.NET Provider Model</span></b></a><br />
<br />
Interesting session about creating a storage for an application and making it with a unified interface.<br />
Dealing with problems when you have same kind of storage collections.<br />
Using the <b>isolateUser</b>, <b>isolateProvider</b>.<br />
<br />
Nice design for his library.<br />
<br />
<a href="http://www.devreach.com/Event/Sessions.aspx#Silverlight-RIA-Entity_Framework"></a><b><span style="font-size: large;">HTML5 and CSS3</span></b><br />
<br />
SVG vs Canvas<br />
SVG is slower for animatons<br />
Canvas is not suitable for low number of items which can be interacted with<br />
<br />
-ms ; -o ; -moz ; -webkit ---- these are specific for certain browser, default is used otherwise<br />
<br />
LESS - JS library that reduces and makes CSS easier when supporting different browsers<br />
Modernizr - make your site supporting older browsers (IE6 >)<br />
<br />
Recognize older/new browser --- the property "autofocus" -- tricky attribute<br />
<br />
CSS3 can put round edges for rectangles; 3D shadows; rotate images ... lots of nice animation<br />
<br />
<br />
<b><span style="font-size: large;">Anti-patterns </span></b><br />
DRY principle - Don't Repeat Yourself<br />
Assumption Driven Programming - don't assume something instead of asking the user<br />
Dependency Injection principle<br />
The God class - the one great class that does everything<br />
<br />
<br />
<br />
L.K.<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-70786075845225951792010-10-19T09:25:00.016+03:002010-10-19T10:42:01.041+03:00DevReach 18+19 October Sofia, Bulgaria (part6)...continued<br />
<b><span style="font-size: large;"><br />
HTML 5 crash course</span></b><br />
<br />
<span style="font-size: small;">HTML 5 is connected with everything that is modern and flashy today. </span><br />
<span style="font-size: small;">Introduction of iPad is in the same day as the HTML5 introduction.</span><br />
Adobe vs Apple conflict.<br />
<br />
"Apple is becoming the most important company in the US"<br />
<br />
www.html5rocks.com - some tricks, a site recommended.<br />
<br />
Browser vendors love HTML 5 because they don't want their products to be 'old'.<br />
HTML 5 is pushed into the history.<br />
<br />
HTML5 is not ready yet. It's good<br />
<br />
The sad facts:<br />
<br />
60% of Internet is used with IE6, IE5 and IE7 - they don't support HTML5.<br />
60% Windows XP<br />
15% still use IE 6.<br />
91% of the browser users use Windows - they have the grip<br />
<br />
Silverlight updates are quicker - they are pushed with automatic updates with Windows.<br />
<br />
In his oppinion "Html 5 > 4"<br />
<br />
www.html5test.com - test the browser about html5 support<br />
Chrome - 217 + 10 bonus<br />
IE8 - 27 + 0 bonus<br />
Opera 10.61 - 159 + 7 bonus<br />
<br />
Microsoft will never get 100% for ACID3 test because they don't want to support SVG fonts.<br />
<br />
<b>Syntax:</b><br />
HTML5 template is with a DTD... nobody validates it with a DTD. "A pain in the ass" - quote.<br />
AJAX was never specified.... they reverse-engineered it.<br />
HTML5 has a spec - that makes it a lot different. The error behaviour consistent.<br />
<br />
He simplified the HTML5... - charset, language, DTD validation - cleaner.<br />
<br />
<b>New semantic tags:</b><br />
Old way - meaningless IDs for "div" tag<br />
Google statistics : <b>code.google.com/webstats</b> about names of ID<br />
They took the statistics and used the mostly used words and make them special words. They made the best practices rules in HTML5.<br />
<br />
<b>WebMatrix -</b> interesting free tool for building web sites. Part of the WebPlatform. It's a direct competitor to PHP. <br />
Razor + MVC --- <b>"in a 6 months will be the hottest thing"</b><br />
<br />
"Microsoft's primary goals this year - Azure, IE9 and HTML5"<br />
<br />
<b>Modernizer - </b>javascript lib for audio<br />
<b>html5shim .code.google.com</b> -- javascript for adding HTML5 tags to IE6 (which doesn't support it)<br />
<br />
html5 - <b>audio tag</b><br />
html5boilerplate - best add-on pack for html5<br />
<br />
"Silverlight version of video is adaptive to the broadband width"<br />
<br />
Google created a site to refer to for fonts instead of distribute them in your own site as a local copy.<br />
<br />
<span style="font-size: small;">L.K. </span><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com1tag:blogger.com,1999:blog-8742396444701027849.post-70306371798161978612010-10-19T09:18:00.004+03:002010-10-19T11:02:31.964+03:00DevReach 18+19 October Sofia, Bulgaria (part5)...continued<br />
<br />
<b><span style="font-size: large;"><a href="http://www.devreach.com/Event/Sessions.aspx#parallel-programming">Designing Applications in the era of Many-core Computing</a>:</span></b><br />
<br />
This session was about making a unparalleled program use all cores of a CPU.<br />
The presenter was a Romanian so his program was the recipee for making goulash.<br />
He used threading on a higher level with a structure called a Task.<br />
A tasks can be combined to be one after another by a lambda expressions.<br />
<br />
<br />
<b><span style="font-size: large;"><a href="http://www.devreach.com/Event/Sessions.aspx#REST-WCF">Building RESTful Applications with the Open Data Protocol</a></span></b><br />
<br />
<span style="font-size: small;">The last session I attended was one regarding RESTful services.</span><br />
<span style="font-size: small;">The presenter was very high-spirited and it was a joy to listen to his explanations.</span><br />
<span style="font-size: small;">So REST services is exposing a service to be accessed via pure URL address through the browser. </span><br />
<span style="font-size: small;">Using the HTTP methods POST GET UPDATE DELETE to access the service if you have the access rights.</span><br />
<br />
<span style="font-size: small;">He demonstrated how to connect to such a service via a client.</span><br />
<br />
<span style="font-size: small;">He created an REST service. </span><br />
<span style="font-size: small;">He showed an easy API to do paging for the service.</span><br />
<br />
<span style="font-size: small;">It was a very nice presentation. </span><br />
<br />
<span style="font-size: small;">L.K. </span><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-57868643420603599562010-10-18T14:15:00.013+03:002010-10-19T10:59:54.278+03:00DevReach 18+19 October Sofia, Bulgaria (part4)...continued<br />
<br />
<b><a href="http://www.devreach.com/Event/Sessions.aspx#Windows-Phone-7">Easing into Windows Phone 7 Development</a></b><br />
<br />
<b> </b>The presenter : "How many of you hade a Windows Mobile device"<br />
.... some hands raised<br />
he: "I'm sorry." :)<br />
<br />
Fair enough...<br />
<br />
BUG: Oops, first Windows Phone 7 glitch - the hold of search button didn't make the menu came up.<br />
<br />
For developers:<br />
deveoper.windowsphone.com<br />
Expression Blend 4.<br />
Has a good emulator<br />
You need a developer account for 99$ from Microsoft to unlock your phone, to debug your device.<br />
You need Zune to connect to a device to test your application.<br />
<br />
NOT GOOD: There is a 10 application limit... you have to uninstall some of your applications that you are developing...<br />
That sounds like a pretty bad deal...<br />
<br />
BUG: He said himself he found a bug. After a few application deployments, it says it can't deploy more applications and it gets fixed when you disconnect the USB cable and reconnect it again.<br />
This is getting more and more interesting...<br />
<br />
The memory usage cap - 90 MB of processing memory space.<br />
<br />
PROBLEM: But using more memory produces strange exceptions following his words... he lost a lot of time until he thought of checking the memory usage.<br />
<br />
There are dark/light theme for the Windows Phone 7.<br />
He showed that it's easy to adapt your application to the theme.<br />
<br />
Changing icons automatically when theme is changed - use AppBar.<br />
- app bar is like a pop-up menu or the drag-menu in Android , but it's inside the application.<br />
<br />
The emulator can be rotated in horizontal mode and rotates the icons with nice motion.<br />
<br />
He raised the question:<br />
- how do you display tooltips when there is no mouseOver event?<br />
Well, his suggestion is design and for example wait for a few seconds and make a label visible.<br />
<br />
Panorama - a huge background image which is automatically moved depending on the count of the items in the panorama.<br />
<br />
Different sets of keyboards are available - chat keyboard, normal, etc<br />
<br />
L.K.<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-53244158076284572152010-10-18T13:03:00.008+03:002010-10-18T14:10:28.085+03:00DevReach 18+19 October Sofia, Bulgaria (part3)...continued<br />
<br />
<b><span style="font-size: large;"><a href="http://www.devreach.com/Event/Sessions.aspx#.NET">.Net tips and tricks</a></span></b><br />
<br />
<span style="font-size: large;">1. SQL injection prevention</span><br />
<%: ... %> -- for ASP.net and it prevents SQL injection etc<br />
Use it instead of <%=...%><br />
<br />
<span style="font-size: large;">2. Trace it</span><br />
<trace writetodiagnosticstrace="True"> -- better for debugging</trace><br />
<br />
add as a attribute in the page xml -> <b> </b><br />
<b>Trace=True</b><b> </b><br />
makes the other traces to be colored in <span style="color: red;">red </span><br />
<br />
<br />
<span style="font-size: large;">3. Caching</span><br />
http://tinyurl.com/c275vt - Update Callback<br />
<br />
He's showing some web caching with load testing.<br />
<br />
<% OutputCache ... - he increased the performance for a page showing database entries from 25 requests/sec to 250 req/sec.<br />
<br />
<span style="font-size: large;">4. use IDisposable when net using WCF</span><br />
http://tinyurl.com/az52gy<br />
and <b>"using()"</b><br />
<br />
<span style="font-size: large;">5. Action / Func keywords for lambda</span><br />
Don't Repeat Yourself - principle :) We know it. Nothing new.<br />
Action is for better logging.<br />
<br />
<span style="font-size: large;">6. Extension methods:</span><br />
<span style="font-size: small;">Search for some extension methods to improve given sites. </span><br />
<br />
<span style="font-size: large;">7. Testing different vesions of configurations</span><br />
custom config sections<br />
<span style="font-size: large;"><br />
</span><br />
<span style="font-size: large;">8. WebForms - don't use Labels too much</span><br />
<span style="font-size: large;">9. WebForms - ViewState - be careful with its usage</span><br />
- move the viewState to the bottom of the page because of bots collect a few thousand bytes from a page to scan it. Put your data to the top!<br />
<br />
<span style="font-size: large;">10. Some tools he uses everyday</span><br />
LinqPad - linqpad.net<br />
Reflector - reflector.red-gate.com - similar to <strong>Java Decompiler</strong> - see the source of a class file<br />
FireBug - for Firefox<br />
Fiddler - for IE<br />
ViewState Decoder - http://tinyurl.com/2msmev<br />
<br />
<br />
L.K.<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-59468852277845912092010-10-18T10:35:00.012+03:002010-10-18T13:16:19.253+03:00DevReach 18+19 October Sofia, Bulgaria (part2)...continued<br />
<br />
<strong><span style="font-size: large;">Internet Explorer 9</span></strong><br />
Roman Russev from Microsoft Slovakia is speaking about it.<br />
fast / clean / secure / interoperable<br />
<br />
He takes notice of the new open policy of Microsoft - the open beta releases of Win7, IE etc<br />
<br />
Interesting features are like pinning pages from IE directly to the taskbar of Windows7.<br />
<br />
<br />
<strong><span style="font-size: large;">Visual Studio 2010 Light Switch</span></strong><br />
It's all about data and screens.<br />
It's a tool for not-developers to create business applications - making it easier.<br />
<br />
First step - "choose a language, you can decide how are you going to deploy it later"<br />
Next step - describe the data for the application<br />
<br />
It looks very point-n-click.<br />
<br />
Next step - building a screen. Just adding a template hooks the data with the look.<br />
Many out-of-the-box stuff added like - search bar, ribbon, tabs etc...<br />
<br />
Looks pretty nice to have all these and not work hard to implement them.<br />
<br />
<br />
L.K.<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-244967208448803172010-10-17T03:48:00.013+03:002010-10-18T13:05:09.772+03:00DevReach 18+19 October Sofia, Bulgaria (part1)Expect my comments about <a href="http://www.devreach.com/">DevReach</a>, .net technologies and cloud computing.<br />
I know this site is about Java and technology but I see it as a good opportunity to check what is the competition going to present to the public.<br />
<br />
Expect updates!<br />
<br />
--<br />
<br />
Registration went smoothly. I'm eagerly expecting the beginning of the keynote in the 13th hall.<br />
<br />
Interesting facts:<br />
- 2010 is the 5th DevReach and it has double the speakers, sessions and attendees than the first DevReach back in 2006.<br />
<br />
- There will be a prize for the first registers - a free Visual Studio 2010 Ultimate<br />
<br />
<br />
Vertigo's CEO is talking about User Experience.<br />
He's presenting lots of sites that are streaming video.<br />
A new Jay-Z's book has a site written on Silverlight - with lots of video, maps etc - very awesome.<br />
Keynote "You have to learn about design!"<br />
<br />
5 important areas for design:<br />
- <b>Industrial design</b><br />
Surrounds us; he's talking about showers - Desing + Intent ! Everything is meant with a reasaon. "Observe and ask yourself why!"<br />
"Developers, we are very good at accepting bad user experience. We can adapt. Common user can't."<br />
<br />
<b>- Usability</b><br />
Jakob Nielson<br />
How long does it take you to accomplish your goal?<br />
"Honestly, people don't care about software" :)<br />
"Don't make me think" - by Steve Krug --- about easy usage of products<br />
"You could be embarrassed by testing your product with real users..."<br />
<br />
<b>-Typography</b><br />
Fonts fonts fonts<br />
They can make your intention wrong or extremely right and immersive.<br />
He explains the curves of fonts... He says that the emptiness is more important than the black ink part of a letter.<br />
Helvetica is his favourite font.<br />
<br />
<b>-Natural UI</b><br />
<b>-Motion graphics</b><br />
<br />
Introduction of mouse - not as intuitive as touch screens! The presenter's daughter got confused... nice example!<br />
Touch - become interesting when iPhone came out.<b></b><br />
"Nobody wants a 15 000 $ coffee table..." :) Funny guy is making us laugh.<br />
<br />
Oh my god!<br />
He's showing us Windows Phone 7 and its intuitive UI<br />
"You are not using Helvetica" :) - nice point!<br />
<br />
Key concept is a caption (text) which is partly cut out of the screen and it MAKES you to slide to see the rest of the application.<br />
<br />
L.K<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-26916493506154770252010-10-07T16:55:00.010+03:002010-10-09T00:07:34.817+03:00Java2Days Sofia Day 1 (part 6)17:00 - <a href="http://2010.java2days.com/agenda/google-app-engine-for-java">6. Google App Engine for Java Ice Penov</a><br />
<br />
GAE = Google App Engine<br />
Google Eclipse Plug-in - comfortable for developing in Java.<br />
<br />
GAE lets you run and maintain your web applications<br />
GAE supports Java and Python<br />
<br />
An application will become available on *.appspot.com<br />
<br />
Benefits and advantages of GAE:<br />
- cloud<br />
- free resources<br />
- Google infrastructure for scalability<br />
- easy integration with Google accounts and other services<br />
<br />
(demonstrates how to create a GAE application)<br />
<br />
GWT = Google Web Toolkit (made for JavaScript and AJAX)<br />
<br />
GWT compiles Java to JavaScript => slower compile . That is done because it's executed in a browser.<br />
<br />
Quote:<br />
"OK. I'm speaking with the Google cloud... I should socialize more" - after creating a Google application that sends messages via Google Talk and you can return your parameters to your application as you respond via Google Talk as well. :)<br />
<br />
GAE is in sandbox.<br />
- cannot write to file system<br />
- cannot open socket to another host<br />
- cannot open a thread<br />
- cannot make explicit System calls like System.exit()<br />
<br />
There is a white-list of JRE features supported by the GAE cloud. (easily googleable)<br />
- he thinks that this is a major drawback, because you can't make your application run on your server and then associate it with the cloud.<br />
<br />
There are some metrics services on the GAE - CPU time, request-count etc...<br />
<br />
Out-of-the-box Services API:<br />
<br />
- storing data is done with Google BigTable which is a NoSQL<br />
JDO preferred to JPA; GQL is available - no real info given for this<br />
------- cannot use JOIN query and aggregation queries<br />
<br />
- MemCache Java API - distributed in-memory data cache<br />
JCache API can be used<br />
<br />
- Mail Service - Java Mail API can be used<br />
- XMPP - Google Talk uses this IM protocol<br />
- Image service - resize, rotate, flip, crop<br />
- Google Account - you can integrate openID into your GAE application<br />
<br />
GAE and other technologies interoperabilities:<br />
- JEE - not supported JDBC, RMI,<br />
- other JVM languages - supported<br />
<br />
-3rd party <br />
--- supported - Spring, Tiles, Struts, GWT<br />
--- not supported - Hibernate, iText, Rich(ICE)Faces<br />
<br />
<br />
<br />
And that's it for today!<br />
Java2Days first day is over. I hope you find these notes interesting. I wrote them as I was attending the sessions so my posts could lack enough sentences but you will forgive me :)<br />
<br />
Unfortunately, I cannot cover Java2Days Day 2 and share my thoughts.<br />
<br />
Leni Kirilov<div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-85561915290833669582010-10-07T16:05:00.007+03:002010-10-09T00:03:02.864+03:00Java2Days Sofia Day 1 (part5)Quotes from other sessions not that interesting:<br />
<br />
JSF has no pros<br />
Oracle + Sun = Snoracle<br />
<br />
<a href="http://2010.java2days.com/agenda/building-restful-web-services-with-java">16:00 - 5. Building RESTFul Web Services with Java Vassil Popovski, VMware</a><br />
<br />
REST Principles:<br />
-- everything is a resource<br />
-- resources have identifiers<br />
-- uniform access<br />
-- resources have representations<br />
-- link things together<br />
<br />
HTTP methods<br />
POST UPDATE GET DELETE<br />
<br />
JAX-RS - java API for rest services. The presenter says that this SRS seems readable.<br />
<br />
java.ws.rs.*<br />
<br />
JAX-RS = POJO + Annotations<br />
<br />
Best implementation of JAX-RS is CXF<br />
<br />
Key concepts<br />
- resource classes - have at least 1 resource method<br />
- resource methods - annotated with @POST @GET etc<br />
- provider classes - extending JAX-RS interface<br />
<br />
More commonly-used annotations:<br />
@Path - relative path for a resources<br />
@Consumers / @Produces - for media types<br />
- produces = output<br />
- consumes = input<br />
@PathParam<br />
@Context<br />
@QueryParam - inject the value of a query into a variable<br />
<br />
Benefits:<br />
- scalable solutions<br />
- compared to SOAP is much simpler<br />
<br />
<a href="http://javamissionary.blogspot.com/2010/10/java2days-sofia-day-1-part-6.html">(next-page) </a><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-78987831622797107722010-10-07T14:13:00.014+03:002010-10-08T23:59:50.448+03:00Java2Days Sofia Day 1 (part4)<a href="http://2010.java2days.com/agenda/mission-critical-enterprisecloud-applications">4. Mission Critical Enterprise/Cloud ApplicationsEugene Ciuran</a><br />
<br />
What is Cloud and how do we use it?<br />
- quick deployment<br />
- virtualize hardware<br />
- replace data center<br />
<br />
Advantages<br />
- turn on/off machines (virtual hardware) as needed - all you need is a credit card<br />
<br />
Scalability:<br />
- horizontal - load-balancing<br />
- vertical - improve applications - more hardware<br />
<br />
high availability != uptime<br />
If your network is down and servers UP - your application is not AVAILABLE for users.<br />
<br />
Availability scale chart<br />
90% - one nine = 36.5 days down<br />
99% - two nines = 4 days down<br />
99,9% - ... = 9 hours<br />
... 53 minues<br />
... 5.3 minutes<br />
....32 sec<br />
<br />
from 90% - 99 -- you double the resources<br />
Each step, the cost is doubled.<br />
<br />
The best option at the moment is 99.9%<br />
Well, at 2008 Amazon was down for 9 hours... it cost them much.<br />
<br />
SLA = Service Level Agreement - agreement between customer and a vendor<br />
SLA is not a legal document!<br />
<br />
The most important question is "What do I do when an outage happens? How do I repair a disaster?"<br />
<br />
At the point of 5-6 nines you see that cloud will cost you as much as building your own infrastructure!!!!<br />
<br />
Hybrid cloud architecture - some data that is not mission-critical is stored in the User part, so when that part goes down , your applications are still working.<br />
<br />
Amazon vs Google App Engine vs Rackspace<br />
elastic load-balancer vs static stateless calls<br />
<br />
Interesting case study about a project not scaling and going to migrate to a cloud.<br />
<br />
Quote:<br />
"If there is a mission-critical application/data just write it on Java... .Net is great, but if your job depends on it - just write it on Java" - The comment to do on a Java conference :)<br />
<br />
- introduced ESB for scaling<br />
- although ESB has many connections, it is not the single-point-of-failure - it is the load-balancer(which was another virtual machine)<br />
<br />
<a href="http://javamissionary.blogspot.com/2010/10/java2days-sofia-part5.html">(next - page)</a><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-67703752973357353382010-10-07T11:59:00.019+03:002010-10-07T14:14:12.118+03:00Java2Days Sofia Day 1 (part3)12:00 <a href="http://2010.java2days.com/agenda/a-quick-tour-of-contexts-and-dependency-injection-for-java-ee">3. A Quick Tour of Contexts and Dependency Injection for Java EE Reza Rahman</a><br />
<br />
The nice looking Indian dude Reza will explain the JEE6 introduced feature CDI / DI.<br />
<br />
CDI/DI is the most important new feature, if we believe him.<br />
CDI is about application orchestrations.<br />
<br />
@Qualifier - a mechanism to introduce additional logic in a bean<br />
<br />
The general perspective is that JEE6 applications using CDI will include lots of annotations<br />
like @Inject, @Qualifier, @Decorator @Produces, @xxxxScoped ...etc etc - may be 20 more<br />
<br />
<a href="http://javamissionary.blogspot.com/2010/10/java2days-sofia-day-1-part4.html">(next-page)</a><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-60003911684904973252010-10-07T11:29:00.006+03:002010-10-08T23:53:47.686+03:00Java2Days Sofia Day 1 (part2)11:00 - <a href="http://2010.java2days.com/agenda/introduction-to-spring-integration-and-whats-new-in-spring-integration-2-0">2.Introduction to Spring Integration and What's new in Spring Integration 2.0 <br />
Josh Long & Oleg Zhurakousky, VMWare</a><br />
<br />
Pipes and Filters - this is the basics of Spring - similar to Linux.<br />
=> loose coupling mechanism<br />
<br />
(Interesting way of question->answer way to present your product. The two presenters are great!)<br />
<br />
Channels are comfortable for postponed communication. When both sides aren't presented at the same moment in time. a.k.a publish/subscribe.<br />
<br />
Pipes are channels<br />
Filters are endpoints.<br />
<br />
<i>Message endpoint types:</i><br />
Transformers - convert payload or modify headers<br />
Filters - discard messages based on boolean evaluation<br />
Router - determine next channel based on content<br />
Splitter - generate multiple messages from one<br />
Aggregator - assemble a single message from multiple<br />
<br />
Spring Integration - it's integrated in the Spring framework.<br />
(long demo with small letters... not everybody sees that good and they didn't zoom it permanently...)<br />
<br />
<a href="http://javamissionary.blogspot.com/2010/10/java2days-sofia-day-1-part3.html">(next part)</a><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0tag:blogger.com,1999:blog-8742396444701027849.post-33798496106908034282010-10-07T10:20:00.014+03:002010-10-08T23:48:45.219+03:00Java2Days Sofia Day 1 (part1)11Here I'm going to blog my thoughts about the sessions:<br />
<br />
9:30 - 0. Introduction<br />
<br />
The introduction was translated live in both English and French by two girl-students. :) They were kind of shy and inexperienced but it was funny to watch them.<br />
<br />
Unscheduled introduction by a dude from Oracle forced the Vitosha schedule to be 30 minutes behind the other xxx2Days presentations... Great organization ...<br />
<br />
<br />
10:00 - <a href="http://2010.java2days.com/agenda/java-ee-6-why-and-how-j2ee-became-popular-again">1. Java EE 6 - why and how J2EE became popular again</a> <br />
<br />
Regarding JEE6 the new Oracle employee Alexis Pouchkine said that NetBeans is the best for JEE6 development today. Eclipse is still behind. Go go, NetBeans!<br />
<br />
Expect more annotations in JEE6.<br />
<br />
Ruby developers don't create applications much faster than Java developers anymore. Just 5-10% faster.<br />
<br />
JEE6 compliant application servers are : Glassfish, Oracle's WebLogic, and a few more.<br />
<br />
He's making a comparison between JEE5 and JEE6. JEE5 was all about making the development faster and easier, but JEE6 includes a lot of new features.<br />
<br />
Detailed explanations for<br />
- JAX-RS<br />
- Bean validation<br />
- something like assertions with annotations for fields of beans - <b>@Valid </b>annotation makes validation recursive<br />
<b> - </b>you can create your own validation annotations<br />
<b> - </b>Web Profile<br />
<b> -</b> CDI - very interesting annotations for defining exact implementations and validations etc... Interesting code samples<br />
<br />
Expect JEE7 with cloud features. If I can suppose right, I expect Java7 features as well :) That means we won't see it for another 2-3 years.<br />
<br />
<a href="http://javamissionary.blogspot.com/2010/10/java2days-sofia-day-1-part2.html">(next-page)</a><div class="blogger-post-footer">Feed provided by Leni Kirilov</div>Leni Kirilovhttp://www.blogger.com/profile/08267410519502016166noreply@blogger.com0