Приложна математика

   Мислите, че разбирате от математика? Мислите, че разбирате от програмиране? Следната математическа задача възникна от съвсем реална ситуация.

В пицария Годзила са увеличили диаметъра на пицата от 27 на 30cm.

   a) с колко процента се увеличи площа на пицата?
   b) Ако от старата (27cm) пица се отреже парче отговарящо на централен ъгъл X то в центъра на парчето ще има два пъти повече сирене отколкото на ръба му. Ако промяната в дисперсията на сиренето е постоянна, колко процента по-малко сирене има по ръба на новата пица отколкото в центъра и.
   c) да се изчисли с колко процента се е увеличило сиренето в пицата при данните от подусловие b).
   d) да се състави програма, която при зададени входни данни стар и нов диаметър на пицата да изчислява резултати за горните подусловия.
   e) да се направи горната програма разширяема като се позволи написване на plugin съдържащ функция за изменение на дисперсията приемаща аргумент разстояние от центъра и връщаща резултат коефициент (сирене в центъра)/(сирене на съответния сантиметър).

Много обичам пиците от Годзила.
Posted by:   Stilgar
17:16 18.09.2008

Happy Programmer's Day

Happy Programmer's Day
   Happy programmer's day to everyone who is doing any coding. The day of the programmer is celebrated on the 256th day of the year (do I have to explain why?). Normally it falls on September 13th but on leap years like this year it falls on September 12th.

   Happy coding and may the Source be with you.
Posted by:   Stilgar
13:18 12.09.2008

.NET 3.5 SP1 and Visual Studio 2008 SP1 released

   Service Pack 1 for .NET 3.5 and Service Pack 1 for Visual Studio 2008 have been released.

Some downloads for .NET Framework:

online installer
full package - 237MB includes several versions of the framework for several operatin systems and architectures

Some downloads for Visual Studio 2008:

online installer
iso image - 851MB contains SP1 for all versions of VS

   The Express Editions are not patched but installed over the old versions. Online and offline installers can be found here.

   These releses add MANY features. Most of them are listed here. Enjoy!
Posted by:   Stilgar
02:18 13.08.2008

F# - First Impressions

   It seems like it is time to inform my multimillion reader base about my impressions about the F# programming language.  As I mentioned in my previous post I picked F# over IronPython because Python uses indentation to define scope. The first thing that got me annoyed about F# is that there is an option to turn on indentation based syntax like in Python and everyone uses it. At least it is an option and unlike Python when this option is turned on the F# compiler forces the use of spaces instead of tabs. On the other hand

let wordCount text =
   let words = String.split [' '] text
   let wordSet = Set.of_list words
   let nWords = words.Length
   let nDups = words.Length - wordSet.Count

really looks better than

let wordCount text =
   let words = String.split [' '] text in
   let wordSet = Set.of_list words in
   let nWords = words.Length in
   let nDups = words.Length - wordSet.Count in

   Right now when I am trying the examples from the "Expert F#" book I am always rewriting them with the heavy syntax. That way I am learning both types of syntax and what is more writing these keywords helps understand how expressions are composed. However when you get used to it these tokens are just messing around. Maybe with time I will get used to indentation based syntax and will give IronPython a try.

  Otherwise F# looks cool but strange. It is not even lispish. The first thing one needs to do is let go of type declarations which is not so simple because F# is as strongly typed as C#. It takes time to get used to type inference even if one has experience with C#'s way of doing it. Another thing that seems strange at first is that functions can return more than one value by automatically forming a tuple.  Tuples are then decomposed back to variables using pattern matching i.e. placing the first element of the tuple in the first variable, the second element in the second variable and so on. However this can get more complicated because an element in a tuple can itself be a tuple. Worth noting is that one can switch to C# style programming at any time. I hope I will not get tempted to program in F# like I do in C# when I try to do something myself because there will be no point in using F# if I write it like C#. What is more C# is better at being C# than F# is.

   Overall I think F# is fun but I have to wait to see what happens when I get into the deep waters.
Posted by:   Stilgar
14:55 05.08.2008

I'm Going Functional

   You may have noticed that I did not post any programming related articles lately. The main reason for this is that after I played with C# 3.0 and LINQ I have not learned anything really interesting. That is why I am beginning to study F#. To quote the "Expert F#" book review:

   "Expert F# is about practical programming in a beautiful language that puts the power and elegance of functional programming into the hands of .NET developers."

   Why learning F#?
Posted by:   Stilgar
16:54 29.07.2008
First Previous 1 2 3 4 5 6 7 8 9 10  ... Next Last