Виртуальная песочница (тм)

Wednesday, August 4, 2010







Увидел картину художника-абстракциониста - "Пингвин, поедающий яблоко, смотрит в окно." Я говорю художнику: "чертика забыли". А он глаза закатил: "Как вы меня задолбали! И с чего вы взяли что тут чертик должен быть?!"

Read more...

Tuesday, July 6, 2010

.NET vs Delphi: the "as" operator


public object Execute(object request) {
if (request is Request)
return service.Execute(request as Request);
else
throw new NotImplementedException();
}


CA1800 : Microsoft.Performance : 'request', a parameter, is cast to type 'Request' multiple times in method 'Wrapper.Execute(object)'. Cache the result of the 'as' operator or direct cast in order to eliminate the redundant isint instruction.<br />

Microsoft хочет, чтобы было так:


public object Execute(object request)
{
var r = request as Request;
if (r!=null)
return service.Execute(r);
else
throw new NotImplementedException();
}


потому что, как оказывается, "the "as" operator never throws an exception. Instead, if the indicated conversion is not possible, the resulting value is null." Read more...

Saturday, July 3, 2010

Javatar .Not

YouTube - Javatar .Not


See also "RailsEnvy.com: All Ruby on Rails Commercials"

Update 9-JuL-2010. С YouTube видео уже убрали: "This video is no longer available due to a copyright claim by Alley Music Corp." Однако по запросу "javatar .not" Google находит "about 44,200 results" in "0.35 seconds". Например, на New JavaZone2010.

Объяcнение шутки про Scala Johanson: http://www.scala-lang.org/ Read more...

Wednesday, June 16, 2010

How to create executable jar in NetBeans IDE

Why use a Eclipse if you can use a well-suited, fast and optimized out-of-the-box-IDE?
Вот и у меня тоже такие вопросы очень часто возникают... Действительно, why? И почему Eclipse всё ещё настолько широко используется для Java проектов?..

Easy as pie: (Netbeans 5.5)
right-click your project, "set main project", select your project,
"File", "PROJECTNAME Properties", "Run",
set your main class,
"Libraries", "Add JAR/Folder", select your wanted libs,
do a CLEAN build,
enter the build-path, enter /dist and be amazed --> DONE!

No Modifications/Hacks/buggy DiY-IDE´s, no cry

Вся фишка в том, чтобы сделать clean build - тогда оно само всё создаёт, и каталог, и архив. Read more...

Simulated Annealing (Алгоритм имитации отжига)

"Example. Given 100 workers and 500 jobs, find which workers should do what jobs to minimize the distance driven by all 100 workers. The location of jobs and starting location of all workers will have available their longitude and latitude, and a simple equation exists to calculate distance between longitude and latitude. Other constraints include skills, varying length of jobs, return to starting point with 8 hours, and several others. The Simulated Annealing technique (алгоритм имитации отжига) is a common way to solve this type of problem."

"На форуме, имхо, давно используется алгоритм имитации отжига. Постится хрень и идет расчет на то что - а вдруг она сойдет за отжиг? Мда. Было давно и всегда." :)

См. также

Read more...

Thursday, May 27, 2010

Oracle Magazine asked me:
"Which of the following publications do you read regularly, that is, at least 3 out of every 4 issues published?"

  • CIO

  • ComputerWorld

  • DM Review (Nov-2008)

  • Database Trends and Applications

  • Dr. Dobb's Journal

  • InfoWorld

  • JavaPro (2004-2005)

  • Java Developer's Journal

  • Java World

  • Linux Journal

  • Oracle Scene (UK Oracle User Group)

  • Profit

  • Select (IOUG) - Independent Oracle Users Group

  • XML Journal

  • Quest Q&A (Quest International online magazine) (Jan-2010, other archives, last issue; see also this and this)

  • Read more...