Dominating Ning — First Try

If only Ning were as easy to hack on as WordPress!    Ning is a different animal in that you can’t just throw a Ning up on your own hosting like you can with WP.   All Ning social networks reside on Ning’s servers.  They can’t be deployed elsewhere because they rest on  a proprietary inner core (written in Java)  that Ning don’t give out.     When we say hacking Ning we have to specify our level of involvement.  It can fall anywhere from superficial to committed.

thumnail sample skinSkins: Like WordPress, you can make skins (themes) for Ning.  As with any well behaved MVC model application the presentation (AKA View) layer is completely separate from the logic.     Skins aren’t my thing.  If you are interested in making skins for Ning, leave a comment because I want to know you.

External Javascript widgets: Ning supposedly implements the Google opensocial standard, wherein you can run a valid XML file that adheres to the opensocial specification up the flagpole and allow any container implementing opensocial to deploy it.  I managed to get a “Hello World” widget to work on Orkut, but it wouldn’t work in Ning.  I believe that may be because Ning is in a state of flux with regards to what version of opensocial they support.  I have not had a good answer to my question on developer.ning.com.  But anyway I’ve become disenamored of widgets lately.   Widgets interact only superficially with their host and too many of them make any web page look like trailer trash.

Serious hacking: Call me needy but I yearn for greater involvement.  We’re talking direct exchange of data in both the read/write directions.  The human analog would be exchange of bodily fluids.   You have to talk before you do that.    You have to request that your serverside source code be decentralized, and then they  let you have access to it (via SFTP — I installed FileZilla on my Ubuntu workstation.).    Once you’re decentralized, (or unmanaged, as I prefer to think of it) Ning no longer auto updates your code when they do a new release.  I’m not quite sure just what the procedure is to upgrade once you’ve unplugged, but it sounds like it could stand some improvement.   I guess I’ll find out about that when they do a new release.  Of course you can always just recentralize.  My plan is to not tamper with the Ning provided files at all.    I have all my hackage in separate files.  If and when they upgrade I will just request to be plugged back into the matrix, at which point they will blow away all my custom stuff.  Then I will just request to be  unplugged , put my stuff all back and hope it all still works.   Unless they come up with a way to update straight from their subversion.  They don’t give us a control panel or anything.  That always comes when the project is more mature.

unpluggedUnplugged:  Free at last! I finally got my notification from Ning that the code for my network was accessible. Woot! For my first hack  I implemented the Hello World Tutorial. It is a nicely done little tutorial that explains the structure of the system.   It puts a new tab up on the network control panel.  When you click it, it opens a new screen and says Hello World.  Whoop de doo.  It was a very valuable exercise because it exposes you to the mechanics of hacking Ning without challenging your head too much with what it actually does.     Next I was on to the much more realistic next hack example, a member search.   This actually involved creating a form and sucking out the data from it.

My impressions:  I was a little disappointed with how verbose it turned out to be.  When I played with Ruby on Rails a while back, you hardly had to write any code at all.   I was especially disappointed that the example included explicit code to sanitize the data.  In my own application I had a much slicker way to do it than writing 20 lines of custom sanitization code every time you process a form.  Perhaps they were just doing it explicitly for expediency’s sake. I hope there’s some routine to sanitize the $_GET array!

The big hurdle will be mastering the query language.  Ning have their own data store wrapper around the database.  At the bottom, of course, it’s some SQL database.  But you don’t write SQL queries, especially not in a controller.   You have to query their data store in the custom language and it builds the SQL queries for you. Obviously I don’t want to learn the ins and outs of their database schema so I hope the data store schema is simple and scales.   Finally I was a little perturbed when the tutorial had me copy an identical shell into each of two templates.  Although the two copies eventually got filled up with different innards, it seems that the shell itself should have been factored.  Repeating code  is a violation of the DRY principle.  Let’s hope they just did that for expediency’s sake and there is a way to factor template code as well as controller code.   The advanced tutorial had a few mistakes in it, but one way or another I was able to straighten the code out and get it working.

Training wheels off next week!

9 comments to Dominating Ning — First Try

  • putting in open id seemed to take away the meta widget?

  • nope it’s going to full post page. Hmmm…

  • some dood

    would you be able to view the chat option without being logged into a ning network? as i have one and an ex member can view our chat? and ideas on how?

  • admin

    Sorry some dood, I don’t know. I just had too many troubles with how ning kept their secret oracle base written on java on their own servers and had a php layer of middleware and their own query language and everything had to be hosted with them. And now there are no more free ning communities.

  • John has shown incredible passion while expressing views. Thanks for the great information, I have it bookmarked

  • Hey! Great topic, but I can’t seem to open your site on my Macbook. Could your firewall block my IP? Gracias. x Libby

  • Hi! I visit your site regularly, but your site fails to display in Internet Explorer 7. Does your server block my IP address? I appreciate it. xxx Kira

  • Hey! Great topic, but I can’t seem to open your site in Internet Explorer 6. Can you help me out? Merci. 😉 Rasheeda

  • I need help!!! I want to hack into a Ning network but have no idea how to do so!!! PLEASE HELP! It’s important!!! The creators are not active and I just want to delete some people’s profiles who are ruining it for the rest of us all! HELP!!!

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.