środa, 13 kwietnia 2016

moving to wordpress

I am moving to wordpress
Why?
I haven't found here markdown
And I prefer their app
Sorry blogger
All of you still interested what I want to say?
visit and comment here

https://lukcreates.wordpress.com/

piątek, 25 marca 2016

django -> react

I am thinking about big change right now,
being fed-up with fighting with django context path problem* I am thinking to switch to another backend solution
people are saying good things about React, why not react to that movement properly?
Let's try to check is it easy to run it home..

1) install all prerequisities
 * npm
 * browserify

2) run app as webserver?
Having knowledge based on this I get to know that react needs having webserver (express for example) to run on top of it, Frontside needs some index app having react scripts loaded and React classes created.  React app just has URL of endpoint created before and has pretty straightforward connection using code like that

ReactDOM.render(

  <CommentBox url="/api/comments" pollInterval={2000} />,

  document.getElementById('content')

);



Voila, react just works here..



* context path problem is when you have django app being runned by some magic Apache mod not on the server root / but some magic /django_subroot, then all the problems are happening about resources and security redirects

niedziela, 28 lutego 2016

What are you looking for? Come on! It is ELK

We are living in world of data.  Big data, small data, any data is coming from every place.  What is important is to get from this data information.
What I found nice is ELK. You know it or not, don't worry, sooner or later you will find use case for that. Especially if you are working with any data-producing system you want to use this data, don't you?  One of this use cases can be log information extraction.
It is good to write logs.  This can help you to be up-to-date with your application life, hear it's heart beating, listen to it's sad and funny stories. This is where ELK come with the rescue.
You may find many information how to run it but I will shortly say that is stack based on Elastic(search) based on Lucene. Logstash processes data and Kibana can nicely present it. Lucene is impressive. With Elastic you can look for data smartly, you feel that Lucene engine understands you because it can not only do passive comparison like
 text equals "string" 
but it was created to give you chance to check if
 text is similar to "string" 
. That's only top of iceberg but if you have never worked that try it. In my previous company we have started it against logs and it fastened access to log information. But that's not only one usecase. Sky is the limit.

niedziela, 21 lutego 2016

couchDb count

The best way to learn is to take and learn by approaching a real problem..
Yesterday I learned that my thought-containg app is just microblogging app so no more thinking about thinking app.

In the aforementioned app I was tightly tied to previous db (elastic). So changing to CouchDb is not only about writing new implementation of couch, I also have to change V and C layers.. That sucks! Awaiting topic is to make new separation of layers in the app.


How to make count? Using map&reduce paradigm.

1. Map
First create any view emitting one record per record :) I called it alldocs,

function(doc) {

 emit(doc._id,doc.timestamp);
}

2. Reduce

Thankfully there are some built-in reduce functions that we may use. One of them is _count. So the "code" needed in reduce function is _count

The result after pinging the url http://localhost:5984/thought/_design/alldocs/_view/alldocs is

{"rows":[
{"key":null,"value":19}
]}
How to use it in js app? Using couch.js client i just can only



db.view('alldocs/alldocs').rows[0].value

And that's it I got size of all docs. Voila

android reactivation

I need to write easy app in Android, button, some edits, labels, communicate via REST.
1) download SDK
Wooow, that's pretty big file, fortunanetly I have fast connection so downloading 1.2 GB file took some minutes
2) installing and first run
Uuu, many things changed since last time, previously it was customized Eclipse, now it is customized Intellij, nice.. Only bad momentum was error while installing of some emulator-related something. But wait, during first run it downloads something more!? What a voracious SDK.
Ekhm it pushed an error while installing Android virutal machine, complaining on some antivirus stuff, but retrying was good enough to run SDK
3) project setup
Following humbly steps from there (http://developer.android.com/training/basics/firstapp/creating-project.html) I easily make first Activity, only - as it is my custom - naming it according to lukSchema (everywhere where is "my.." prefix i put my "luk.." prefix)
4) try run helloworld, ups my HAX kernel module is not running, therefore I can't run it on my emulator! Maan, what is going on..
Ahaa, to run emulator I need to change bios setting (http://www.sysprobs.com/disable-enable-virtualization-technology-bios), uff, better try to run it on my local smartphone
tap tap tap on build number, run usb debug and waiting for my prestigio to show up in devices
Maan, nowhere I can find adb which just have installed
5)ok edit text with label and button works pretty easy. It is the time to call API , first you have to set permissions in AndroidManifest.xml then to call API.
6)wow, it was fast, happy doing-nothing-special acticity which just calls REST

up and running in less than 120 minutes
not bad,
not so well

czwartek, 18 lutego 2016

converted to python

Basically by new workmates and need I get converted to python.
No matter what language you develop in the most importan thing is to make things done, in some languages it is just .. easier.
There are many pages which show: look you can write System.out.println in such a easy way but it is not the point. For some easy tasks Python seems to be the best choice.
App that goals are simply:

  • read csv,
  • localise places
  • print using template
  • convert to PDF
was pretty easy to make in Python. And we did it.. without interfaces/oo principles and super-objective stuff. It works
That's nice

good API is not bad

I am developing the topic of microblogging service with it's dependency on CouchDB as backend. I become little discouraged by
http://lethain.com/full-text-search-in-couchdb-using-couchdb/
explaining that really it is not good idea. I agree that "use good tools" is something important, reinveting the wheel costs time and effort that could be spend in better way.  I really want to have it possible to search through my entries looking for things. Because my CouchDB provider (cloudant.com) has it's Lucene capabilities I felt maybe use it..? But it would be vendor lock-in as it is not CouchDB standard. So why not to choose Lucene by itself. All the plans are pretty expensive but let's try it to build kind of proof of concept..
Then I understood how good it is that my frontend is not directlky talking to couch.. Now I am free to leave some features directly connecting itself to couch while other dispatch to search engine. And everything on one nicely put API endpoint! How pretty