Development Sketches
Samstag, 17. September 2016
Donnerstag, 12. November 2015
Easy SBT build in Docker container
When you need to build your Scala project, but have no way to install SBT on your host, you can still do it if you have Docker.
There are few ready to use container images on DockerHub. We create our own.
All we need for that is to prepare a Dockerfile:
FROM java:latest
MAINTAINER Nikolay Kushin nikolay@indoo.rs
ENV SCALA_VERSION 2.11.7
ENV SBT_VERSION 0.13.9
ENV SBT_OPTS -Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xss2M -Duser.timezone=GMT
# install sbt
RUN wget https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb
RUN dpkg -i sbt-$SBT_VERSION.deb
# install scala
RUN wget https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.deb
RUN dpkg -i scala-$SCALA_VERSION.deb
# fetch base dependencies
RUN sbt compile
VOLUME /src
WORKDIR /src
CMD ["sbt"]
Our Dockerfile is relatively easy and self-explaining.
Next step is to build an image. Save Dockerfile in some folder and execute following commande in terminal:
docker build -t sbt-docker .
Now when the image is ready we can create container with mounted source folder, containing our Scala project and run SBT.
docker run -it --rm -v $(pwd):/src sbt-docker sbt docker:stage
Thats it! Enjoy!
Samstag, 7. November 2015
RoboVM - way to write cross-platform mobile apps on Java
This weekend I spent some time participating in RoboVM Pull Request contest. Guys from RoboVM prepared demo application and invited people to add new features.
Amongst proposed features to add were:
Because I had almost no previous mobile development experience I decided to start with some simple thing.
Typical RoboVM mobile project consists from 3 modules:
For long time I wanted to give a try to Paypal Java SDK. That was a chance.
Because I wanted to use it for both platforms (iOS and Android) library dependency should be included to core module. Project uses Gradle as a build tool and all you need to do is include following line to build.gradle:
Android UI is organised in fragments. I added new one (PaymentDetailsFragment) and changed a bit logic of working with order placement.
That was a pleasure to work with new RoboVM Studio. Most of functions I used to have in JetBrais Idea I had as well because it is just fork of Community Edition.
If you are reading this text before 23rd November 2015 you still have a chance to win one of the prices provided for that RoboVM contest.
Amongst proposed features to add were:
- commercial transactions support
- localisation
- everything else you can imagine :)
Because I had almost no previous mobile development experience I decided to start with some simple thing.
Typical RoboVM mobile project consists from 3 modules:
- core - which shares code between platforms
- android - platform specific UI implementation for Android
- ios - platform specific UI implementation for iOS
For long time I wanted to give a try to Paypal Java SDK. That was a chance.
Because I wanted to use it for both platforms (iOS and Android) library dependency should be included to core module. Project uses Gradle as a build tool and all you need to do is include following line to build.gradle:
compile 'com.paypal.sdk:rest-api-sdk:1.2.9'At first I started with simple implementation of payment API (PaymentAPI). I following this reference. Tried following sample requests against my test account. Everything worked perfectly!
Android UI is organised in fragments. I added new one (PaymentDetailsFragment) and changed a bit logic of working with order placement.
That was a pleasure to work with new RoboVM Studio. Most of functions I used to have in JetBrais Idea I had as well because it is just fork of Community Edition.
If you are reading this text before 23rd November 2015 you still have a chance to win one of the prices provided for that RoboVM contest.
Mittwoch, 19. August 2015
Simple weather station on Arduino
To refresh some basic knowledge about electronics and Arduino platform we will implement a weather station.
Let's define requirements we'll have to out weather station. It should:
Let's define requirements we'll have to out weather station. It should:
- Display current temperature and humidity
- Display current time and date
- Set time and date manually using buttons
- Arduino-compatible microcontroller
- DHT11 temperature/humidity sensor
- Real-time clock module
- Small breadboard
- 2 small push buttons
- 2 1kOhm resistors
- Bunch of wires
- 5V DC power adapter
Freitag, 10. April 2015
Installing Scala and SBT on Ubuntu
Simply run following script to install latest Scala and SBT on your Ubuntu:
Mittwoch, 10. Dezember 2014
My participation in Global Hackathon
The past weekend I was lucky enough to participate in an event held by Koding (http://koding.com) titled "Global Hackathon" (https://koding.com/Hackathon).
Hackathon - is a kind of time-limited events, where participants work on projects for which in ordinary daily life there is no time as a rule. The main idea is to bring the idea to the finished prototype of the final product in the shortest possible time. Hackathon is named this way because participants can use all possible tools and ways to achieve this goal.
The event was attended by 2000 teams from all around the world, selected from more than 19,000 applications. Maximum number of participants in the team was equal to 5. Many people like me was not fortunate enough to find teammates and had to work alone. 51 of the judges will find winners among completed projects and the most worthy of them will be awarded.
Donnerstag, 29. Mai 2014
Montag, 26. Mai 2014
RFID sensor (Funduino RFID-RC522)
Recently I bought a set of Arduino-compatible components including RFID sensor (RC522).
After short search I've found good tutorial telling how to use this sensor, downloaded a library and connected sensor to my Arduino (be careful there is a typo in original blog post):
After short search I've found good tutorial telling how to use this sensor, downloaded a library and connected sensor to my Arduino (be careful there is a typo in original blog post):
- MOSI: Pin 11
- MISO: Pin 12
- SCK: Pin 13
- SS: Pin 10
- RST: Pin 5
- GND: Gnd
- VCC: 3V3
Freitag, 9. Mai 2014
Connect RaspPI to WiFi
Recently I've ordered two WiFi dongles for my Raspberry PI home project and today I received a parcel.
Prices:
2 x Wireless Adapter Network LAN Card 802.11n/g/b 2.4GHz - $3.41 / piece
Honestly said I had to investigate this topic before purchase, but in fact when I connected it to PI and set up wireless connection I was upset - it seemed not working.
Prices:
2 x Wireless Adapter Network LAN Card 802.11n/g/b 2.4GHz - $3.41 / piece
Honestly said I had to investigate this topic before purchase, but in fact when I connected it to PI and set up wireless connection I was upset - it seemed not working.
Donnerstag, 1. Mai 2014
Ultrasonic Sensor: first try
After few weeks waiting they finally came to me direct from China: my new Arduino Nano and a couple of ultrasonic sensors.
Price:
First of all I connected VCC and GND pins to common rails and then to corresponding pins of ultrasonic sensor. After that I connected Trigger to Pin 3 and Echo to Pin 2 of Arduino board. As in many existing examples I decided to output signal through Piezo Buzzer. I simply connected Pin 4 of Arduino to positive leg of buzzer and the other leg to common ground.
Price:
- 1 x Ultrasonic Module HC-SR04 Distance Measuring Transducer Sensor - $2.56 / piece
- 1 x Funduino Nano 3.0 controller - $7.89 / piece.
First of all I connected VCC and GND pins to common rails and then to corresponding pins of ultrasonic sensor. After that I connected Trigger to Pin 3 and Echo to Pin 2 of Arduino board. As in many existing examples I decided to output signal through Piezo Buzzer. I simply connected Pin 4 of Arduino to positive leg of buzzer and the other leg to common ground.
Abonnieren
Posts (Atom)