Monday, December 15, 2014

Sonarqube t-shirt for valuable rule

I got t-shirt for idea for static code analysis
http://www.sonarqube.org/suggest-a-valuable-rule-win-a-sonarqubet-shirt/
http://jira.sonarsource.com/browse/RSPEC-2212
https://github.com/checkstyle/checkstyle/issues/141

you can do that to






Wednesday, December 3, 2014

Checkstyle GSOC 2014 results


Checkstyle is a development tool which helps Java programmers to write a code that adheres to specific coding standards. This summer our organization participated in GSoC for the first time. Our main idea for GSOC 2014 was to improve Checkstyle ANTLR grammar in order to support Java 8 syntax changes. The next idea was to allow Checkstyle to validate comments and JavaDoc blocks in sources. And the last, we wanted to create Checkstyle config which covers Google’s style guide for Java that would come with Checkstyle distribution. GSoC has offered three student slots, which allowed us to realize our exciting ideas this summer.

ANTLR grammar for Java 8 features  -- Student: Ilja Dubinin


Java 8 is already released , but users who rely on Checkstyle to enforce code standards(style) can not use Java 8 features as Checkstyle is crashing on lambda and default methods appearance. This forces users to choose between using either Java 8 or Checkstyle. Some organizations enforce code standard adherence even on commit hook that makes choice even more acute.
Ilja made it possible to use Checkstyle on Java 8 specific sources. His work did not involve massive coding, however but he did a detailed investigation of all aspects and usages of new Java 8 features. He analyzed massive java grammar and found places where update is essential and performed it without damaging any other parsing features. He did massive testing on open-source projects that already use Java 8 features, one of the examples is reported on openjdk.
My best experience from working with Ilja was that he did most of development without mentor supervision , and he always reported results on time.

By Roman Ivanov, Checkstyle Mentor



ANTLR grammar for comments and Documentation comments (JavaDocs)  -- Student: Baratali Izmailov


    Completion of this project  will allow Java developer to validate their JavaDoc to comply with  specific style guide by Checkstyle. In addition to non configurable JDK DocLint feature that is appeared in Java 8, Checkstyle allows developers to write their own complicated validation rules(example) for JavaDoc and comments easily. This task was divided in 2 parts:  
1. Add to internally created parse tree single-line and multiline comments
2. Add grammar based parser for JavaDoc comments that is a special format of multiline comment.
    For (1) Baratali updated existing Checkstyle ANTLR grammar while for (2) he wrote the separate ANTLR4 grammar and parsing processor which supports standard and custom JavaDoc tags and JavaDoc html4 formatting.
No significant changes were made to Checkstyle API. API update is absolutely compatible, no changes in any existing Checks are required. Comments could be available in parse tree only when Check require comments.
Baratali tested his code by writing UTs and running updated Checkstyle on openjdk8, spring, guava and some another huge opensource projects.

By Daniil Yaroslavtsev and Roman Ivanov, Checkstyle Mentors



Checkstyle configuration for “Google Java Style” guide  -- Student: Maxim Vetrenko

“Google Java Style” guide is the second most popular guide among the open source community. Finally it can be applied and used in projects a lot more easier with the aid of Maxim’s work. If you do not know what style to use or do not want to invent your own style - just use Google’s code standard, as it is proven style from prominent developers.
The main goal of the project was to review requirements of Google’s Java Code Style and to create a Checkstyle configuration for all rules of that guide that could be validated automatically.
The main problem was to instill in student mind best practices of development process. Changing student’s “I will code right away” approach to the “I will understand the problem, ask questions, write tests first, slice and dice big task in small sub-tasks and only then code the program” approach. This led to the “every day” communication practice which played a key role in finishing the project successfully.
Created configuration was tested on Guava Google Core Libraries for Java, final report is here. Detailed Checkstyle coverage report for Google Style is located here.

By Ruslan Diachenko and Roman Ivanov, Checkstyle Mentor
s



We are pleased to announce that Checkstyle had 3 students who successfully complete at their first  year Google Summer of Code program. If you would like to read more about the work students completed on Checkstyle, during this year’s program, you can check out our mailing list posts or twitter.

By Roman Ivanov Checkstyle Organization Administrator for Google Summer of Code

Tuesday, November 18, 2014

Excessive use of Guava's functional programming

https://code.google.com/p/guava-libraries/wiki/FunctionalExplained

Excellent to my mind ! Common sense should win functional craziness.

Excessive use of Guava's functional programming idioms can lead to verbose, confusing, unreadable, and inefficient code. These are by far the most easily (and most commonly) abused parts of Guava, and when you go to preposterous lengths to make your code "a one-liner," the Guava team weeps.

Imperative code should be your default, your first choice as of Java 7.

Saturday, November 1, 2014

Sync Eclipse workspace settings in sync

Looks like my wishes for Eclipse like :
- Setting workspace preferences.
- Configuring dynamic working sets.
- Keeping project preferences files in sync.

implemented in following project: https://wiki.eclipse.org/Eclipse_Oomph_Installer

Wednesday, October 22, 2014

How to use snapshot checkstyle version in maven plugin

Base on knowledge from http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html#Configure_the_Checkstyle_Plugin_to_use_your_custom_checks

you can easily force to maven checkstyle plugin to use custom/snapshot/different version of Checkstyle library.
It is very useful for testing of new Checks and generating HTML report on big sources on checkstyle library that you want and not a default old Checkstyle version that is attached to plugin.

<project>
...
  <build>
    <pluginManagement>
      <plugins>
....
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-checkstyle-plugin</artifactId>
     <version>2.15</version>
     <dependencies>
       <dependency>
   <groupId>com.puppycrawl.tools</groupId>
         <artifactId>checkstyle</artifactId>
          <version>6.5-SNAPSHOT</version>
       </dependency>
     </dependencies>
        <configuration>
          <configLocation>my_checkstyle.xml</configLocation>
          <enableFilesSummary>false</enableFilesSummary>
        </configuration>
   </plugin>        
.....
      </plugins>
    </pluginManagement>
  </build>
......
  <reporting>
    <plugins>
     <!-- that plugin is required to link violation with source code, without that plugin report is useless and hard to use -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>2.5</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.15</version>
<!-- Specifying configuration here will take effect on the execution of "mvn site",
          but will not take effect on the execution of "mvn checkstyle:checkstyle"  -->
<configuration>
           <configLocation>checkstyle.xml</configLocation>
            <failOnViolation>false</failOnViolation>
            <enableFilesSummary>false</enableFilesSummary>
</configuration>
      </plugin>
    </plugins>
  </reporting>
....
</project>

Build HTML report by "mvn site" command, or "mvn checkstyle:checkstyle".

to have different HTML reports (for each tested Check) over the same sources - just save index.html as index-MyCheck.html, and do report generation for each Check separately.

Tuesday, October 14, 2014

Sevntu Checkstyle release 1.12.0

new release of Checkstyle extension (Sevntu.Checkstyle) 1.12.0, with new checks:
DiamondOperatorForVariableDefinitionCheck,
PublicReferenceToPrivateTypeCheck,
TernaryPerExpressionCountCheck

Updates in:
RedundantReturnCheck
CustomDeclarationOrderCheck
LineLengthCheck
ForbidThrowAnonymousExceptionsCheck,

Details:
http://daniilyar.blogspot.com/2014/10/sevntu-checkstyle-release-112-checks.html

Wednesday, October 1, 2014

How to copy static site to SourceForge hosting

Sources of wisdom:
http://sourceforge.net/p/forge/documentation/Shell%20Service/
http://sourceforge.net/p/forge/documentation/File%20Management/#access-paths


~ $ ssh romanivanov,checkstyle@web.sourceforge.net

Welcome!

        This is a restricted Shell Account.
                                           You can only copy files to/from here.

                                                                                PTY allocation request failed
Shared connection to web.sourceforge.net closed.

~/ $ ssh -t romanivanov,checkstyle@shell.sourceforge.net create
Password:

Requesting a new shell for "romanivanov" and waiting for it to start.
creating... starting...

This is an interactive shell created for user romanivanov,checkstyle.
Use the "timeleft" command to see how much time remains before shutdown.
Use the "shutdown" command to destroy the shell before the time limit.
For path information and login help, type "sf-help".

[romanivanov@shell-22008 ~]$ uname -a
Linux shell-22008 2.6.18-308.8.2.el5.028stab101.1 #1 SMP Sun Jun 24 20:25:35 MSD 2012 x86_64 x86_64 x86_64 GNU/Linux
[romanivanov@shell-22008 ~]$ ls -la
total 32
drwx------ 3 romanivanov users 4096 Feb  1  2011 .
drwxr-xr-x 3 root        root  4096 Sep  9 04:27 ..
-rw-r--r-- 1 romanivanov users   33 Jan 22  2009 .bash_logout
-rw-r--r-- 1 romanivanov users  176 Jan 22  2009 .bash_profile
-rw-r--r-- 1 romanivanov users  124 Jan 22  2009 .bashrc
-rw-r--r-- 1 romanivanov users  515 Jun 15  2008 .emacs
drwxr-xr-x 4 romanivanov users 4096 Dec  9  2010 .mozilla
-rw-r--r-- 1 romanivanov users  633 Jun 13  2009 .zshrc
lrwxrwxrwx 1 root        root    30 Apr 26  2012 userweb -> /home/userweb/r/ro/romanivanov

[romanivanov@shell-22008 ~]$ cd /home/project-web/checkstyle/htdocs/

========================

copy big files from local PC:

~/ $ scp report-openjdk8.tar.gz  romanivanov,checkstyle@web.sourceforge.net:

Friday, August 29, 2014

Examine Apache configuration locations on server

-root@centos-server ~]# which httpd
/usr/sbin/httpd


[root@centos-server ~]# /usr/sbin/httpd -V | egrep ROOT\|SERVER_CONFIG
-D HTTPD_ROOT="/etc/httpd"
-D SERVER_CONFIG_FILE="conf/httpd.conf"


[root@centos-server ~]# grep  "^[iI]nclude" /etc/httpd/conf/httpd.conf
Include conf.d/*.conf

[root@centos-server ~]# ls -la /etc/httpd/conf.d/
total 16
drwxr-xr-x. 2 root root 4096 Aug 14 21:06 .
drwxr-xr-x. 4 root root 4096 Aug 14 21:06 ..
-rw-r--r--. 1 root root  392 Jul 23 14:18 README
-rw-r--r--. 1 root root  299 Jul 18 06:27 welcome.conf
...... here will be your other confs that are included

[root@centos-server ~]#  less /etc/httpd/conf.d/welcome.conf 
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL.  To disable the Welcome page, comment
# out all the lines below.
#
<LocationMatch "^/+$">
    Options -Indexes
    ErrorDocument 403 /error/noindex.html
</LocationMatch>


Wednesday, July 2, 2014

false negatives and false positives


Result of validation could be false negatives (no issue reported) or false positives (incorrect issues reported).

Friday, June 27, 2014

Google Java Style - mandatory braces rules

During development of Checkstyle configuration for Google Java Style,  we found two rules that are looks like conflicting . 

In 4.1.1 Google say:
Braces are used with if, else, for, do and while statements, even when the body is empty or contains only a single statement.

in 4.1.3 Google say:
An empty block or block-like construct may be closed immediately after it is opened, with no characters or line break in between ({}), unless it is part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else or try/catch/finally).

So in 4.1.1 IF-ELSE could be {}, but in 4.1.3 there is unclear "unless" that either conflict with 4.1.1 or mean smth else that it not described.

After long discussion with friends and investigation :

Rule 4.1.1 tell us to always use braces for statements that use blocks

// BAD
if () {
  ...
} else
  i++;

It must be
// GOOD
if () {
  ...
} else {
  i++;
}

// it is OK, old fashioned but ok
int index = 0;
for (; index < s.length() && s[index] != 'x'; index++) {}

// OK, side effect in condition expression is bad design , but it is not matter of style/formatting 
while ((r = in.read()) != 0) {}

So ELSE is just another structure that could have braces so it have to have braces no matter what.


Rule 4.1.3 extend 4.1.1 and demand that braces should not be empty in multi-block statements, small wording conflict in ELSE case is not intentional and if apply rules in sequence 4.1.1 and then 4.1.3 all will be fine:

// BAD
try {
  doX();
} catch (Exception e) {}

// BETTER
try {
  doX();
} catch (Exception e) {
  // Here's why I'm swallowing this exception
}

// BAD
if (expr) {} else {
  doSomething();
}

// BETTER
if (expr) {
  // Here's why I'm not doing anything here....
} else {
  doSomething();
}

Get java process heap dump and analyse it by jhat


1. Get all java processes ids
17:17 ~/java $ jps -vm
14970 Jps -vm -Dapplication.home=/usr/lib/jvm/java-7-oracle -Xms8m
8850 org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar -data /home/rivanov/workspace -os linux -ws gtk -arch x86_64 -showsplash /home/rivanov/ ..................... -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms40m -Xmx512m

2. generate heap dump for application, in my case it is Eclipse.
17:19 ~/java $ jmap -dump:format=b,file=eclipse_heap.bin 8850
Dumping heap to /home/rivanov/java/git/dmt/eclipse_heap.bin ...
Heap dump file created

3. run jhat tool from JDK to analyse heap dump.
17:19 ~/java $ jhat eclipse_heap.bin 
Reading from eclipse_heap.bin...
Dump file created Fri Jun 27 17:19:37 PDT 2014
Snapshot read, resolving...
Resolving 1548547 objects...
Chasing references, expect 309 dots.....................................................................................................................................................................................................................................................................................................................
Eliminating duplicate references.....................................................................................................................................................................................................................................................................................................................
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.


4. Open in browser "http://localhost:7000/".
jhat is far from fancy heap dump analyser in comparison to Eclipse's MAT, jvisualvm, ...... but it is provided together with JDK and nothing should be installed .


Saturday, June 14, 2014

"Skipping JaCoCo execution ...." problem in maven project


For Checkstyle project I decided to use coveralls.io service to show UTs coverage as banner.
I used that instruction to make it for java maven project. Amazing documentation with example description worked fire for simple projects(sevntu.checkstyle , dsm-maven-plugin).

But For Checkstyle I had an error:

[romani]$ mvn jacoco:report coveralls:jacoco

...

[INFO] Skipping JaCoCo execution due to missing execution data file:/home/travis/build/checkstyle/checkstyle/target/jacoco.exec

...

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:2.2.0:jacoco (default-cli) on project checkstyle: I/O operation failed: /home/travis/build/checkstyle/checkstyle/target/site/jacoco/jacoco.xml (No such file or directory) -> [Help 1]


That problem is happening when jacoco failed or did not registered his agent to instrument some code and gather statistics before tests are launched. 

Problem was in surefire-plugin, that was declared as:
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <argLine>-Duser.language=en -Duser.country=US</argLine>
        </configuration>
      </plugin>

Proper configuration is (attention to bold part):
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <argLine>${argLine} -Duser.language=en -Duser.country=US</argLine>
        </configuration>
      </plugin>
.

final version of my pom.xml (see "travis" profile) and travis.yml.

Useful links that I used for investigation:

Saturday, June 7, 2014

My donation for Ubuntu 14.04


Just because it is cool and useful - 22$:

DescriptionUnit priceQtyAmount
Ubuntu Desktop$20.00 USD1$20.00 USD
...


Tip to Canonical$2.00 USD1$2.00 USD

Thursday, May 8, 2014

Maven release plugin skipped version bump



How to fix the problem - just do that version bump yourself manually, second time it will work automatically

Here is history of commands of my failed 6.6.15 and 6.6.16, and how I made it work:

git tag -d 6.6.15
git tag -d 6.6.16
git push origin :/ref/tags/6.6.15
git push origin :refs/tags/6.6.16
mvn release:clean release:prepare -Darguments='-DskipTests=true'
gitk --all
git reset HEAD~1 --hard
git clean -fx
git pull
gitk --all
mvn versions:set -DnewVersion=6.6.16-SNAPSHOT
git status
git clean -fx
git diff
git add .
git commit -m "manual version bump"
git push
mvn release:clean release:prepare -Darguments='-DskipTests=true'
git pull
git clean -fx
Another way to fix similar problem is to update maven-release-plugin to new version:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>


 </plugin>

result in tag commited to remote but version bump was not happen to snapshot, see logs for details



outputs from picture provided below.


problematic launch output:
===================================================
[INFO] [INFO] Building jar: /home/rivanov/java/git/feed/extract/target/extractor-tests.jar
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Reactor Summary:
[INFO] [INFO] 
[INFO] [INFO] feed ............................................. SUCCESS [  X.XXX s]
[INFO] [INFO] feed-access ...................................... SUCCESS [  X.XXX s]
[INFO] [INFO] feed-extract ..................................... SUCCESS [  X.XXX s]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 4.597 s
[INFO] [INFO] Finished at: 2014-03-27T15:17:56-08:00
[INFO] [INFO] Final Memory: 34M/222M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git add -- pom.xml access/pom.xml extract/pom.xml
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git status
[INFO] Working directory: /home/rivanov/java/git/feed











[INFO] Tagging release with the label 6.6.15...
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git 
tag -F /tmp/maven-scm-1595271495.commit 6.6.15
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed 
&& git push git@git.mycompany.com:feed 6.6.15
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git ls-files
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Transforming 'feed'...
[INFO] Transforming 'feed-access'...
[INFO] Transforming 'feed-extract'...
[INFO] Not removing release POMs
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git add -- pom.xml access/pom.xml extract/pom.xml
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git status
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Release preparation complete.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] feed ............................................. SUCCESS [ 11.454 s]
[INFO] feed-access ...................................... SKIPPED
[INFO] feed-extract ..................................... SKIPPED






correct launch output:
====================================================
[INFO] [INFO] Building jar: /home/rivanov/java/git/feed/extract/target/extractor-tests.jar
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Reactor Summary:
[INFO] [INFO] 
[INFO] [INFO] feed ............................................. SUCCESS [  X.XXX s]
[INFO] [INFO] feed-access ...................................... SUCCESS [  X.XXX s]
[INFO] [INFO] feed-extract ..................................... SUCCESS [  X.XXX s]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 4.597 s
[INFO] [INFO] Finished at: 2014-03-27T15:17:56-08:00
[INFO] [INFO] Final Memory: 34M/222M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git add -- pom.xml access/pom.xml extract/pom.xml
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git status
[INFO] Working directory: /home/rivanov/java/git/feed

============================
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed 
&& git commit --verbose -F /tmp/maven-scm-218607872.commit pom.xml access/pom.xml extract/pom.xml
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git symbolic-ref HEAD
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed 
&& git push git@git.mycompany.com:feed test-mvn-release:test-mvn-release
[INFO] Working directory: /home/rivanov/java/git/feed
============================

[INFO] Tagging release with the label 6.6.17...
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed 
&& git tag -F /tmp/maven-scm-1830116578.commit 6.6.17
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed 
&& git push git@git.mycompany.com:feed 6.6.17
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git ls-files
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Transforming 'feed'...
[INFO] Transforming 'feed-access'...
[INFO] Transforming 'feed-extract'...
[INFO] Not removing release POMs
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git add -- pom.xml access/pom.xml extract/pom.xml
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git status
============================
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed 
&& git commit --verbose -F /tmp/maven-scm-1562430778.commit pom.xml access/pom.xml extract/pom.xml
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed && git symbolic-ref HEAD
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/git/feed 
&& git push git@git.mycompany.com:feed test-mvn-release:test-mvn-release
============================
[INFO] Working directory: /home/rivanov/java/git/feed
[INFO] Release preparation complete.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] feed ............................................. SUCCESS [ 11.454 s]
[INFO] feed-access ...................................... SKIPPED
[INFO] feed-extract ..................................... SKIPPED


====================================================


GSoC materials to read for first year organization

For organization:
http://en.flossmanuals.net/melange/
and attention to ideas page suggestions at http://en.flossmanuals.net/GSoCMentoring/
Must read for first year organizations - http://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2014/studentallocations

For mentor:
http://en.flossmanuals.net/GSoCMentoring/

For students:
http://en.flossmanuals.net/gsocstudentguide/
http://www.google-melange.com/document/show/gsoc_program/google/gsoc2014/help_page#4._What_documentation_is_required_from



Post registration plan, that was for GSoC 2014:
Congratulations on almost getting through student proposal submissions! Welcome to GSoC 2014! We're looking forward to spending this program with you.

This is an email that contains all the information your organization needs for the next month. Please read it thoroughly and follow the steps through to the end.

Step One: You have between now and 17 April to review and accept, ignore, and rank (if applicable) your student proposals. How you decide which proposals you accept is up to you. Keep in mind that ranking (the "star system" on the proposals) has no bearing on what students are accepted. Only students who you explicitly accept and assign a mentor to will be accepted. You can also accept students in bulk on the dashboard if you so choose.

Step Two: (Org Admins Only) By 24:00UTC on 7 April, please make sure your slot allocation request is accurate. Go to My Dashboard --> Managed Organizations, click on your organization. Click on the Preferences tab of your profile. You'll see two slot numbers on the page: "min" and "max." "Min" is your lower threshold - this is the number of slots you would need to accommodate your absolutely most amazing proposals. "Max" is your upper threshold - this is the number of slots you would love to have in an ideal world. You may also want to read the Notes on Allocations [1] document, particularly if you're a new org, to get a sense of how we do this process and what's rational to expect. If you do not fill in your slot allocation request by the deadline you will be allocated 1 slot for your org this year.

Step Three: (Org Admins Only) I will announce slot allocations Wednesday, 9 April after the close of business pacific time. If you are happy with your slot allocation for this year, you can continue accepting and rejecting proposals until 17 April. If your org ends up with more slots than it has excellent proposals (or available mentors), you will be able to give back slots to the pool. To do this, you'll need to go to your Organization profile again and you will now be able to click on the "Slots Transfer" tab. Select how many slots you want to give away. Add a note to us if you'd like to give them to a particular org. We will approve each of these trades individually. Conversely, if your org ends up with not enough slots for all the proposals you want to accept this year, please email me directly I will make a note of it on our waiting list. You will be given more slots when and if some come back into the pool.

Step Four: (Org Admins Only) Please assign mentors to all the proposals you plan to accept (or even hope to accept) ASAP. **You will not be able to accept a proposal that does not have a mentor assigned even if you have the slots to accommodate the proposal and mark it as accepted.**

Step Five: (Org Admins Only) On 15 April I will run our first round of deduplication [2] checks. After that, if you are in a duplicate situation with another org, you will be able to see a list in red of the student proposals on the review proposal page that are in this situation. You will also see a way to contact the fellow org to work it out. We will have four days to try to resolve as many of these as we can. You may consult with the student about his/her preference on which org he/she would like to be accepted for, but you do not have to. We assume that students have not applied for any org they would not be willing to work with.

Step Six: The final point at which we can resolve these situations is in the Deduplication Meeting. You must attend this IRC meeting (in #gsoc on freenode) on Friday, 18 April at 19:00 UTC. Even if you are one of the lucky orgs to not have any duplicates with a fellow org immediately preceding the meeting, you are still required to have someone(s) attend the meeting who can make a decision on your behalf when and if our playing around with the system happens to put you in a duplicate situation. This IRC meeting is the last point at which student decisions can be made, so please know your preferences when you go into it. The decisions made in this meeting are final, and will be made by myself (arbitrarily) if neither organization can come to an agreement. **If no one is in the meeting to represent your org and we need input from you, the student will automatically go to the other org.**
Step Seven: (Org Admins Only) Please make sure that you have looked over the welcome message your organization will be sending your accepted students as part of their acceptance email to make sure it's accurate. To do this, you'll need to click on the Preferences tab from your Organization profile again. Scroll down to "Message to accepted students" and make sure it looks correct. Save the profile if you make any changes.


Step Eight: Please do not discuss acceptance or rejection with the students until I have announced it on Monday, 21 April.

Thanks for your help, everyone!

[1] - http://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2014/studentallocations
[2] - For those of you who don't know, "duplication" means a student submitted proposals to multiple orgs and has been accepted by more than one of them. We have to resolve all these duplicate issues before we announce accepted students on 21 April.

Other:

from mentors mail-list, reply of Carol :

1) Can your organization use one slot and accept two different people and have them both work on one project together for the summer? 
No. I've answered why this is on this list, but here's a pointer in case you need it: https://groups.google.com/d/msg/google-summer-of-code-mentors-list/QvCrlS2c7Uc/v4Yxt0cX-_AJ

2) Can your organization use two slots and have two different people work on one project? 
Yes, assuming they are not dependent on each other's code or milestones or timelines in any way. If you feel a project on your ideas page absolutely needs a solution this year and you have to have two different people working on it to make sure the best solution gets produced by the end of the summer, you're welcome to use your slots that way to do that.


3) How to deliver t-shirt and certificate to Ukraine and Russia
examples of t-shirt and certificates.
there is delivery problem to that countries
http://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2014/help_page#4._Who_is_not_eligible_to_participate_as
https://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2013/help_page#7._Is_there_a_t-shirt_involved

But it is possible to change shipping address to any other address (USA address for example) after students got their welcome package and credit card. That have to be done after receiving credit card and before August.

4) Mentor summit/student reunion! 
It will be on 23-26 October this year. Yes, it is a supersized mentor summit: that's 3 full days and an evening of events. GSoC organization, allowed to send two delegates to the summit at Google's expense. Mentors that failed to report about user progress during summer will disqualified.

A delegate is defined as a student, mentor, or organization administrator who has participated in any instance of the GSoC program from 2005 - 2014 and is chosen to attend the GSoC Reunion by a mentoring organization that is participating in our 2014 program. The decision of which people will be delegates for the 2014 organizations is left to the organization administrators for each organization. Each 2014 organization can send a maximum of two delegates. These delegates will have their expenses to the Reunion paid for by Google as per the information in question #2 below.

5) Payments at GSoC
http://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2014/help_page#1._How_do_payments_work

Attention: you have to pay taxes from Google payments, for non US organization W-8 is required

In W-8, we needed to put "RUSSIAN FEDERATION" in 9th line. Nothing in 10th line.

sources:

Sevntu Checkstyle release 1.11.0


official page: http://sevntu-checkstyle.github.io/sevntu.checkstyle/#1.11.0


 New and noteworthy:

1) new Check "Enum Values Check", issue, done by Pavel Baranchikov.

Check forces enum values to match the specific pattern. According to "Java Coding Style" by Achut Reddy p 3.3 constants include "all static final object reference types that are never followed by " ." (dot).", i.e. enums, which are followed by dot while used in the code are to be treated as static object references, while enums, that are not used with following dot, should be treated as constants.
Enums are defined to be used as class have some own methods. This condition is used to distinguish between Values Enumeration and Class Enumeration. Values Enumeration looks like the following:
enum SimpleErrorEnum
  {
      FIRST_SIMPLE, SECOND_SIMPLE, THIRD_SIMPLE;
  }
While Class Enumeration has some methods, for example:
 enum SimpleErrorEnum
   {
       FIRST_SIMPLE, SECOND_SIMPLE, THIRD_SIMPLE;
 
       public String toString() {
           return Integer.toString(ordinal() + 10);
       }
   }
Name format for Class Enumeration is specified with setObjFormat(String) , while format for enum constants - with setConstFormat(String)
To avoid assuming enum as static object reference, while using some specific methods, setExcludes(List) can be used. For example to make enum in the previous example a constant set Excludes property to a value toString
By default toString is used as an exclusion.

2) new Check "Map Iteration In For Loop", issue, done by Max Vetrenko

This check can help you to write the whole for-each map iteration more correctly:
  1. If you iterate over a map using map.keySet() or map.entrySet(), but your code uses only map values, Check will propose you to use map.values() instead of map.keySet() or map.entrySet(). Replacing map.keySet() or map.entrySet() with map.values() for such cases can a bit improve an iteration performance.Bad:
    for (Map.Entry; entry : map.entrySet()){
       System.out.println(entry.getValue());
    }
    for (String key : map.keySet(){
       System.out.println(map.get(key));
    }
    Good:
    for (String value : map.values()){
       System.out.println(value);
    }
  2. If you iterate over a map using map.entrySet(), but never call entry.getValue(), Check will propose you to use map.keySet() instead of map.entrySet(). to iterate over map keys only.Bad:
    for (Map.Entry entry : map.entrySet()){
       System.out.println(entry.getKey());
    }
    Good:
    for (String key : map.keySet()){
       System.out.println(key);
    }
  3. If you iterate over a map with map.keySet() and use both keys and values, check will propose you to use map.entrySet() to improve an iteration performance by avoiding search operations inside a map. For this case, iteration can significantly grow up a performance.Bad:
    for (String key : map.keySet()){
       System.out.println(key + "  " + map.get(key));
    }
    Good:
    for (Map.Entry entry : map.entrySet()){
       System.out.println(entry.getValue() + "   " + entry.getKey());
    }


3) new check "Forbid Throw Anonymous Exception", issue, done by Max Vetrenko.

Forbid throwing anonymous exception. limitation: This Check does not validate cases then Exception object is created before it is thrown.
For example:
catch (Exception e) {
   throw new RuntimeException() { //anonymous exception
    //some code
   };


4) new check "Finalize Implementation", issue, done by Max Vetrenko.

This Check detects 3 most common cases of incorrect finalize() method implementation:
  • negates effect of superclass finalize
    protected void finalize() { }
    protected void finalize() { doSomething(); }
  • useless (or worse) finalize
    protected void finalize() { super.finalize(); }
  • public finalize
    public void finalize() {
       try { doSomething(); } 
       finally { super.finalize(); } 
    }
    


5) Update for CustomDeclarationOrderCheck, issue, done by Baratali Izmailov.

details, In short:
1) macros for Fields with assigning to Anonymous classes
2) macros for Setter/Geter
3) macros for nested interfaces, nested enumarations
4) Inner Classes in methods are ignored
5) macros for "main()" method

Format with usage of all marcoses could be found there.

General information:
repository: https://github.com/sevntu-checkstyle/sevntu.checkstyle
mail-list: https://groups.google.com/forum/?hl=en#!forum/sevntu-checkstyle

Thursday, March 20, 2014

My contribution to Ubuntu development

My contribution to Ubuntu development, Ubuntu deserve it !!!!! :

DescriptionUnit priceQtyAmount
'desktop'$1.00 USD50$50.00 USD
'hardware'$1.00 USD25$25.00 USD

Tuesday, February 18, 2014

What I do not like about Scala

Here I will be focused on problems of Scala only, Scala have number of benefits too but that will be in other post. I look at Scala from Java experience.

Problems:

- Strict in type but loose in syntax ( meaning of syntax is unpredictable )

- Recursive functions could not be transformed by tail recursion, see blog of Rich Dougherty

- lists append , you need to remember to keep first list smaller then second to avoid performance problems

- scala is like a math formula, great when all is logical and all understand math easily, but real live is far from math.

- synax is unreadable sometime, it is like perl.

- syntax meaning is depends on linked libraries

- implicit converts from perspective of human investigation of code, so IDE have to be smart. Example Stting to StringOps.

-what is the reason to use in maps ++ instead of addAll.

-switching from val to var could make immutable set haver operators like +=.

- Great !!! Paul Phillips is a co-founder of Typesafe and the most prolific committer to Scala. His talk is about  Scala problems: http://www.slideshare.net/extempore/a-scala-corrections-library



to be continued ....

Monday, February 17, 2014

Hashcode and Equals method usages in Java


Known practice - do not override neither of equals(Object obj) and hashcode() or override them together.
But even after override all of them and implementing properly or even generating code for them by smart tool - there could be a problem.

Advise: All class implementations that override hashcode() and are going to be used in Hashed collections - have to be immutable.

Without following advice above you can end up in situation then you put object in HashSet, change object's field , try to find it in collection by contains() - and you will not find it in collection as hashcode is changed and bucket will be misleading as object is placed in old bucket but hashcode is calculated to point to another bucket (wikivisualization).

Advise: "hashcode()" is Java system related method - do not override it till you have no other choice !!!

Advise: If hashcode() is demand after already overridden "equals(Object obj)" change code to use Comparable or any other approach, it will not cost any time for additional codding but will safe you form problems in future when your systems will be huge.

Reference to other  tools:
FindBug:
HE: Class defines equals() but not hashCode()
HE: Class defines equals() and uses Object.hashCode()
HE: Class defines hashCode() but not equals()
HE: Class defines hashCode() and uses Object.equals()
HE: Class inherits equals() and uses Object.hashCode()

PMD:
http://pmd.sourceforge.net/pmd-4.3.0/rules/basic.html#OverrideBothEqualsAndHashcode

Checkstyle:
http://checkstyle.sourceforge.net/config_coding.html#EqualsHashCode

Summary:
All tool check for methods existence but non of them for immutable state.
Is it on purpose or it is non covered problem of Static Code Analyzers for Java ?