Archive | April, 2010

Checking for possibly null values in LINQ

30 Apr

Written by:

I recently encountered some confusing code that was written to work around this issue. Let’s say you want to find all items whose title is null. Using LINQ, you could do something like this:

var titleless = items.Where(x => x.Title == null);

This works just fine in LINQ to Objects, LINQ to SQL, and LINQ to Entities. But what if you instead want to find all items whose title is equal to a variable that may or may not be null?

string title = null;
var titleless = items.Where(x => x.Title == title);

This works in LINQ to Objects, but not LINQ to SQL or LINQ to Entities, due to the fact that it generates SQL something like this:

select * from Items where Title = @x 

which translates into

select * from Items where Title = null 

which doesn’t match anything, because null does not equal null in SQL. It needs to generate this:

select * from Items where Title is null 

You can make it work in LINQ to SQL if you use object.Equals:

var titleless = items.Where(x => object.Equals(x.Title, title)); 

That generates the is null when title is null. But it doesn’t work in LINQ to Entities. You can make it work in LINQ to Entities with this statement:

var titleless = items.Where(  x => title == null ? x.Title == null : x.Title == title); 

But that generates some scary SQL akin to this:

select * from Items where (

M3: Mobile Power for the Ministry

25 Apr

Written by: Dony & Kathryn Donev

After traveling almost 4,000 miles, I am finally at the 2010 BibleTech listening to Antoine’s talk on mobile technology in the ministry. Antoine is the main guy behind the Mobile Ministry Magazine and a great friend, but I am sitting in his lecture for more than just the code and the algorithm. I am a practitioner in the ministry.

Thousands of Bulgarian speaking people across the globe rely on our team every day to receive a verse from the Bible via SMS. Our Bibliata.TV website has become the Bulgarian GodTube with over 10,000 daily visitors, 1,500 active uploaders and hitting a half petabite monthly traffic in video exchange. So, I am more than just a listener – I am here for the power of the experience.

I met Antoine last year at BibleTech in Seattle. I shared with him our ministry in Bulgaria and abroad, and he offered to help us. Not long after the conference, I received in my office a Nokia 5800, which according to Antoine had more than one advantage over the iPhone, but the one that concerned me the most was the uStream app.

Speaking at the Leadership Development Institute earlier that year, I mentioned uStream but being busy with other projects never paid too much attention to it. Now, I had a reason to try it. No more than five minutes after opening the FedEx package I was broadcasting LIVE on a dozen of our ministry’s websites. Five more minutes and people were actually watching. Hundreds of them.

WOW! I stopped for a pause, because my heart was racing. The potential of one small mobile device applied to the ministry of the church was overwhelming and I needed to pray.

A week later I had convinced two Bulgarian churches to broadcast their services via uStream. Two more joined on the following Sunday, one of them being a Bulgarian speaking congregation in Chicago. A Bulgarian minister from Spain began broadcasting on Thursday nights as over 50 people were logged in and ready to watch 30 minutes before his broadcast. We then put LIVE online the annual conference of Bulgarian churches in North America. Then the Global Day of Prayer from downtown Sofia was watched by 35,000 people LIVE on our Bibliata.com website.

Before we ever returned for our ministry term in Bulgaria, we had over a dozen churches broadcasting LIVE services on Sunday alone plus additional LIVE services on every night of the week except Monday. We received hundreds of emails with testimonies of dramatic healings and life transformations. And this has been going on for over one year now. All because of a small portable telephone that can fit on the palm of my hand and travel with me oversees in the pocket of my blue jeans. I guess I can say it like this: this phone was made for preaching!

John Maxwell says that while training followers adds to your church, training leaders multiplies it. I call this the G2 effect – the growth of the church in a geometrical progression. Like the story of chess boards (2, 4, 16, 256, etc). But the use of mobile technology in the ministry multiplies its effectiveness tridimensionally, adding to it a mobile dimension as a Rubik Cube. I call it M3 – a mobile motivational ministry factor that is unprecedented. And this is something the church cannot afford to miss if it wishes to remain relevant in postmodernity.

WhereNotNull Extension Method

22 Apr

Written by:

It’s not uncommon to write code similar to the following:

How Has Being (More) Mobile Changed Your Outlook On…

21 Apr

Written by: Mobile Ministry Magazine

Much time these days is spent looking at the landscape of internet and mobile and asking about its effects on me personally, spiritually, professionally, etc. Besides the excitement (and financial highs and lows) of seeing mobile evolve, I’ve also seen my own perceptions and core uses change. How has being more mobile – or even just more aware of what mobile has become around you – changed or challenged your outlook on life personally, professionally, and spiritually?

This post originally appeared on Mobile Ministry Magazine

How to Apply for an Internship at Logos

16 Apr

Written by:

Sometimes, when promoting internships at Logos, I’m asked what kind of questions we ask on the interview. Or I’ll get an email from a candidate we rejected, asking how they could have done better. I’m not going to give out our list of interview questions, but I will give advice on how to really stand out when applying.

We don’t require a checklist of skills (“3 years experience with .NET 4”), nor are we impressed with a dense list of acronyms on a résumé. We’re looking for coders who are passionate about programming and who have the talent to tackle any huge problem we will throw at them. Here are some qualities we want to see in a potential hire.

CompSci Basics. Understand algorithms, data structures, computational complexity. Know the basics of hardware (e.g., order these by speed: HDD, LAN, L1, RAM, L2, Internet, DVD), bits & bytes (e.g., the “interesting” powers of 2), and software (operating systems, compilers, Internet protocols). Become familiar with technologies relevant to our field (Unicode, cloud computing, information retrieval, etc.).

Know the Company. Browse our websites, find out what we do & who we are, watch our videos, read our blog, use our products. If you go to church, maybe your pastor owns a copy of our software and could show it to you. (If they don’t own it, why not? Get them to watch the videos.)

Show Passion. Do something outside of school. Find an open source project and contribute to it. Learn what’s new in C++0x, C# 4, Java 7, or HTML5. Write a blog. Enter a programming competition. Download Python/Ruby/Haskell and work through an online tutorial. Write an online tutorial. Start a user group interested in some technology. Read a book that isn’t part of your CS curriculum.

For further reading, I recommend a three-part series posted by Tyler Hicks-Wright: How to Get a Job at Fog Creek (and Other Selective Software Companies), Part 1; Part 2; Part 3.

This post originally appeared on code.logos.com

Migrating a C++/CLI Project to Visual Studio 2010

15 Apr

Written by:

You’ve probably read that Visual Studio 2010 supports multi-targeting: with the flick of a project property switch, the compiler can generate binaries for either the .NET 3.5 or .NET 4 platforms. And in fact, when you upgrade a Visual Studio 2008 solution to 2010, the upgrader will set the target framework to 3.5 so that your code compiles and runs exactly as before. (New projects, by default, target .NET 4.)

However, this is only true for C# and VB projects; C++/CLI projects will automatically be upgraded to .NET 4 and the new VC10 compiler. It is possible to change this, but there is no UI1; you have to edit the project file manually. And, most importantly, Visual Studio 2008 SP1 must be installed side-by-side for this to work2. The VC10 compiler has no support for .NET 3.5, so Visual Studio will invoke the VC9 compiler (included in VS2008) if you target the .NET 3.5 platform.

To change the target framework3:

  1. Open the solution in VS2010 and have it convert the project files to the new VCXPROJ format.
  2. Close the solution, or manually unload the C++ project file.
  3. Open the VCXPROJ project file in a text editor.
  4. Find the XML element
  5. Find the child element; if not present add it.
  6. Set the inner text of the element to the desired framework version (v2.0, v3.0, v3.5, or v4.0), e.g.,
    v3.5
  7. Optional: Add Client if you want to target the client profile (or remove that element if it exists to target the full framework)4.
  8. Save the VCXPROJ file and close it.
  9. Reload the project/solution in Visual Studio 2010.

Notes:

  1. There is UI for native-only projects; see Native Multi-Targeting at the Visual C++ Team Blog.
  2. See C++ Property Pages documentation at MSDN.
  3. Thanks to Đonny who provided excellent instructions in community content added to a MSDN article.
  4. Thanks to Rick Brewster at the Paint.NET Blog for this tip.

This post originally appeared on code.logos.com

YouVersion for the iPad

13 Apr

YouVersion for the iPad

Written by: Mobile Ministry Magazine

Well, if you don’t have one (I don’t), and haven’t paid attention to the news anywhere for the past month or so, then I won’t pester you with details. The Apple iPad has been released and folks are in the mist of playing with them. And now, there’s a YouVersion application to go along with it. Here are the details from the LifeChurch.tv website:

Image: screenshot of the YouVersion iPad application, via YouVersion

Apple’s revolutionary new device is almost here and we’re ready with a brand new YouVersion Bible app designed specifically for the iPad’s big, beautiful screen. We’ve had the chance to play with it in the simulator (since no one has an actual iPad) and we think you’re going to love the Bible reading experience.

With the tight deadline and the fact that we’ve never actually tested the app on a real device, we decided to focus on the Bible reading experience with the first release, but more features and further refinement are already under development and we plan to release new versions quickly over the next few weeks. Some of the features slated for versions 1.1 and 1.2 are syncing with your YouVersion Reading Plans, more social sharing, and YouVersion Live.

No need to wait, check it out at YouVersion and download via iTunes.

This post originally appeared on Mobile Ministry Magazine

BibleTech Recap #2: Conversations and Networking

13 Apr

Written by: Mobile Ministry Magazine

If there’s one thing that can be said about BibleTech, its that unique gathering of technical-minded and working believers who have a very vested interest in making sure that anything done with these bits and bytes reflects God’s hand in all of our lives. Its only a two day get together, but totally impressive and humbling.

Starting with my running into the Logos team before things got started, until that late night conversation with Logos and Trey Gourley (maker of the in-conference revamped Holy Lamp reading plan site) – conversations were definitely flowing the entire time.

Before highlighting some of the conversations with the presenters, I’d like to point you to Scripture Tunes and PixelPew. The ladies that run these respective sites were just attending so that they could get a better understanding of tech and connect with others in the Body. In my conversations with them, I wasn’t just impressed with their hearts for their respective areas of ministry, but in how much that was talked about that they had genuine interest in. These ladies are on the ball even more than us who present.
Side note: am wanting to steal Pixel Pew for her web design services, you should as well.

Then there was an insightful conversation with the folks representing MAF (Mission Aviation Fellowship). Let’s just say that what they do with planes and ministry isn’t just encouraging, but brings back memories of wanting to fly like an eagle. They serve all over the world, and one of them talked about their travels in the South Pacific. I can only say that there’s a lot more in terms of information and life sharing that MMM will be doing with them in the future.

Another interesting conversation was had with the person from Interserve. Before BibleTech, I understood how professional services and the persons within them could serve Christ, in that conversation I understood how important that it was that these missionaries, more accurately, these service-supporters of missionary services are very valuable. MMM has a lot more to learn of that area, especially if Inner-Linked is going to become a bit more than just a footnote aspect of MMM’s goals.

Getting to those folks who did present. Well, Bob, Drew, Steven, Jonathan, Gabe, Donny (and wife), Aaron (and wife), Neil, Steven, James, Elizabeth, Weston and everyone else whose names I just forgot while typing this – you folks are awesome. I sincerely hope that its not another year before conversing with all of you. Yes, their platforms/presentation were great, but these folks just life a life in Christ that’s just one to learn from. It was the interaction with all of you that I personally looked forward to the most and was not disappointed.

Jayson Bradley (from Logos and the guy who set up BibleTech) – you are amazing. I wish we had more time. Thank God for your ears and insights. You did a great job, really great. Make sure that you get a window seat in those new offices now :)

Just as much as the technology is there to bring us together, the theme of the conference seemed to be to not forget the face time as well. And there was a lot of that all around. I even got into a number of conversations with the folks at the Sheraton San Jose where the conference was – great service, solid food, and just a general friendliness that was very nice to have.

So yes, there was a lot of talking going on. And there will be more. We’ve still got to talk about the main presentation and the other technical snaffu that happened during it. Stay tuned.

This post originally appeared on Mobile Ministry Magazine

BibleTech Recap #3: Mobile’s Christ-Led Encounters

13 Apr

Written by: Mobile Ministry Magazine

The third recap article of the BibleTech event centers in on the main presentation by MMM – Mobile’s Christ-Led Encounters. First a bit of background:

One of the reasons for speaking on the topic of mobile as a doorway into Christ-led encounters was to deflect some of the attention off of the newness, or the shiny, that mobile has become. Its a truism that mobile has hit some sort of collective consciousness and tons of folks want to know how to use it to better do ministry or be connected with others.

With this in mind, I made a point to reconnect and listen more to what people were asking about mobile – compared to last year at BibleTech where I did more talking. Here are some of the observations:

  • Using mobile alongside social networks efficiently
  • Using mobile as an avenue for non-online content
  • SMS engagement and service strategies
  • Mobile as a personal broadcasting point
  • Mobile as a community learning point

There were a few other conversations, but these were some of those pieces of mobile which tended to stick out a good bit.

There were about five presenters total who spoke on mobile directly, with another three or four mentioning mobile as an element to their strategy. By, the time day 2 rolled around, and it was time for MMM’s presentation, the ground was set to chat about being Christ-led and mobile enabled.

The presentation can be broken into two parts, the expanse of mobile, and the intention of the believer with mobile. In the first half, I talked about mobile in relation to statistics spoken of last year, along with some global trends. To that end there were 10 characteristics of mobile that were covered:

  • Communication (voice and text)
  • Consumption (passive media)
  • Charging (monetary transactions)
  • Commercials (targeted and response advertising)
  • Creation (user generated audio and video content)
  • Community (social networking)
  • Cool (fashion and psychology)
    Control (telemantics, remote control)
  • Context (status, location, environment, adaptivity)
  • Cyber (augmented reality, plants, animals, etc.)

Its within these areas that opportunities for mobile to enable ministry lie. I also made mention to reference the presentation from the previous night as mobile isn’t just a technological change, but a cultural one.

And then my phone rang. No. Really. Got a phone call in the middle of the presentation. I had a feeling it would happen. But you know, having your presentation interrupted by an unknown phone number on the projector is kind of funny – and a lot embarrassing. Thanks to the audience for rolling with that one.

Part two of the talk centered more on the believer who takes on mobile as a significant aspect of the great commission. There are a few statements here which are items that will pretty much carry the next (hopefully) 5 years of MMM:

  • Go. Teach. Disciple.
  • You disciple with the spirit of God and you maintain the connection with mobile devices. (thanks Vajaah for tweeting this one)

The first point we talked about before. “Go.Teach.Disciple.” as a short form of the Great Commission (Matthew 28:18-20) and as a long form for the impact that we are to have as we engage a culture that is growing increasingly digital and passive.

Therein lies the meat of things with the second point. Yes, there’s the big mobile-enabled world out there. And there are a ton of needs. But, without the Spirit of God – aka the Holy Spirit – our deeds are just that, deeds. We effectively bring the living Gospel to others when mobile becomes a handshake to something more than just something shiny.

And that’s how the presentation ended. Similar to the VSN Presentation, MMM’s encouragement is to use mobile as a handshake towards inviting others to the reality of Christ’s passion for them. Whether that’s directly in words, or indirectly in creating a cure, this is our mission. And in Christ’s leading, mobile becomes one powerful tool on our belt.

As with previous presentations, this one is available for viewing here.

This post originally appeared on Mobile Ministry Magazine

A truly lazy OrderBy in LINQ

9 Apr

&w=490&h=200&zc=1&q=90" alt="A truly lazy OrderBy in LINQ" class="thumbnail" width="490" height="200" />

Written by:

Jon Skeet recently discussed what it means to be “lazy” (in the context of LINQ to Objects). He introduced some new definitions based on how the operator processes the source sequence. Another aspect (which Jon didn’t cover) is how lazily the operator produces output when its results are enumerated.

Let’s take a concrete example: what’s the difference in running time between these two statements?