Community Blogs

Browse by Tags

Related Posts

  • Converting Data Table / Dataset Into JSON String

    JSON ( J ava S cript O bject N otation), is a light weight, easily understandable to read and write string. It is also easily parse-able by machine. JSON is introduced on two structues A collection (key/value pair) And ordered list of values. I have not covered this topic in detail. Detailed analysis is stated on http://www.json.org/ . I am presenting a helper function (in C#) for developers for fast parsing on datatable / dataset into JSON String, and access it on client-side. public static string GetJSONString( DataTable Dt) { string [] StrDc = new string [Dt.Columns.Count]; string HeadStr = string .Empty; for ( int i = 0; i < Dt.Columns.Count; i++) { StrDc[i] = Dt.Columns[i].Caption; HeadStr += "\"" + StrDc[i] + "\"...


  • My own small .NET Micro Framework Web Server

    While developing my small Ajax.NET M! library for creating Web applications that run on the .NET Micro Framework I have started to write my own Web server. Some years ago I wrote a simple SMTP/POP server and using some code from there was a great help. The first version will only return static HTML pages e.g. for documentation or help files. As there is no file system on those devices I use the embedded resource strings to return the content. MS.Micro.WebServer srv = new MS.Micro.WebServer(80); srv.Assembly = "MFConsoleApplication1" ; srv.StartPage = "default.aspx" ; // well, it is a fake, of course srv.Start() To find the correct embedded resource string the name of the resources have to follow a very simple syntax. If you...


  • Ajax.NET M! - The .NET Micro Framework AJAX Library

    The embeddedworld2008 is over and I had some time to play around with Microsoft .NET Micro Framework devices. I can remember that I had a look on it during the first available betas on Microsoft Connect, but then stopped watching it because of the missing TCP/IP stack. The now available version 2.5 of the .NET Micro Framework adds this directly in the framework. Other device manufactures have implemented their own TCP/IP stack, and such a device I have bought at the embeddedworld2008. Today I'd like to announce that I have ported my well known AJAX library Ajax.NET Professional ( AjaxPro ) to the .NET Micro Framework: here is Ajax.NET M! . Wow, I love to see one of my first Web applications running on a small network device (I'm currently...


  • LINQ to JSON

    James has published a first beta of LINQ to JSON support in his Json.NET library . It looks very similar to my LINQ support in an internal build of Ajax.NET Professional which never has been released.   List < Post > posts = GetPosts(); JObject rss = new JObject( new JProperty( " channel " , new JObject( new JProperty( " title " , " James Newton-King " ), new JProperty( " link " , " http://james.newtonking.com " ), new JProperty( " description " , " James Newton-King's blog. " ), new JProperty( " item " , new JArray( from p in posts orderby p.Title select new JObject( new JProperty( " title " , p.Title), new JProperty( " description...


  • Yahoo! Pipes - Rewire The Web

    Recently I've discovered a fantastic free service provided by Yahoo! which makes it possible to convert any XML data feed into a JSON data feed. http://pipes.yahoo.com/pipes/ It is easy to create a pipe that provides a JSON data feed with a callback function for web services that don't actually implement that functionality in their API. This allows me to completely eliminate my xml2json generic handler in my mashups. Now I can create web applications that combine data from multiple public data sources without creating anything on the server. I've cut ASP.NET completely out of the picture! I was not very happy with that local web service requirement for my help files. Technically, I'm now relying on Yahoo servers to provide helper services that...


  • I Pounce On The Pownce API

    The microblogging site http://www.pownce.com/ has opened to the general public so I decided to give their API a try. But the main point of this blog post is to dispute the assertion that JSON is " easy for humans to read and write ". It is not easy to read! JSON is a mess of curly braces, brackets, and quoted strings that is even more difficult to read than XML. I had considerable trouble working with the JSON data that Pownce provides because it seems to be nonstandard and requires the use of array indices which aren't usually needed. At first I tried to determine the data's object model by loading the XML version into XML Spy and finding the XPaths for a value. This was only slightly useful. Then I found a JSON Viewer on CodePlex which proved...


  • ICallback and JSON-Based JavaScript Serialization

    FYI: sample code is attached @ the end When working in ASP.NET, sometimes you need to call server-side methods asynchronously without having either full-page or partial-page postback. Thanks go to the ASP.NET team to provide an easy implementation of ICALLBACK. ICALLBACK ICALLBACK is a lightweight process. It uses a well-known XMLHTTP object internally to a call server-side method. It doesn't cause page postback, so it doesn't cause page rendering. You show output at the client side, so you need...( read more ) Read More...


  • Amazon Wish List In JSON

    Today I explored some alternative JavaScript coding methods to make it easier to dynamically create DOM elements. I used jQuery and the jQuery Plugin, FlyDOM , to work with the Amazon web service API. I bought the book Amazon.com Mashups by Francis Shanahan from the Computer Books Direct club which is closing and selling books cheap. I have not read the book yet but there is a chapter on converting Amazon data directly into JSON using XSLT (hmm, interesting) and it actually covers several other APIs and the technology behind mashups. There was some mention of Amazon wish lists which attracted my attention because I use wish lists to save books that I come across which I may want to buy some day. In other words, this is personal data that I am...


  • Dates and JSON

    JSON is a great data format and it's taken the Internet by storm for a number of good reasons. But because of a strange oversight in the EcmaScript specs , there is no standard way of describing dates in JSON . There's been a lot of discussion on this topic and it still remains a problem today. In the Microsoft Ajax Library , we've tried a number of different approaches before we converged to the solution we're using today. The first thing we tried was to inject Date constructors in the JSON string. This is a (very) bad idea for a number of reasons. First, it simply does not conform to the JSON specs . Second, any JSON parser that validates its input before parsing it will cough on such a thing. Finally, it establishes a precedent: why would...


  • Developing Web Widgets

    Last night I finally finished the improvements to my xml2json generic handler which were required to develop a Stickam widget. Since I am sending the URL of the feed as a query string value to the generic handler it was necessary to deal with ampersands in the feed's URL without screwing up the query string. So I added a line to replace the | character with the & character. If I have a feed with an ampersand in the URL I'll just send it with the | character instead. Trace listeners don't seem to work in generic handlers so I added code to write the feed URL and the JSON string to a log file for debugging purposes. The Stickam players in the XML were causing invalid JSON syntax because they were not getting null values. I am not interested...


Page 1 of 4 (40 items) 1 2 3 4 Next >
Page view counter