Języki programowania...

Wpis na 0. poziomie, wysłany 13 czerwca 2011 o 13:30:22

Pokutuje opinia, że wystarczy nauczyć się myśleć, a potem pętla for wszędzie wygląda podobnie. Nawet jakieś doświadczenie ją niby potwierdza. Ale każdy o odrobinę szerszych horyzontach wie, że nie jest to prawda. Języki funkcyjne często nawet nie mają pętli, lecz wielu programistów nigdy nie miało z nimi styczności. Ale to jeszcze nie jest ekstremum. Wkleję poniżej niby trywialny kod w najdziwniejszym języku, w jakim zdarzyło mi się coś napisać. Żeby było śmieszniej, język ten jest industry standard w bardzo intratnej niszy. Ktokolwiek rozpozna?

Pic related

Czytaj dalej...

Przemyślana paleta

Wpis na 0. poziomie, wysłany 08 kwietnia 2011 o 10:55:25

Sam należę do tych osobników, które może i odróżniają karmazynowy od szkarłatnego, ale nie mają zielonego pojęcia który lepiej pasuje do indygo. Stąd od zawsze moje ustawienia wszelakich kolorów ograniczają się do tego, co przyszło w pudełku. Problem w tym, że często twórcy programów z których korzystam, nie są w tej kwestii znacznie lepsi ode mnie... Dlatego bardzo cieszy, że trafiłem w sieci na serio przemyślaną paletę kolorów, z gotowymi plikami ustawień do co ważniejszych programów :)

Vim color palette

Czytaj dalej...

Największy (dotąd) błąd w C++

Wpis na 0. poziomie, wysłany 22 marca 2011 o 17:03:57

Jakiś czas temu opisywałem typowy błąd kompilacji w C++. Dzisiaj się męczę z dość poważną (np. mentorującą w Summer of Code) biblioteką... Która nijak nie chce współpracować. Pierwsza próba skompilowania przykładu z dokumentacji skończyła się ponad 700KB komunikatem błędu, z którego wklejam przykładową linijkę:

CGAL::Apollonius_graph_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_data_structure_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > >, CGAL::Boolean_tag >::expand_conflict_region(CGAL::internal::CC_iterator, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false> const&, CGAL::Apollonius_site_2 > const&, CGAL::Edge_list, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false>, int>, CGAL::Boolean_tag >&, std::map, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false>, bool, std::less, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false> >, std::allocator, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false> const, bool> > >&, std::map, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false>, bool, std::less, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false> >, std::allocator, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false> const, bool> > >&, std::vector, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false> (*) [3], std::allocator, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, false, CGAL::Triangulation_ds_vertex_base_2 >, CGAL::Triangulation_face_base_2, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian, CGAL::Integral_domain_without_division_tag, CGAL::Simple_cartesian >, CGAL::Integral_domain_without_division_tag, CGAL::Cartesian_converter, CGAL::Simple_cartesian, CGAL::NT_converter >, CGAL::Cartesian_converter, CGAL::Simple_cartesian >, CGAL::To_interval > >, CGAL::Triangulation_ds_face_base_2 > > > >, CGAL::Default>, false> (*) [3]> >*) in cc-hAZWN2.o

Jakoś nie miałem siły tego czytać... Może ktoś polecić jakiś prostszy soft który policzy mi graf (dualne do diagramu) Apolloniusa, albo od biedy Voronoi?

Python 3?!

Wpis na 0. poziomie, wysłany 21 lutego 2011 o 17:35:01

Zapowiada się na to, że znowu będę musiał przysiąść nad programowaniem w Pythonie. Z tej okazji, jak zawsze, robię rundę zwiadowczą w poszukiwaniu darmowych (z mojego punktu widzenia) usprawnień. Dzisiaj postanowiłem przyjrzeć się Pythonowi w wersji trzeciej. No i znalazłem kilka powodów, dla których jest on niemal niczym Perl 6 ;)

Czytaj dalej...

Najbrzydsza rzecz w Pythonie

Wpis na 0. poziomie, wysłany 19 grudnia 2010 o 01:48:30

W przerwie między zastanawianiem się czemu jeszcze nie śpię, a zajadaniem spaghetti z mikrofalówki, trafiłem na najbrzydszego do tej pory quirka w Pythonie. Znalezienie rozwiązania zajęło mi przygnębiająco dużo czasu. Jak również samo rozwiązanie jest przygnębiające - moduł musi importować samego siebie.

Czytaj dalej...

Model epidemii

Wpis na 0. poziomie, wysłany 08 grudnia 2010 o 19:05:53

Znajomy wykładał dzisiaj o mean field approximating the disease spreading model, postanowiłem posłuchać. Niestety nie przewidziałem jak bardzo podstawowy będzie dzisiejszy wykład. Stąd zamiast słuchać zacząłem pisać. Tak powstała wizualizacja tegoż modelu, w wersji z dyskretnym czasem. Kompletny kod poniżej.

Czytaj dalej...

To niby jest C

Wpis na 0. poziomie, wysłany 05 grudnia 2010 o 17:13:19

Właśnie opublikowałem jedno z dziwniejszych przeżyć programistycznych. Niby jest to stare dobre C... Jednak sami powiedzcie, jak to Wam wygląda.

Czytaj dalej...

PyPy - dziękuję, postoję

Wpis na 0. poziomie, wysłany 01 grudnia 2010 o 17:52:48

W ramach pracy zawodowej piszę średniej wielkości aplikację w Pythonie. Żeby było śmieszniej, aplikacja ta powinna być możliwie wydajna. Stąd czasami przyglądam się różnym ciekawym rozwiązaniom. Cython jest niby fajny, ale psuje kompatybilność kodu z innymi interpreterami*. Psyco dało świetne rezultaty, ale projekt całkowicie zamarł. Dlatego dzisiaj przyjrzałem się PyPy.

Czytaj dalej...

313 linijek - brzmi uczciwie?

Wpis na 0. poziomie, wysłany 12 marca 2010 o 17:36:19

Przed commitem wypada spojrzeć w diffa. Jeśli zaś zapomni się przez cały dzień commitować, to na koniec dnia widać ile się zrobiło. Tak więc widzę, że dzisiaj diff ma 313 linijek... Czy to brzmi na uczciwą ilość kodu?

Czytaj dalej...