6. May 2015

OpenRefine date conversions

One of common tasks for OpenRefine is conversion of dates from String.
Conversion could be performed by toDate function.

Source data:

11-04-15 9:28
12-04-15 8:56

Open Edit cell – Transform for the column and type following GREL:

value.toDate("dd-MM-yy h:mm")

Result (in Date format):

2015-04-11T09:28:00Z
2015-04-12T08:56:00Z

Another example. Source data

11/04/2015 09:28:25
13/04/2015 08:56:57

GREL:

toDate(value, "dd/MM/yyyy hh:mm:ss")

5. May 2015

C language in our world 2015 – slides

Slides available in formats: PDFSlideShare

Source code: GitHub/ysoftdevs/cpp-examples

8. December 2014

C++ in our world 2014 – slides


Slides available in formats: PDFSlideShare

Source code: GitHub/ysoftdevs/cpp-examples

4. December 2014

Problem: Any link on Drupal site shows the same page after upgrade to Apache 2.4 and PHP 5.6

Upgrading old Linux server is challenging task. Many things could break or stop working.

One of problems was that Drupal sites with htaccess file stopped working and any URL was pointing to the same main page.

htaccess file is often use to allow creation of nice URL. It typical content was:

RewriteRule .* %{DOCUMENT_ROOT}/index.php/$0 [L]

This rule is not working with new Apache and PHP. It was necessary to replace it by:

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Reload Apache and Drupal site should work again.

30. August 2014

SimulANT+ Scripting Interface CHM – Windows help does not display content

I was testing SimulANT+ software from www.thisisant.com. Application was working without problem, but document with API was not readable. Only index was visible, but no content.

The API documentation is stored in file SimilANT+ Scripting Interface.chm. The problem with CHM content is classical gotcha on Windows.

When you download ZIP with CHM then Windows will automatically mark this file as downloaded from Internet. You have to unblock content of file manually.

simulant-chm-unblock

Other alternative is to use 7-zip or other extractor which does not keep this flag.

Note: SimulANT+ has Python API, hooray! 🙂

11. August 2014

Gradle PMD – Can’t find resource null

Gradle has support for PMD. You can find following example on internet:

apply plugin: 'pmd'

pmdMain {
  ruleSets = [ "basic", "strings" ]
}

This code is not working with Gradle 2.0. Here is error message:

:clean
:pmdMain FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':pmdMain'.
  Can't find resource null. Make sure the resource is a valid file or URL and is on the CLASSPATH. Here's the current classpath: C:\Users\georgik\tmp\install\gradle-2.0\lib\gradle-launcher-2.0.jar

The reason is simple. In case of Gradle 2.0 you must add language prefix before name of rule. You must use java-strings instead of plain strings.

Here is correct example (available also on YSoftDevs Github):

apply plugin: 'pmd'

pmdMain {
  ruleSets = [ "java-basic", "java-strings", "java-braces" ]
}

You can find more rules for PMD in official documentation.

Thanks Matt Sicker for correct solution.

24. July 2014

couriertls: /etc/courier/esmtpd.pem: error:0906D06C:PEM routines:PEM_read_bio:no start line

After upgrade of Linux distribution Courier stopped to accept emails delivered over TLS or SSL.

There was just nice error message in the log file:

couriertls: /etc/courier/esmtpd.pem: error:0906D06C:PEM routines:PEM_read_bio:no start line

Long story short. The problem was in pem file.

Previous versions of Courier-SSL were able to read files with Windows EOL. The new version is failing with this nice error.

Solution is simple: get rid of Windos EOL.

You can use e.g. dos2unix

dos2unix esmptd.pem

Restart services and everything will work 🙂

6. July 2014

SimpleHTTPServer in Python 3.x

One very cool feature of Python 2.x is instant web server. You can type following command and Python will start simple http server.

python -m SimpleHTTPServer

This command does not work in Python 3.x. The reason is that SimpleHTTPServer was merged to http.server module.

Correct command for Python 3.x is:

python -m http.server

23. June 2014

How to debug Gradle script

First of all: do not use daemon mode for debugging.

IntelliJ Idea is automatically spawning daemon when you start any Gradle task. You have to attach to remote process.

I wrote small “How to debug” based on info from forums.gradle.org.

You’ll need to set GRADLE_OPTS environment variable to:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

Here is example in PowerShell:

01-command-line-options

$env:GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

Configure Remote debugging in Idea:

02-configure-remote

You do not need to change anything in default configuration.

Now return to command line with your project and invoke task. Gradle will automatically stop and it waits for debugger.

03-start-process

Attach debugger

04-attach-to-process

Here we go 🙂

05-break-point

There is small limitation. You can stop code execution outside DSL e.g. in class method (line 3). You won’t be able to stop execution in Gradle DSL line 10.

You can download sample build script from Github.

13. June 2014

Gradle Summit 2014 Lightning talk: Bamboo + Gradle

I had an opportunity to be one of Lightning talks speakers at Gradle Summit 2014 in Santa Clara – California.

I’d like to share with you slides from my talk about Bamboo and Gradle integration which we successfully deployed in Y Soft.

Link to Speaker Deck

It was exciting to hear about experience with Gradle from other speakers from companies like Netflix, Prezi or JFrog.

  • Where’s the fish?

  • Translations

  • Further info

  • Twitter

    Follow @jurajmichalek on twitter.

  • Comments

  • Tags

  • Topics