background preloader

JSON: What It Is, How It Works, & How to Use It

JSON: What It Is, How It Works, & How to Use It
This week I want to cover a topic that I feel has become an important part of any developer’s toolkit: the ability to load and manipulate JSON feeds from other sites via AJAX. Many sites are sharing data using JSON in addition to RSS feeds nowadays, and with good reason: JSON feeds can be loaded asynchronously much more easily than XML/RSS. This article will cover the following: What is JSON? We’ll also use our newfound skills with JSON at the end of this project to build a quick app that loads photos from Flickr without requiring a page refresh. What Is JSON? JSON is short for JavaScript Object Notation, and is a way to store information in an organized, easy-to-access manner. Storing JSON Data As a simple example, information about me might be written in JSON as follows: This creates an object that we access using the variable jason. Storing JSON Data in Arrays Summary Playing with JQuery Validation library | Elegant Code New job (2 weeks in), new responsibilities, new tools to play with. Amazingly (for me), one of the new tools is the JQuery Validation Library. My diving into this also coincides with ScottGu’s announcement that Microsoft is creating their own CDN for JQuery and JQuery Validation. Bad news is that this means I’m behind. That sucks. I was using JQuery MONTHS before Microsoft officially started supporting it (at least 6 months – but I’m too lazy to look it up). And you can add the JQuery Validation library like this: Note: see those end tags, great annoyance of my life, but you have to have them, you can’t do <script src=” />. Anyway, back to validation. The more I play with this library, the more I like it. Getting Started with JQuery Validation: The JavaScript Way: OK, assuming you have JQuery and the JQuery Validation library included, lets start with a simple customer form: 1: <form id="CustomerForm"> 2: <p> 3: <label for="firstNameEdit">First Name:</label> 5: </p> 6: <p> 9: </p>

The Clean Architecture Over the last several years we’ve seen a whole range of ideas regarding the architecture of systems. These include: Hexagonal Architecture (a.k.a. Ports and Adapters) by Alistair Cockburn and adopted by Steve Freeman, and Nat Pryce in their wonderful book Growing Object Oriented Software Onion Architecture by Jeffrey Palermo Screaming Architecture from a blog of mine last year DCI from James Coplien, and Trygve Reenskaug. Though these architectures all vary somewhat in their details, they are very similar. Each of these architectures produce systems that are: Independent of Frameworks. The diagram at the top of this article is an attempt at integrating all these architectures into a single actionable idea. The Dependency Rule The concentric circles represent different areas of software. The overriding rule that makes this architecture work is The Dependency Rule. Entities Entities encapsulate Enterprise wide business rules. Use Cases Interface Adapters Frameworks and Drivers. Conclusion

Why Arc Isn't Especially Object-Oriented There is a kind of mania for object-oriented programming at the moment, but some of the smartest programmers I know are some of the least excited about it. My own feeling is that object-oriented programming is a useful technique in some cases, but it isn't something that has to pervade every program you write. You should be able to define new types, but you shouldn't have to express every program as the definition of new types. I think there are five reasons people like object-oriented programming, and three and a half of them are bad: Object-oriented programming is exciting if you have a statically-typed language without lexical closures or macros. I personally have never needed object-oriented abstractions. Maybe I'm just stupid, or have worked on some limited subset of applications.

jQuery Enlightenment | by Cody Lindley | 1st Edition | based on jQuery 1.3.2 Architecture Patterns Introduction | US Treasury Architecture Development Guidance (TADG) | IBM Patterns for e-Business | Some Pattern Resources This chapter provides guidelines for using architecture patterns. Introduction Patterns for system architecting are very much in their infancy. They have been introduced into TOGAF essentially to draw them to the attention of the systems architecture community as an emerging important resource, and as a placeholder for hopefully more rigorous descriptions and references to more plentiful resources in future versions of TOGAF. They have not (as yet) been integrated into TOGAF. Background A "pattern" has been defined as: "an idea that has been useful in one practical context and will probably be useful in others" [Analysis Patterns - Reusable Object Models]. In TOGAF, patterns are considered to be a way of putting building blocks into context; for example, to describe a re-usable solution to a problem. Content of a Pattern Name Problem Context Forces Solution Resulting Context

Python to Javascript translation I'm currently doing a project with a backend in Python and a client mostly in Javascript -- still not public, but if everything turns out right I'll post about it later on -- and there are some algorithms I'd like to reuse in both, but without going to a full Python in browser style (such as Pyjs or brython)... Ideally I'd like something like Coffescript (but with a Python-like syntax so that a subset of Python can be used for both Python and Javascript generation). -- Sidenote: I decided I really have to grasp Javascript in order to find out how things work before trying an alternative language which compiles down to Javascript -- so far my experience has been nice.

60+ .NET libraries every developer should know about. Every good developer knows never to re-invent the wheel, especially if there is software out there that has been tested by others, and has an established track record. As a developer using the .NET framework I’ve found some of these libraries invaluable, so I’m sharing them for some of the other dev’s out there with a brief outline of how to use. Yedda Twitter Library. URL: I’ve used this on a number of very simple twitter projects, where I’ve just needed to send an update. Dim objYedda As New Yedda.TwitterDim status as StringDim strTwitterUser as String = “username”Dim strTwitterPassword as String = “password”status = “Hello World”objYedda.Update(strTwitterUser, strTwitterPassword, strStatus, Yedda.Twitter.OutputFormatType.RSS) This small section of code will update your Twitter stream (provided you have a reference to the DLL), and your username and password correct. FileHelpers Library URL: Elmah Ajax

Design Patterns In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Uses of Design Patterns Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Often, people only understand how to apply certain software design techniques to certain problems. In addition, patterns allow developers to communicate using well-known, well understood names for software interactions. Creational design patterns These design patterns are all about class instantiation. Structural design patterns These design patterns are all about Class and Object composition. Behavioral design patterns Criticism

VI tutorial for beginners Overview and main commands There are so many text editors on *nix systems, but VI is surely the most widespread. VI stands for VIsual editor and VIM is an improved version of VI. You can find VI in any Linux distribution, in Unix and Mac Os X systems. 1) command mode 2) row editing mode 3) input mode To run VI, open a Terminal window and type 'vi something'. 1) vi myfile (you are creating the myfile file) 2) press 'a' to enter input mode and type 'this is a simple text file' 3) now press ':' to enter row editing mode and type 'w!' You can move from input mode to command mode or from row editing mode to command mode by pressing the Esc key. Main command mode commands Main row editing mode commands :w -> write the file :w myfile -> write the file as 'myfile' :q -> quit the file :wq -> write and quit the file :q! (Page 1 of 1) Index DISCLAIMER: Any named products on this website are copyright © and/or trademarks ® of their respective companies.