Top open-source Questions

List of Tags

Caution!

This ancient question is from the early days of Stack Overflow, and while we recognize its historical significance and have thus chosen to keep it around, please realize that if a question like this were to be asked today, it is very likely to be closed by the current community of users.

Please feel free to read and learn from the answers to this question, but refrain from asking similar questions just because this one exists.

Let's make a list of answers where you post your excellent and favorite extension methods.

The requirement is that the full code must be posted and a example and an explanation on how to use it.

Based on the high interest in this topic I have setup an Open Source Project called extensionoverflow on Codeplex.

Please mark your answers with an acceptance to put the code in the Codeplex project.

Please post the full sourcecode and not a link.

Codeplex News:

24.08.2010 The Codeplex page is now here: http://extensionoverflow.codeplex.com/

11.11.2008 XmlSerialize / XmlDeserialize is now Implemented and Unit Tested.

11.11.2008 There is still room for more developers. ;-) Join NOW!

11.11.2008 Third contributer joined ExtensionOverflow, welcome to BKristensen

11.11.2008 FormatWith is now Implemented and Unit Tested.

09.11.2008 Second contributer joined ExtensionOverflow. welcome to chakrit.

09.11.2008 We need more developers. ;-)

09.11.2008 ThrowIfArgumentIsNull in now Implemented and Unit Tested on Codeplex.

Answered By: Winston Smith ( 232)
public static bool In<T>(this T source, params T[] list)
{
  if(null==source) throw new ArgumentNullException("source");
  return list.Contains(source);
}

Allows me to replace:

if(reallyLongIntegerVariableName == 1 || 
    reallyLongIntegerVariableName == 6 || 
    reallyLongIntegerVariableName == 9 || 
    reallyLongIntegerVariableName == 11)
{
  // do something....
}

and

if(reallyLongStringVariableName == "string1" || 
    reallyLongStringVariableName == "string2" || 
    reallyLongStringVariableName == "string3")
{
  // do something....
}

and

if(reallyLongMethodParameterName == SomeEnum.Value1 || 
    reallyLongMethodParameterName == SomeEnum.Value2 || 
    reallyLongMethodParameterName == SomeEnum.Value3 || 
    reallyLongMethodParameterName == SomeEnum.Value4)
{
  // do something....
}

With:

if(reallyLongIntegerVariableName.In(1,6,9,11))
{
      // do something....
}

and

if(reallyLongStringVariableName.In("string1","string2","string3"))
{
      // do something....
}

and

if(reallyLongMethodParameterName.In(SomeEnum.Value1, SomeEnum.Value2, SomeEnum.Value3, SomeEnum.Value4)
{
  // do something....
}
398
Ian Terrell

Are there any repositories around for open sourced iPhone and iPad components?

For instance, I have found myself needing to create several new types of table cells to mimic some of Apple's existing functionality (for instance, all the different types of table cells present in the Settings application). I can't imagine I'm alone here.

Where do you go to find open sourced reusable components, or do you just write and hoard your own?

Update: I know there are open source full projects around (see this question), but rummaging through them and picking and choosing still leads to significant duplication of effort.

Meta: There's a site for that!

There's a new nicely browsable list of iOS controls at http://cocoacontrols.com/.

Ongoing List

Here are some libraries that I've found or been told about (even answered here) since asking this question:

  • CocoaHelpers -- Extensions to common classes
  • MBProgressHUD -- Replacement for the undocumented UIProgressHUD
  • cocos2d for iPhone -- 2d game engine
  • TouchCustoms -- Memory management, ratings, progress bars, more (GitHub Offline)
  • s7graphview -- Graphing
  • core-plot -- More graphing
  • HTFramework -- Reusable views
  • EGOTableViewPullRefresh -- Pull to refresh like Twitter (Tweetie 2)
  • PullToRefresh -- Another pull to refresh implementation
  • MGSplitViewController -- UISplitViewController replacement for the iPad
  • AQGridView -- A UITableView-style replacement that supports grids
  • DDActionHeaderView -- Combine the core concept of UIToolbar and UINavigationBar
  • DDAlertPrompt -- UIAlertView subclass providing UITextFields for user/password inputs
  • ASIHTTPRequest -- An easy to use wrapper around the CFNetwork API -- No Longer Active
  • AFNetworking -- Popular delightful networking library for iOS.
  • RestKit -- A modern framework for implementing RESTful web services clients on iOS.
  • ShareKit -- A quick way to integrate Twitter,Facebook, etc. into your app.
  • iDev Recipes - Open source code for the idevrecipes.com blog
  • QuickDialog - Easy way to create dialogs, either in Obj-C or JSON
  • Three20 -- Custom UI classes used in the Facebook application
Answered By: MattDiPasquale ( 112)

Here are some good iOS open-source libraries/frameworks & projects:

UI Libraries & Frameworks

Networking

  • General
  • REST
    • RestKit: Makes interacting with RESTful web services simple, fast and fun
    • HTTPRiot: A simple HTTP REST Library
    • ObjectiveResource: Makes interacting with Ruby on Rails applications dead simple
  • Sockets
    • AsyncSocket: TCP/IP socket networking library that wraps CFSocket and CFStream
    • Zimt: HTML5 Websockets

Core Data

Projects

Game Libraries & Frameworks

Testing Libraries & Frameworks

Just to ask if anyone knows of an open source alternative to RedGate's Reflector? I'm interested in checking out how a tool similar to Reflector actually works.

Note, if you know of a free but not open source alternative to Reflector, you can answer the following related question:

Summary - Updated 11th May 2011

A quick round-up of the various open source projects and tools that have been suggested:

  1. Common Compiler Infrastructure (CCI)
  2. Mono Cecil
  3. ILSpy
  4. Dotnet IL Editor (DILE)
  5. IL.View
  6. Monoflector (no longer active as of April 2011)

The following resources may also be of interest:

  • TypeView.cs
  • Jason Haley's notes on disassembling .NET
  • Adrian Bank's recent blog post summarising a number of Reflector alternatives, including several options not mentioned below.
  • Mark Lichtenberg's detailed blog post comparing several of the open source alternatives (DILE, ILSpy and Mono Cecil using MonoDevelop) to Reflector.
Answered By: leppie ( 23)

2 options I know of.

  • CCI
  • Mono Cecil

These wont give you C# though.

263
wvdschel

Has anyone used Mono, the open source .NET implementation on a large or medium sized project? I'm wondering if it's ready for real world, production environments. Is it stable, fast, compatible, ... enough to use? Does it take a lot of effort to port projects to the Mono runtime, or is it really, really compatible enough to just take of and run already written code for Microsoft's runtime?

Answered By: miguel.de.icaza ( 342)

There are a couple of scenarios to consider: (a) if you are porting an existing application and wondering if Mono is good enough for this task; (b) you are starting to write some new code, and you want to know if Mono is mature enough.

For the first case, you can use the Mono Migration Analyzer tool (Moma) to evaluate how far your application is from running on Mono. If the evaluation comes back with flying colors, you should start on your testing and QA and get ready to ship.

If your evaluation comes back with a report highlighting features that are missing or differ significantly in their semantics in Mono you will have to evaluate whether the code can be adapted, rewritten or in the worst case whether your application can work with reduced functionality.

According to our Moma statistics based on user submissions (this is from memory) about 50% of the applications work out of the box, about 25% require about a week worth of work (refactoring, adapting) another 15% require a serious commitment to redo chunks of your code, and the rest is just not worth bothering porting since they are so incredibly tied to Win32. At that point, either you start from zero, or a business decision will drive the effort to make your code portable, but we are talking months worth of work (at least from the reports we have).

If you are starting from scratch, the situation is a lot simpler, because you will only be using the APIs that are present in Mono. As long as you stay with the supported stack (which is pretty much .NET 2.0, plus all the core upgrades in 3.5 including LINQ and System.Core, plus any of the Mono cross-platform APIs) you will be fine.

Every once in a while you might run into bugs in Mono or limitations, and you might have to work around them, but that is not different than any other system.

As for portability: ASP.NET applications are the easier ones to port, as those have little to no dependencies on Win32 and you can even use SQL server or other popular databases (there are plenty of bundled database providers with Mono).

Windows.Forms porting is sometimes trickier because developers like to escape the .NET sandbox and P/Invoke their brains out to configure things as useful as the changing the cursor blinking rate expressed as two bezier points encoded in BCD form in a wParam. Or some junk like that.

What are some open source programs that use Haskell and can be considered to be good quality modern Haskell? The larger the code base, the better.

I want to learn from their source code. I feel I'm past the point of learning from small code examples, which are often to esoteric and small-world. I want to see how code is structured, how monads interact when you have a lot of things going on (logging, I/O, configuration, etc.).

Answered By: Don Stewart ( 154)

What I recommend.

Read code by people from different grad schools in the 1990s

Read code by the old masters certain people (incomplete list)

Note that people like me, Coutts, Mitchell, O'Sullivan, Lynagh, etc. learned our Haskell style from these guys.

Read some applications

208
Tony Lenzi

What's the best way to get involved in an open source project? There are several projects I'd be interested in, and others I'd be happy to look into if just to keep my skills sharp in languages I don't currently use on a day to day basis. However, I'm not sure how to get started.

Answered By: Karim ( 176)

As the owner of an open-source project, I can tell you that people who are interested in joining that project have contacted me through the hosting service. In my case, Sourceforge.net and then Google Code. In both cases, once a project administrator agrees to include you in the project, you can be formally added to the project on the hosting service which gives you certain rights and privileges insofar as the host provides.

That said, you can forego all that up front and simply download the code and familiarize yourself with it and see if you think you will be able to (or want to) contribute after seeing how it's written. You can maybe even make a change or fix a bug to get your hands dirty. If you think it's worth including in the project, then contact the administrator along with your change. That will show that you really are interested in contributing and didn't just fire off an email on a whim.

196
Will Robertson

A couple of years ago, ZDNet ran an article interviewing Greg Stein on the Google Code project, discussing several software licenses and why Google Code only accepts a few of them. That article's been one of my biggest influences when it comes to "understanding" a few of the more common licenses around.

With relevance to the question I'm about to ask, here's the money quote:

That is one of the reasons that Google chooses the Apache License (2.0) as the default for the software it open-sources. It is permissive like BSD, but (unlike BSD) actually happens to mention the rights under copyright law and gives you a license under those rights. In other words, it actually knows what it is doing unlike some of the other permissive licenses.

Do you agree? Due to this article I've used and recommended the Apache License over the BSD and MIT licenses without question; but it's not like this article is necessarily the final word on this matter. Is there anything better (in the same vein) as the Apache License?


I like what you're saying, Adam, which is why I accepted your answer. However, it doesn't strike me as particularly useful, in general, to keep promoting both Apache and BSD (I guess we are just assuming MIT is no good in this company?) since they're essentially identical with that minor difference you mention that everyone basically does anyway.

Regarding 4 pages vs. 1 page: well, I guess I'd prefer the one that covers my ass better! :)

Answered By: miguel.de.icaza ( 137)

The Apache license has some extra benefits over the BSD or MIT X11 license-style licenses.

The Apache 2.0 licenses contain a patent grant, which means that at least the authors of the code are giving you any rights that you need for the authors' patents that happen to be in the code that you are using.