Subscribe: Planet IM
http://www.planet-im.com/rss20.xml
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
add  author  code  collection  erlang  exprecs  hosted  json  line  push  record  records  result store  result  service  user  xmpp 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Planet IM

Planet IM



Planet IM - http://planet-im.com/



 



Justin Kirby: exprecs, making json usable.

Tue, 08 Nov 2011 15:20:24 +0000

Erlang and Syntax Many flames have been ignited over erlang’s syntax. Erlang as a system is exceptional; easy concurrency, clustering and OTP design principles to name just a few. However, its syntax has a lot to be desired. There are minor annoyances, like the comma (“,”), period (“.”) and semicolon (“;”), which make diffs larger and harder to read than they should be, and cause irritating compile errors after a quick edit. A simple contrived example: add(First, Second) -> Result = First + Second. Now if you want to store the result add(First, Second) -> Result = First + Second, store_and_return(Result). And now there is a two line diff, instead of one: --- add1.erl 2011-09-20 11:19:18.000000000 -0400 +++ add2.erl 2011-09-20 11:20:34.000000000 -0400 @@ -1,2 +1,3 @@ add(First,Second) -> - Result = First + Second. + Result = First + Second, + store_and_return(Result). This is a minor nuisance, but the number of times I have forgotten to change a period to a comma approaches infinity. Records While I lack a rigorous statistical analysis, you would be hard pressed to find an erlang programmer who enjoys records. Records are essentially syntactic sugar on top of tagged tuples. This sugar does not taste good. Defining records is easy and straight forward: -record(poetry, { style :: string(), line :: string(), author :: string() }). However, using them is another story. vogon_example() -> #poetry{style = "vogon", line = "Oh freddled gruntbuggly/thy micturations are to me/As plurdled gabbleblotchits on a lurgid bee.", author = "Jeltz" }. echo_poem(Poem = #poetry{}) -> io:format("~s~nby ~s",[Poem#poetry.line,Poem#poetry.author]). The need to specify the record type on a variable before using the element accessor can lead to some fairly ugly code contrived(Collection) -> %% in R14 you do not need the parens (Collection#collection.vogon)#poetry.author. If the need to specify the record type was removed you could do contrived(Collection) -> Collection.vogon.author. Which looks much cleaner. However, ugly syntax is a trivial annoyance and is primarily a subjective aesthetic concern. The need to specify the record type is a more pragmatic problem. Writing generic code that consumes records conforming to a pattern or interface is impossible. While it is true that erlang:element/2 can be used to access records as tuples, the usability of named fields is lost. If the record definition is changed, your code that uses erlang:element/2 may break in interesting ways. (note: that is not a Good Thing[tm]) exprecs to the rescue I stumbled onto an interesting chunk of code by Ulf Wiger called exprecs. Exprecs is a parse transform that allows you to work magic, freeing your code from the constraints of the erlang record while still maintaining the benefits derived from named fields. At this point it may be beneficial for you to read over the exprecs edoc. To make things simple I have generated the edoc html. Go have a quick read, I will wait. … While it doesn’t remove the need to scatter # all over your code, exprecs does enable the ability to treat records as discoverable and fungible entities. This opens the door to more generic and reusable code. The Problem I have written a lot of erlang code dealing with json, primarily in REST interfaces built with webmachine. The json validation and parsing into erlang terms is made extremely easy thanks to mochijson2. mochijson2 has a lot of benefits: roundtrips are consistent, json strings are parsed to erlang binaries and a single line of code is generally all you need. However, I do find the resulting erlang terms produced by mochijson2 to be confusing and difficult to remember. Recursing down a proplist tree is not my most favorite activity and one can easily get lost in large data structures. This makes changing[...]



Artur Hefczyc: Tigase Command Line Management Tool announcement

Wed, 02 Nov 2011 20:28:58 +0000

TCLMT is new utility to manage XMPP servers by execution of ad-hoc commands. It's designed to be simple and powerful in use and work in two modes:

  • non interactive
  • interactive

Currently it partially supports ad-hoc commands which are specified in XEP-0133 Service Administration and implemented by Tigase XMPP Server. As for it contains support for:

  • 4.1. Add user
  • 4.2. Delete user

read more




Process One: hosted.IM: user authentication against your company database

Thu, 27 Oct 2011 15:18:11 +0000

Hosting.IM, the leading Cloud-based Instant Messaging service by ProcessOne, has extended further its user management integration features for larger companies. Please read about this new service below.

A common feature requested by many hosted.IM customers is the ability to authenticate users according to a pre-existent company database. Since then, we have implemented the possibility to authenticate against your POP3 or IMAP server. However it requires that your instant messaging domain name matches the domain from your e-mail addresses.

Several companies already have an intranet authentication backend, like LDAP, Active Directory or an Ad-Hoc database. On the other hand our experience with large sized companies is that is not a good idea to expose LDAP or Active Directory to the internet.

To overcome this problematic scenario we have added a new authentication method, which consists on delegating the authentication to an external REST API, acting as a façade to your own intranet database.

The behaviour expected by hosted.IM is fairly straightforward. Your API must answer a GET query with details about the user that is trying to authenticate to your IM domain with 'true' or 'false' depending on whether the user is authorized or not.

In the image below we see how mydomain.com administrator sets https://mydomain.com/auth as the REST URL and clicks on the highlighted Verify your service link to ensure hosted.IM is able to contact it:

(image)

The next step would be to click on the 'Switch' button and that's all!. Now hosted.IM will authenticate users against your company data source.

Below is the specification of the authorization API:

URLConfigured on hosted.IM user administration form. Could be HTTPS (recommended) or HTTP
MethodGET
ParametersusernameUsername part of the user ID to be validated
passwordPassword sent by the user to be validated
domainDomain part of the user ID to be validated
secretArbitrary string defined on hosted.IM user administration form
Expected replyCode200 OK
Content-typeapplication/json
Bodytrue if authorized; otherwise false
ErrorCodeAny HTTP code, according to the error type. It will deny user access.

This release also includes other improvements suggested by our users. It contains also bug fixes.

As we continue improving daily our service, we will greatly welcome your feedback. There is already much more to come soon. Thank you!

Links:




Process One: ProcessOne webinar: XMPP-based Push Solutions

Fri, 21 Oct 2011 14:13:20 +0000

ProcessOne is holding a webinar about push solutions, based on XMPP and ejabberd.

XMPP is widely used as a push protocol for sending alerts and messages. It is at the heart of Apple Push Notification Server (APNS), Google Cloud to Device Messaging (C2DM), Nokia Notifications API and many other solutions like BBC radio notification system.

(image)

This presentation explains what is the use of XMPP in those solutions and how XMPP can be use to do much more that chat systems.

You will also learn how can ProcessOne help making realtime notifications, alerting and push a part of your business?

When?

Wednesday, November 9, 2011

  • 06:00 PM - 07:00 PM - CET - Paris, Brussels, Berlin
  • 12:00 AM - 01:00 PM - EDT - New York, Montreal
  • 09:00 AM - 10:00 AM - PDT - San Francisco, Los Angeles

Register!

You need to register now in order to attend the webinar:

We hope to see you in great numbers!