Posts

Showing posts with the label java

New blog domain: kula.blog

It's still work in progress but new posts will be published on  https://kula.blog/ Thanks to 11ty base blog RSS is working from the start so it should be easy to add to your reader if you still use any :) If now then I hope you can sign up to the newsletter where I'll be publishing new posts and interesting articles to it from time to time. Please use  kula.blog  from now on.

How to design a good API

Image
Joshua Bloch presentation about designing API and why this is important. http://lcsd05.cs.tamu.edu/slides/keynote.pdf I've read only slides but I think that most of talk content is in them, but if you have time try to watch video (or listen to it) and read slides at the same time. This isn't only about API but much more than that, API is just the beginning. + video:

I Will Not Learn Dart

I don't want to learn Dart, at least for now. I hope to explain in this post how I think, so begin. Dart want to be next big language of the Web, but this really doesn't matter. JavaScript will be with us for years from now, and other Browser vendors do not implement it, at least if Google do not pay them to. It will have at best all Chrome users, and this probably be about 20-30% even in a couple of years, so only a couple of developers will really use it for real. Just now how GWT now is used.  GWT and Dart will be used only by people that use Java, but they not WebDevelopers most of the time. Most of WebDevelopers write JavaScript, not Java or even PHP.  What are benefits of Dart rally? classes And that's pretty all of it.  Really, there is nothing really impressive in this new language. This is mix of some other OOP languages. Nothing new. I can tell that this is boring.  Even getters na setters are available in JavaScript,...

Rozmiar jest wrogiem

PL:  http://www.devblogi.pl/2011/09/rozmiar-jest-wrogiem.html EN: http://www.codinghorror.com/blog/2007/12/size-is-the-enemy.html Really good reading about problem with large code base. In Java this is based of "good practices" to create a large number of boilerplate code that in most cases is doing nothing.

Podstawy wątków w Javie

Świetny wstęp do wątków:  http://kodatnik.blogspot.com/2011/06/watki-w-javie-podstawy.html

Darmowe książki o Java

http://kodatnik.blogspot.com/2011/06/java-darmowe-ksiazki-i-tutoriale.html

Amino (goamino) Java & JavaScript animations

Library for animations in Java and JavaScript:  http://goamino.org/

Book Review: NetBeans Platform 6.9 Developers Guide

NetBeans Platform 6.9 Developers Guide written by Jürgen Petri to be honest can have "for beginners" at the end of title. This book is designated for newbies to help them with basic tasks and in my opinion author was successful in that task. The chapters have gently increasing difficulty, so chapters 1-4 mostly explain some concepts to the readers. What is interesting is that book takes the form of one big tutorial so even when I was creating my first project, that project was used to the end of book for creating TaskManager application. I really like style of a book, in every chapter I was learning one of main concepts of Platform and my application gets more and more powerful. Constantly refactoring my modules makes me see better advantages of using NetBeans Platform. It is obvious that author knows much about NetBeans and knows how to teach. Despite great examples. the author is always explaining them in depth. He has included many tips about real use cases an...

End of Book! Closing chapters review.

After 3 weeks I've ended NetBeans Platform 6.9 Developers Guide Book, and as previous quick summary of read chapters. Chapter 7: File System How to access File System of operating system without knowing which system is it. This chapter is mostly about low-level access. But for me it is already pretty good abstraction! Chapter 8: Data System Creating additional abstraction on top of objects from previous chapter and create actions to create actions to save data of active model object. This chapter is also about using files in explorer which we all know from using NetBeans itself. Chapter 9: Dialogs This is last long chapter (28pages), which comparing to next four (sum 36 pages) is last "big" topic. Dialogs are not only simple notifications but also Wizards! We all know how wizard can make friendly some complex actions, especially when user do know know "Everything" about what and How he or she can do it. The best thing about wizards is that there is alre...

After chapter 6: Nodes and Explorer Views

As in title there is only sixth chapter I ended also earlier ones, but this one was Huge! I can't understand why author make his one big chapter where I can see at leas 2-3 relatively autonomous parts, at least properties and Visual Library can make a separate chapter. I am complaining because I really like small chapters which I can read in one evening or even morning ;) Chapter 4: Lookup Lookups are certainly a heart of modules system in NetBeans. Using scopes Modules can search for public classes(using this developers can add functionalities to existing modules) and communicate with other modules without knowing exactly to which module they are talking Chapter 5: Actions Pretty straight-forward, creating Actions(as global and reusable for toolbar, menu). More advanced is creating actions that are enabled with custom conditions, eg. Task object available in lookup to edit it :) Chapter 6: Nodes and Explorer Views Longest chapter (65 pages), about... everything from Expl...

Boolean in loop

Reading about Lookups I found new(for me) and awesome way to manage boolean value  used for controlling loops:         boolean valid = false;         while(!valid){             id = this.getId();             valid = true;             for(IdValidator validator : rstl.allInstances()){                  valid = valid && validator.validate(id);             }         }    Using && really make me thinking why I didn't figure it out yet!

NetBeans Platform Chapter 3: Window System

Chapter 3: Window System Everything you should now about creating layout in NetBeans applications. Most of it can be done declaratively, and in standard cases Wizards will do the job. But there is more! Despite NetBeans standard layout positions you can create new ones. End even create groups of them(something like perspectives in Eclipse).   If you want even more power about layout window position and even opening and closing of them can be changed programmatically! Of course groups of windows can be managed as well. At the end of the chapter there was example about saving data and about how NetBeans is remembering last state of opened windows. Using writeProperties and readPropertiesInpl we can store some data using key-value pairs. It could be handy for storing some custom configuration, or even last state of edit or whatever user was doing in application. Chapter 4: Lookup - how to use another modules and ensure that they are still loosely coupled... I really want to see ...

NetBeans Platform chapters 1 and 2

Chapter 1: Modules About modules but also a quick introduction to creating NetBeans platform Project and modules. There was some changes between what was expected and what I found after project creation, but nothing important. Great quick start, which ends making me wanting more :) When starting with this book creating NetBeans Platform projects looks pretty easy and very interesting. Yes, this is for newcomers in NetBeans, but it makes me not be discouraged at the beginning. Chapter 2: Forms. All about Matisse and how to use it for creating frontend of your application. Best of it is at the end of chapter: how to add my shiny new form to NetBeans palette! Really nice feature! If you have problems with: org.openide.util not recognized check this link:  http://forums.netbeans.org/ptopic30967.html  To add TaskEditorPanel to pallete add package of  it to public Api of this module in project preferences. Then NetBeans wizard will recognize it. Next: Chapter ...

Java lub ...

Jakiś czas temu przeczytałem post  chlebik.wordpress.com  do którego chciałem się jakoś odnieść ale nie mogłem się za to zabrać. Głównie uderzyło mnie podobieństwo mojej obecnej sytuacji, a więc niedawno rozpocząłem pracę także jako młodszy programista PHP(ponownie) tym razem w Interia.pl. Co prawda jest to okres próbny ale w perspektywie jest praca stała, ale do rzeczy... Kolejny etap szukania pracy i nadal nic z tego, jeśli chodzi o Javę to po serii rozmów kwalifikacyjnych doszedłem do wniosku że gdybym się uczył Javy w czasie studiów(ale tylko Javy) to pewnie dał bym radę mieć to wszystko na bieżąco. Na niektórych rozmowach miałem pytania z samego języka (trzeba mieć w jednym palcu Thinking in Java), albo pytanie z bibliotek/frameworków/technologii jak Spring/Struts/JPA/Hibernate itd. Tutaj trzeba by przeczytać przynajmniej po jednaj książce więc tak około 5 książek. Biorąc średnią długość takiej książki na 500 stron i jakieś 30 stron dziennie średnio jakie mogę przeczy...

Thoughts, languages, jobs...

Recently @hipertracker wrote that I do not know Java, with sadness I must write that he may be right... At university I staudied mostly C++ strictly academicaly, then I wrote some Java and C# projects and in last year I choose Java, particuary JavaFX for my B.Sc. With knowledge of C++ I was able to read one short book about JSE, and one about Servlets to start coding. By now I think that ther is no way to continue my journey without any *good* book about Java. Thats my conclusion. So what do you recommend? And I still think my tests were quite good, maybe except java, but I know that in first place becouse It was too fast for me. But for my simple test I have about 60% of confidence that: Java and Scala in speed are similar(linear problems), Groovy is slow. I was reading a book about Groovy: Pragmatic Groovy about 2 months, I was a good book. If anyone is interested in Groovy I can recommend it. But if you find something newer it will be even better ;) I will abort ...

JVM Languages speed test: Java vs. Scala vs. Groovy

This is helloworld spped test... so it shows nothing about speed other than mentioned in comments.  For all that doesn't like my test: For me it shows how small applications can work and if they are smart enough to ignore dummy code :) I've figured it after reading comments. Summary: Java is slow, Scala works probably the same but starts longer. Groovy is slower. Groovy++ - maybe some day I will have time to test it.  I read about Groovy and Scala, both languages are interesting. Groovy is easier and have much better support, it is like heaven and hell when you compare Scala and Groovy support (Intelli IDEA is only one that works for me... but I think that when I install in Eclipse Groovy plugin it breakes Scala support, Groovy and Scala are fighting in my computer and when one works second breaks, but it is only for me). I like Groovy but i read about how slow it is, lets write veeery simple test and check it: Scala: object Sample{   def main(args: Arr...

Recenzja: Hibernate w Akcji

Image
Książkę kupiłem jakiś rok temum gdy postanowiłem poznać bibliotekę Hibernate, tak szeroko stosowaną w świecie Javy. Skończyło się jednak na przeczytaniu o ile dobrze pamiętam niecałych dwóch rozdziałów. Z racji upływu czasu zatarło się wspomnienie dlaczego właściwie jej nie przeczytałem, ale problem pozostał: trzeba się w końcu tego Hibernate nauczyć, bym bardziej że używam go w praktyce często "na czuja" , niby jakoś ile ale porcja konkretnej wiedzy na pewno nie zaszkodzi. No to zacząłem czytać: 1 rozdział: Wprowadzenie w ORM'y. Ok, standard. 2 rozdział: Hello World! Próba odpalenia Eclipse i testowania kodu. Moment iluminacji, już wiem czemu poprzednio jej nie przeczytałem! Książka mimo iż wydana początkowo przez Manning i należy do serii...

Nowe książki(PL)

Właściwie ten post będzie czymś w rodzaju opisu tego co obecnie robię, oczywiście poza pracą:) Otóż zakupiłem ostatnio dwie książki "Core Java Server Faces" oraz "Spring Framework, Profesjonalne Tworzenie Oprogramowania w Javie". Może zacznę od ich małego podsumowania, a właściwie pierwszego wrażenia po przeczytaniu wstępu/wprowadzenia w obu książkach. Jako pierwszą zacząłem czytać JSF. Sam wstęp ma 29 stron, a znalazło się tam miejsce nawet na prosty przykład, język jest zrozumiały i jasny. Kupiłem jednak tą książkę tak naprawdę tylko po to by usystematyzować moją wiedzę o JSF, tak więc (przynajmniej na razie) książkę czyta się szybko i przyjemnie. Co do Springa, jest już gorzej. Springa używam, przynajmniej IoC, jednak tutaj naprawdę muszę się uczyć... Sama książka jest o jakieś 200 stron dłuższa niż JSF, co sprawia że ma już 800 stron, jednak nie ma się co przerażać jej grubością. Pierwsze 10% książki które już przeczytałem to oczywiście wstęp, nasycony jest jedn...

Rozwiązywanie układu równań metodą Gaussa

Główna klasa aplikacji zawierająca przyciski, tabelę itd. oraz główne metody przez klasę wykonywane - odpowiedź na naciśniećie odpowiednich przysisków aplikacji. "Zatwierdź" powoduje stworzenie tablicy o podaych wymiarach, a oblicz powoduje( w przypadku poprawnego wprowadzenie współczynników równania) obliczenie wartości niewiadomych x1, x2, itd. Program jest dostępny do ściągnięcia na mojej stronie: krzychukula.googlepages.com KOD: * * JedendesktopView.java */ /** * The application's main frame. */ public class JedendesktopView extends FrameView { public JedendesktopView(SingleFrameApplication app) { super(app); initComponents(); // status bar initialization - message timeout, idle icon and busy a nimation, etc /// to mniej ważne;-) ///i ważniejsze: @Action public void ZmieńWielkośćTablicy() { wielkosc = jSpinner1.getValue().hashCode(); jTable1 = new javax.swing.JTable(); String[] tytuly...

Interpolacja funkcji metodą Lagrange'a

Witam, zamieszczam kolejny programik napisany w javie - do czego służy widać z tytułu posta. Jest to kolejny projekt zaliczeniowy przy czym przy jego tworzeniu najważniejsze było zrozumienie algorytmu jego działania. W związku z czym nie zamieszczam całości kodu, a jedynie kod obsługi przycisku "Oblicz": private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: //pobieram ilość elementów które powinienem pobrać z tablicy wielkosc = jSpinner1.getValue( ).hashCode( ); x = Double.valueOf(jTextField1.getText( )); Double iloczyn = 1D; Double suma = 0D; //tablice tymczasowe Double[ ] X = new Double[wielkosc]; Double[ ] Y = new Double[wielkosc]; //wczytywanie danych z komponentu do tablicy for ( int i = 0; i < wielkosc; i++) { Y[i] = Double.valueOf(jTable1.getModel( ).getValueAt(i, 1).toString( )); System.out.println( "i " + i + "y = " + Y[i]); ...

Program zaliczeniowy: Gra w życie

Gra w życie. Poniżej zamieszczam mój najnowszy programik napisany w javie. Pisałem go w NetBeans 6.1 co widać jeśli ktoś w nim pracował. Porgram umożliwia rysowanie oraz wykonanie kroku po naciśnięciu przycisku "Krok". W zrozumieniu jest raczej prosty więc jeśli komuś się przyda to bardzo dobrze;-)   /* * Main.java *Gra w życie z użyciem dwóch kolorów * Created on 7 czerwiec 2008, 19:20 */ package grawzycie; import java.awt.Color; import java.awt.Graphics; /** * * @author  shaman */ public class Main extends javax.swing.JFrame {     /** Creates new form Main */     public Main( ) {        tablica = new Color[37][32];        tymczasowa = new Color[37][32];         for ( int i = 0; i < 37; i++) {             for ( int j = 0; j < 32; j++) {                tablica[i][j] = new Color(255, 255, 255);            }        }        kolor = true;        initComponents( );        g = jPanel1.getGraphics( );    }     /** This method is called from...