Convert LINQ to MongoDB queries to JavaScript shell

github_icon If you do a lot of work with MongoDB from .NET,
this code should look familiar:

var query =
        from p in mongo.People
        where p.Age > 20 && p.Name.Length >= 2
        orderby p.Age descending
        select p;

But could you answer these questions?

  • What *exactly* does it do on the server?
  • Is it using an index or not?

Well, I just released a new .NET library on GitHub

MongoDB query helper for .NET
https://github.com/mikeckennedy/mongodb-query-helper-for-dotnet

Now these questions are easy to answer. For example:

Console.WriteLine( query.ToMongoQueryText() );

outputs

{ "Age" : { "$gt" : 20 }, "Name" : /^.{2,}$/s }

Check it out. I hope you find it useful.

Ever wonder how big the .NET and Python communities are?

Do you ever wonder how big .NET and Python communities are? I’m working on an article about Python and .NET and this comparison definately came to mind. So I did some research on meetup.com.

I chose seven locations:

  1. Chicago, IL
  2. Los Angeles, CA
  3. New York, NY
  4. Seattle, WA
  5. Portland, OR
  6. San Francisco, CA
  7. Silicon Valley, CA

And did a search for meetups on .NET and on Python. Here is a graph of the results:

Relative size of python and ,net communities via user groups.[click image to enlarge] Continue reading

Much of my blog’s sample apps are now on GitHub and Azure

Here is a quick announcement if you have been downloading or using any of the libraries and sample applications from my blog. The most popular ones are now all on GitHub. This means you’re welcome to come and download or fork them! You can even contribute back if you see something useful that is missing.

My new GitHub projects:

Github: text-encoding-aspnet-mvc-by-example
Sample app: http://text-encoding-aspnet-mvc-by-example.azurewebsites.net/

GitHub: web-apps-hotkeys
Sample app: http://web-apps-hotkeys.azurewebsites.net/

GitHub: improve-mvc-perf-with-async-views
Sample app: http://improve-mvc-perf-with-async-views.azurewebsites.net/async

If you know of something I’ve published and you’d like it on GitHub, just send me a note!

Finally, the keen reader will notice I’ve moved my sample apps to Windows Azure Websites. I’ve been a vocal critic of Azure at times, but Azure Websites are quite nice. You get up to 10 domains for free. They are worth checking out.

Cheers,
@mkennedy

Python and .NET in Portland

If you live in Portland, OR and are interested in Python, you might want to drop by my user group talk at PADNUG February 20, 2014. I’ll be speaking on Python for .NET developers and it’s hosted by the Portland Area .NET User Group. Here are the details. The event is free and held downtown at the Microsoft office. Hope to see you there!

Python for .NET Developers – Feb 20, 2014
Michael Kennedy
http://www.padnug.org/

Continue reading

Special Event: MongoDB in New York from DevelopMentor

I’m excited to announce that I will be teaching MongoDB for .NET developers from DevelopMentor in New York City at MongoDB Inc.’s headquarters on Times Square. The class is March 11, 2014 to March 13, 2014.

If you are interesting in learning MongoDB or bringing MongoDB and NoSQL to your team, this is the perfect opportunity. Not only is it an amazing class, you will have the opportunity to mingle with developers at MongoDB.

Space is limited, so register now.

Contact me directly and I can likely get you a discount on admission especially if you are sending more than one developer. Continue reading

Part 7: Lambda Expressions in Python for .NET Developers Series

This post is part 7 of my many-part series entitled Python for .NET Developers. View the entire series here.

This video explores Python’s equivalent of C#’s lambda expressions. Continue reading

Part 6: Anonymous Types in Python for .NET Developers Series

This post is part 6 of my many-part series entitled Python for .NET Developers. View the entire series here.

This video explores Python’s equivalent of C#’s anonymous types including a custom class to make things smoother on the Python side. Continue reading

Part 5: Properties in Python for .NET Developers Series

This post is part 5 of my many-part series entitled Python for .NET Developers. View the entire series here.

This video explores Python’s equivalent of C#’s properties including read-only and computed properties. Continue reading

Part 4: foreach and IEnumerable in Python for .NET Developers Series

This post is part 4 of my many-part series entitled Python for .NET Developers. View the entire series here.

This video explores Python’s equivalent of C#’s foreach loops and IEnumerable interface. Continue reading

Part 3: A single, common base-type in Python for .NET Developers Series

This post is part 3 of my many-part series entitled Python for .NET Developers. View the entire series here.

This video explores Python’s equivalent of C#’s ‘everything derives from System.Object’ common type system. Continue reading

Part 2: Visual Studio and IDEs in Python for .NET Developers Series

This post is part 2 of my many-part series entitled Python for .NET Developers. View the entire series here.

This video explores choosing an IDE for Python development, especially one that will make .NET developers comfortable. What the video and visit the links below to get started. Continue reading

Part 1: Welcome and lightning-fast Python introduction in Python for .NET Developers Series

This post is part 1 of my many-part series entitled Python for .NET Developers. View the entire series here.

This first video and blog post simply introduce the series and provide a very brief Python language introduction. Without further adieu, here’s the video. Continue reading

Series: Python for .NET Developers Introduction

Welcome to my series of blog posts covering Python for .NET developers. In this many-part series, I will introduce you to Python from a .NET developer’s perspective.

As .NET developers, we generally adore C# and the .NET ecosystem. It has brought great productivity, expressiveness, and features to software developers. I believe you will be deeply surprised to see a side-by-side comparison of C# / .NET and Python. Many of the features we think make C# special and unique have parallels in Python (sometimes even improved parallels). Join me in this series as I compare C# / .NET to Python in a feature by feature breakdown. Continue reading

Watch Python for the C# and .NET developers

We just published my latest webcast. Feel free to watch it or download the demos and slides. Hope you enjoy it!
                                         Python for the C# developerbootstrap-webcast-starter
Here is the summary:
If you love C# and .NET, you may be surprised to see how many of the features you love also exist in Python (often first). Python is a wonderful language. It is a clean high-level language which values readability over many trade-offs. You can build web applications serving billions of monthly page views. You can build cross-platform GUI applications such as DropBox. You can access amazingly powerful database servers such as MongoDB and SQL Server. But did you know many of the things you absolutely love about C# also exist in Python? Lambda expressions – check. foreach loops – check. Rich class library – check. Iterators – check. And there is more. Come learn about all the things you love from C# and see how they are accomplished in Python.

Watch Building beautiful websites with Bootstrap

We just published my latest webcast. Feel free to watch it or download the demos and slides. Hope you enjoy it!

   Building beautiful websites with Bootstrap: A case studybootstrap-webcast-starter