Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Saturday, August 10, 2013

Switching from cloudfoundry V1 to V2

Beta version of Cloudfoundry is down since long time ago. Now Pivotal gave users V2, brand new commercial version of former service. It's yet 67 days for free. I decided to migrate my V1 app there. Let's see how deployment process differs from the old one.
Previously there was grails plugin that made it as simple as invoking several groovy commands. Now it's a bit different. Quick manual is available at http://docs.cloudfoundry.com/docs/dotcom/getting-started.html#install-cf

I'm not Ruby hacker but was able to install Ruby on my machine, yet starting with first command I encountered an issue. DevKit was missing on my machine, so i donwloaded it from here (DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe), extracted in my groovy_home/DevKit and installed with commands:
cd C:\Ruby193\DevKit
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install
Then lets return to cloudfoundry install cf.

gem install cf

cf target api.run.pivotal.io

When we have done it already we can build war file (grails prod war) and upload it.

cf push --path consulner.war

When we do this for the first time we will be asked to choose environment (dev, staging, prod) I've chosen production. Then I answered questions as follows:



Name> consulner

Instances> 1

1: 128M
2: 256M
3: 512M
4: 1G
Memory Limit> 3

Creating consulner... OK

1: consulner
2: none
Subdomain> consulner

1: cfapps.io
2: none
Domain> cfapps.io

Binding consulner.cfapps.io to consulner... OK

Create services for application?> n

Save configuration?> y

Saving to manifest.yml... OK
Uploading consulner... OK
Preparing to start consulner... OK
-----> Downloaded app package (28M)
Downloading JDK...
Copying openjdk-1.7.0_25.tar.gz from the buildpack cache ...
Unpacking JDK to .jdk
Downloading Tomcat: apache-tomcat-7.0.41.tar.gz
Copying apache-tomcat-7.0.41.tar.gz from the buildpack cache ...
Unpacking Tomcat to .tomcat
Copying mysql-connector-java-5.1.12.jar from the buildpack cache ...
Copying postgresql-9.0-801.jdbc4.jar from the buildpack cache ...
Downloading auto-reconfiguration-0.7.1.jar from https://s3.amazonaws.com/maven.springframework.org/milestone/org/cloudfoundry/auto-reconfiguration/0.7.1 ...
-----> Uploading droplet (65M)
Checking status of app 'consulner'.....
  0 of 1 instances running (1 starting)
  0 of 1 instances running (1 starting)
  1 of 1 instances running (1 running)
Push successful! App 'consulner' available at http://consulner.cfapps.io


That's it! Now we have app running on prod. Unfortunately this was not that simple, I struggled to find out why the app could not start t first time and there was nothing inspiring in logs or crushlogs. Finally I tried increasing default memory from 256M to 512M and it worked :)

Monday, June 17, 2013

Startup Weekend Lodz 2013

First such event in Lodz, but not first in the history. People from different domais met this weekend in Lodz to put incredible ideas into life. Some came with their own ideas, others to meet people or hack codes. From all ideas finally 6 were chosen to form team upon:

Creative Learning ! Creative Learning is creating platform of educative and fun apps for kids. We offer you two options: 1) kid muting and absorbing apps (first to go!) & 2) kid-(grand)parent interaction app ( we'll "KISS" for your kid to stay focused & a granny be able to help!).
Fun, creative, educative and esthetic apps is all what Creative Learning is about - and all this in a set of apps that will become the kids apps legends ;).
If you want your kid to learn stuff in a fun way follow our FB page and website, help us test and expect our products on iTunes & GooglePlay soon!
- Creative Learning - SHAPES
- Creative Learning - LETTERS
- Creative Learning - NUMBERS
-Creative Learning - ANIMALS
and more!
http://www.creative-learning.eu/


Photo: http://www.creative-learning.eu/



allSpotted! - The team is about creating a mobile app for the facebook movement called "Spotted". It allows you to find again the person you have meet/seen but have no contact to. The app uses social traffic and GPS information.

Photo: allSpotted


Space Lawyer! Best Legal Services on-line in Poland. Everywhere, anytime!

Photo: Space Lawyer


ADS ON PETS! Ads on Pets - we provide brands with a new advertising channel. By giving pets lovers possibility for their animals to stand out, we give them way to make money so they can spoil them even more. 

Photo: ADS ON PETS


Video Pediatric Advice! Platform which allows pediatricans to give advices to patients via webcam.

Photo: Video Pediatric Advice


"Gamming for Cats and feed it"
Idea is quite simple. Cat plays iPad and gains points. When gained more than 100 points it' s given food. There is also idea for suture to increase food rate if cat burns more than 200 calories. 

Photo: Dzisiaj skończyliśmy prototyp urządzenia "Gamming for Cats and feed it"

Idea jest całkiem prosta, kot gra na Ipadzie, jeśli zdobędzie 100 punktów dostanie jedzenie.

W planach rozwoju jeśli przećwiczy 200 kkalori dostaje większą porcję !.


Aplus - learn Math Online. E-Learning system leading you through a path to Math proficiency.

Photo: Aplus - to jeden z pomysłów ze startup weekendu. Naucz się matematyki Online. Kamil Kamiński odpowie na wszystkie Wasze pytania z matmy ONLINE.

Finally Dominik is going to California with his Creative Cats and feeding device for them.

2nd prize - our team with prosteumowy.pl
3rd prize  -  allSpotted and Video Pediatric Advice!





Thursday, February 28, 2013

OneWebSQL competition


Lately I'm spending most of the time on building my ego :))
First since very long time I've even won sth
http://onewebsql.com/konkurs-spring
http://e-point.pl/co-nowego?news_id=1500144,rozstrzygniecie-konkursu-na-najlepsza-aplikacje-webowa

My solution is available free on github. I must admit I would change a few things though, especially presentation layer - I would rewrite it in AngularJS.

Monday, February 25, 2013

MongoDB for Java Developers - 10gen Course

The course has just started today.
So far this week I gone through MongoDB installation, basic queries from mongo shell and Java application. I've also learned Spark Micro Web Framework and FreeMarket templating engine.
So far so good.. exercises were not to difficult and possible to go through in one night.

I've setup github project for this course at https://github.com/piczmar/MongoDB4JavaDev/

Saturday, September 1, 2012

My first meeting with Closure

I got inspired by video of life music hacking jam session http://www.youtube.com/watch?v=WXovdAEV_mI&hd=1
so that I wanted to try Overtone project myself.
First you need to install Lein which is a kind of depency managet for Clojure.
You can follow with instructions at https://github.com/technomancy/leiningen/#installation
What I did on Windows was downloading lein.bat from https://raw.github.com/technomancy/leiningen/preview/bin/lein.bat and stand-alone jar from https://github.com/technomancy/leiningen/downloads
Then I had to set env. variable LEIN_HOME to my local dir, e.g.: c:/tools/lein and put the stand-alone jar in
c:/tools/lein/self-installs
and add LEIN_HOME to PATH system variable so that lein.bat could be found globally in system.

Then when I typed
lein
in system console it downloaded missing Clojure dependencies and welcomed me with message:


Leiningen is a tool for working with Clojure projects.
Several tasks are available:
check               Check syntax and warn on reflection.
classpath           Write the classpath of the current project to output-file.
clean               Remove all files from project's target-path.
compile             Compile Clojure source into .class files.
deploy              Build jar and deploy to remote repository.
deps                Show details about dependencies.
do                  Higher-order task to perform other tasks in succession.
help                Display a list of tasks or help for a given task.
install             Install current project to the local repository.
jar                 Package up all the project's files into a jar file.
javac               Compile Java source files.
new                 Generate project scaffolding based on a template.
plugin              DEPRECATED. Please use the :user profile instead.
pom                 Write a pom.xml file to disk for Maven interoperability.
repl                Start a repl session either with the current project or standalone.
retest              Run only the test namespaces which failed last time around.
run                 Run the project's -main function.
search              Search remote maven repositories for matching jars.
show-profiles       List all available profiles or display one if given an argument.
test                Run the project's tests.
trampoline          Run a task without nesting the project's JVM inside Leiningen's.
uberjar             Package up the project files and all dependencies into a jar file.
upgrade             Upgrade Leiningen to specified version or latest stable.
version             Print version for Leiningen and the current JVM.
with-profile        Apply the given task with the profile(s) specified.
Run lein help $TASK for details.
See also: readme, faq, tutorial, news, sample, profiles,
deploying and copying.

Now I can start playing with Overtone...
Then you download sources from github:

git clone git://github.com/overtone/overtone.git

and build project with

lein deps

Now launch REPL and follow according to steps at Overtone github:


The quickest way to get started is to launch a clojure repl using lein. In the overtone project directory....
$ lein repl
Then make some noise :)
user> (use 'overtone.live)
   ...wait a bit...
user> (demo (sin-osc))
For a better experience try Overtone in emacs or Overtone in vim.
Unfortunately that ain't that easy and first command: (use 'overtone.livebrought me to error message:
--> Loading Overtone...
UnsatisfiedLinkError Unable to load library 'scsynth': Nie mo┐na odnalečŠ okreťlonego modu│u.
  com.sun.jna.NativeLibrary.loadLibrary (NativeLibrary.java:169)
I wish you were more lucky, I will come back to resolve it in a while..stay tuned...



Soo.. after a while I'm back with a different approach.
I followed the following steps:
From command line execute:
lein new tutorial
cd tutorial 

edit project.clj generated in folder tutorial and add dependency:

(defproject tutorial "1.0"
  :dependencies [ [org.clojure/clojure "1.3.0"]
                  [overtone "0.7.1"] ])

Then type:
lein deps
Install SuperCollider (http://sourceforge.net/projects/supercollider/files/Windows/) - during installation enter installation folder name as SuperCollider, without version number. I'm not sure if otherwise Overtune will locate scsynth.exe correctly.

Start REPL (https://github.com/overtone/overtone/wiki/Starting-a-REPL)

lein repl
Type commands:

(use 'overtone.core)
(boot-external-server)

and start playing... (https://github.com/overtone/overtone/wiki/Getting-Started)

Sunday, January 15, 2012

EL not evaluated in JSP

I've spent almost an hour do discover why Expression Language entries like:

${test}

are not evaluated on JSP pages.

The thing was version in web.xml file.
By default my eclipse generated

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>

...

Changing to

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

...

made it work.

Make sure you have also in your server classpath 2 jar files:

jstl.jar - JSTL implementation classes
standard.jar - Standard Taglib JSTL implementation classes

More reference in this  thread.

Monday, December 12, 2011

Java Processors

As explained in Wikipedia - A Java processor is the implementation of the Java Virtual Machine (JVM) in hardware.

However, few people know that new Polish construction appeared recently: processor called Warszawa cosntrucred by Polish company http://www.gryftechnologia.com.

Warszawa Processor

During execution of Java program, instructions written in byte code and arguments are sent to instruction decoder. 30% of byte code instructions are realized directly on hardware. The rest is translated to assembly language because of their complicity and additional features of Java Virtual Machine.

An article about the new processor (in Polish) can be found here.

Wednesday, December 7, 2011

Web Design Techniques

I found recently an interesting speach about good web design techniqes. Putting it mostly for myself for reference.
http://ontwik.com/ui/design-for-developers-making-your-frontend-suck-less/

The presentation for this can be downloaded from Idan Gazit blog.

In context of good color design I found some time ago a color scheme generator here. You can read generated RGB for free.

Saturday, December 3, 2011

Global Code Retreat Day 2011

First Code Retreat took place in Java User Group Lodz on 3rd December.
Under vigilant supervision of Piotr Przybylak 12 programmers were improving their skills in context of Test Driven Development.
From 10.00 to 16.00 (roughly) in the office of Mobica company we went through several sessions, 45-minutes each, during which in pairs (different every session) we tried to implement Game of Life. Unfortunatelly noone succeeded to finish the application, but that was not the aim. The goal was to be comfortable with every line of code, to make it ideal given certain assets (such as e.g.: using no setters and getters, having rich domain model, in contrary to anemic domain model)

How does pair-programming look like? What is TDD about? It is well reflected in this conversation.

Every participant of today's event gained something new. I learnt a few Eclipse shortcuts, creating code templates in it, different aproaches to the same problem (objective vs. structural) a few useful libraries (Mockito, Hamcrest) and testing Android application ( thanks Mariusz :))
By chance a few positions worth reading appeared:
Wzorce projektowe. Analiza kodu sposobem na ich poznanie.
Release It!: Design and Deploy Production-Ready Software ( other books of Michael also worth reading)
Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation
Working Effectively with Legacy Code
Holub on Patterns: Learning Design Patterns by Looking at Code

The above list will be updated once I get more positions.

In the meantime we Skype-connected to Code retreat groups in Barcelona and Cracow.
I have a very good impression about this event and would attend similar ones more often.

Learning in practice - priceless, that's something what you can't buy. For everything else there is Master Card ;)

[youtube http://www.youtube.com/watch?v=FdMzngWchDk&w=420&h=315]

[youtube http://www.youtube.com/watch?v=0d6yIquOKQ0&w=420&h=315]


"...it's cats that are complicated"

Photos from event at Picasa Gallery

Monday, July 25, 2011

GWT DocLayoutPanel scrolls problem

I was creating a web application using GWT. My base panel is a RootLayoutPanel and I added on it a DockLayoutPanel on which I attached my components.
I came across a problem when changing browser window size to smaller than panel size. The panel size remained unchanged but part of it which was exceeding window size was not visible and there were no scroll bars for browser window.

I struggled with this annoying problem trying to put the DocLayoutPanel inside ScrollPanel, but it did not help at all.
Finally, i found a work around on GWT tutorial at:
http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#Resize

I've added to my root html page a tag like:



<body>
    ..
    <div id="main" ></div>
    ..
</body>


then in onModuleLoad method instead of adding the panel like:



interface Binder extends UiBinder { }
private static final Binder binder = GWT.create(Binder.class);

public void onModuleLoad() {
    DockLayoutPanel outer = binder.createAndBindUi();
    RootLayoutPanel.get().add(outer);
}



I do it that way:



public void onModuleLoad() {
    DockLayoutPanel outer = binder.createAndBindUi();
    LayoutPanel panel = new LayoutPanel();
    panel.add(outer);
    RootPanel.get("main").add(panel);
    panel.setSize("800px", "800px");
}



NOTE that you must set explicitly the size of the panel to properly display on web page. You should have now scrolls as on any other web page when the panel size exceeds window size.