DCSIMG
Fun,.NET - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

Browse by Tags

C# Extension Methods and Fluent Interfaces
07 February 13 03:42 AM | pavely | 1 comment(s)
The idea of fluent interfaces is not new, and has many forms. The basic idea is to use a single statement to encompass a series of operations that are natural, or at least simple, to use. There are very few fluent interfaces in .NET – the most well known, which has some fluent interface semantics, is the System.Text.StringBuilder class. Here’s a simple example: public static string BuildInfo(Process process) { return new StringBuilder( "Process " ) .AppendLine(process.ProcessName) .Append...
תגים:, , , , , ,
Windows Phone: Playing Sound Effects
03 September 12 01:25 PM | pavely | with no comments
I wanted to create a simple timer application for Windows Phone . The timer would count backwards from a user configured value and when it reached zero, it would play some sound effect to indicate expiration. Sounds simple enough… This is how the application looks like: The problem turned out to be playing that sound effect. I had a WAV file I wanted to play. Silverlight has a MediaElement object that is capable of playing video and/or audio, so it seemed to be a good candidate for the job. MediaElement...
Console Calculator with Roslyn (Part 2)
08 August 12 02:39 PM | pavely | with no comments
In the first part we created a simple enough calculator, but it lacked two features I wanted to have: 1. work with degrees or radians in trigonometric functions. 2. allow simple variables to be used without first declaring them. Let’s see how we can implement these features, starting with the first. Trigonometric functions work in radians, which is sometimes inconvenient.What we need is a way to change the parameter to the trigonometric functions by multiplying it by PI/180 if degrees was requested...
Towers of Hanoi–WPF Style (Part 2)
13 February 12 10:45 PM | pavely | with no comments
In the first part , we saw how to recursively solve the Towers of Hanoi problem in C#. In this post I want to show a graphic view of the solution. This is a starting position with 7 discs: This is how it looks when the problem is solved: In between, the discs move with animation from pole to pole, as the solution dictates. Options include speeding up the process (with the slider, very useful), pausing the animation and resetting to the initial state. Here’s something in the middle: The Poles The...
Towers of Hanoi–WPF Style (part 1)
11 February 12 10:43 PM | pavely | 3 comment(s)
I remember many years ago (at least 15), I was learning Prolog . I used the “Turbo Prolog” package from (what was once) Borland. One of the nice examples there was a solution of the Towers of Hanoi , with a simple animation that showed the steps graphically. This was all textual graphics (today’s Console windows), but it was impressive (at least it impressed me). Prolog was used to show off its AI capabilities, which are, in fact, a recursive, backtracking engine. No matter; we can do it in C#. Towers...
Technology Radio Show, Part 2
21 March 11 10:03 AM | pavely | 3 comment(s)
The second part of the technology radio show on 106.4 FM aired on last Thursday. As with the first part , I was the “Microsoft guy”. This time we were missing the iPhone and Ruby guys, but the show was more to the point (somewhat). You can listen to the recording (if you’re kinda really really bored) here (look for the March 17 show).
תגים:, , , , , , ,
Technology Radio show that I participated in
02 March 11 08:40 PM | pavely | 2 comment(s)
Last week I was invited to a radio show called “Technofobia” (origin in Hebrew) in the Interdisciplinary Center (IDC) in Hertzliya (Israel) (106.4 FM). This was a “special” talk about development technologies. There was a Ruby guy, a Python guy, a C++ guy (actually a girl), an iPhone guy (the famous Yossi Taguri ) and myself, as the “Microsoft guy”. I had to repeatedly (and during the music breaks) tell the hosts that I don’t work at Microsoft, I just use, teach, mostly like and develop with those...
תגים:, , , , , ,
COM Fun with Microsoft Agent
25 February 11 03:44 PM | pavely | 1 comment(s)
Whenever I teach COM interoperability in .NET, I try to show some nice demo for this. The classic is to use one of the Office applications (such as Word) to do some automation by creating a document, adding some text, etc. This is effective enough but not really fun. A much more fun way is to use the Microsoft Agent technology. MS Agent is discontinued as far as further development is concerned, but it’s still fun and great for (at least) learning purposes. What is MS Agent? Its most well known appearance...
XNA 2D Game Tutorial (Part 12)
05 December 10 03:55 PM | pavely | 3 comment(s)
Previous posts in this series: Part 1 : Getting started Part 2 : Drawing something Part 3 : Input handling Part 4 : Game Components Part 5 : Animation and Sprites Part 6 : Handling Projectiles Part 7 : Sound Effects Part 8 : Setting Up Data Part 9 : Creating Aliens Part 10 : Collision Detection Part 11 : More Collisions Teched is over. Time to get back to XNA… In our current project, we have a simple game in which the player can shoot aliens. They keep coming, and once the player is killed – the...
תגים:, , , ,
XNA 2D Game Tutorial (Part 11)
17 November 10 07:25 PM | pavely | 6 comment(s)
Previous posts in this series: Part 1 : Getting started Part 2 : Drawing something Part 3 : Input handling Part 4 : Game Components Part 5 : Animation and Sprites Part 6 : Handling Projectiles Part 7 : Sound Effects Part 8 : Setting Up Data Part 9 : Creating Aliens Part 10 : Collision Detection In the previous part we did some collision detection between the player’s missiles and the aliens. If hit, the alien disappeared gradually (as opposed to a big explosion). Let’s add some more collision detection...
תגים:, , , , , ,
XNA 2D Game Tutorial (Part 10)
16 November 10 10:45 AM | pavely | 2 comment(s)
Previous posts in this series: Part 1 : Getting started Part 2 : Drawing something Part 3 : Input handling Part 4 : Game Components Part 5 : Animation and Sprites Part 6 : Handling Projectiles Part 7 : Sound Effects Part 8 : Setting Up Data Part 9 : Creating Aliens In the previous part we created a bunch of alien enemies that are moving down the screen. Currently, if they hit the player’s ship – nothing happens. If the player’s missiles hit an alien – nothing happens. We need some collision detection...
תגים:, , , ,
XNA 2D Game Tutorial (Part 9)
14 November 10 10:20 PM | pavely | 3 comment(s)
Previous posts in this series: Part 1 : Getting started Part 2 : Drawing something Part 3 : Input handling Part 4 : Game Components Part 5 : Animation and Sprites Part 6 : Handling Projectiles Part 7 : Sound Effects Part 8 : Setting Up Data In the previous post we prepared the data for the aliens and for the game levels. In this post, we’ll put that data to action. The first thing we’ll do is create a custom Alien class, that extends the Sprite class and adds some specific alien attributes. This...
תגים:, , , , ,
XNA 2D Game Tutorial (Part 8)
13 November 10 02:46 PM | pavely | 9 comment(s)
Previous posts in this series: Part 1 : Getting started Part 2 : Drawing something Part 3 : Input handling Part 4 : Game Components Part 5 : Animation and Sprites Part 6 : Handling Projectiles Part 7 : Sound Effects   What do we have so far? A player controlling a ship capable of firing missiles (with sound), flying through space with a backdrop of passing stars. Clearly, no real challenge for the player yet. It’s time to add some enemies to challenge the player. In this part, we’ll handle setting...
XNA 2D Game Tutorial (Part 7)
11 November 10 10:25 AM | pavely | 5 comment(s)
Previous posts in this series: Part 1 : Getting started Part 2 : Drawing something Part 3 : Input handling Part 4 : Game Components Part 5 : Animation and Sprites Part 6 : Handling Projectiles The game as it is now is not yet challenging – there are no enemies to threaten the player – she simply flies through space, shooting at nothing. We’ll deal with some enemies in the next part, but first let’s consider sound. Sound is a critical part of any game. Just for kicks, play your favorite action game...
תגים:, , , , ,
XNA 2D Game Tutorial (Part 6)
09 November 10 01:20 PM | pavely | 10 comment(s)
Previous parts in this series: Part 1 : Getting started Part 2 : Drawing something Part 3 : Input handling Part 4 : Game Components Part 5 : Animation and Sprites In the previous part, we added animation capabilities to a general Sprite class. Our next step is to add firing capabilities to the player. The first thing we’ll do is move the player logic to its own component. This would make it flexible (allowing us to disable it in a title screen, for example) and easier to maintain. Add a new Game...
תגים:, , , , ,
More Posts Next page »