background preloader

Programming

Facebook Twitter

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? Why does JSON matter? 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 Nesting JSON Data.

Distributed version control system

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. The Post-OOP Paradigm. 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.

Blog.pyjeon.com.

Javascript

Python. 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. For this reason you have to learn it. VIM is a textual editor, so you have not all bells and whistles that are so common with graphical text editors. 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. Text Processing Commands. Sort File sorter, often used as a filter in a pipe. This command sorts a text stream or file forwards or backwards, or according to various keys or character positions.

Using the -m option, it merges presorted input files. The info page lists its many capabilities and options. See Example 10-9, Example 10-10, and Example A-9. tsort Topological sort, reading in pairs of whitespace-separated strings and sorting according to input patterns. uniq This filter removes duplicate lines from a sorted file. The useful -c option prefixes each line of the input file with its number of occurrences. The sort INPUTFILE | uniq -c | sort -nr command string produces a frequency of occurrence listing on the INPUTFILE file (the -nr options to sort cause a reverse numerical sort). Example 12-8. Expand, unexpand The expand filter converts tabs to spaces. The unexpand filter converts spaces to tabs.

Cut A tool for extracting fields from files. Using cut to obtain a listing of the mounted filesystems: paste join head sed. MVC for Noobs. I/O Redirection. Java Skein 512-512. Java Here are two Java implementations of the Skein 512-512 hash algorithm. Both implementations are relatively small, and compatible with the revised (version 1.3) test vectors and reference implementation. Skein512.java is optimize for speed. 151 MB/s on a MacBook Pro, 2.53 GHz Intel Core 2 Duo; Java 1.6, server mode. Skein512Small.java is optimize for size (32 lines). Test.java and testVectors.txt (3 MB) tests for both implementations. Scala The Scala implementation is based on the small Java implementation. Test.scala and Skein512.scala. Javascript Here is a Javascript implementations of the Skein 1.3 512-512 hash algorithm. To view the source code of the implementation, click 'View' 'Page Source'. Message (hex): Result: Public Domain This algorithm and source code is released to the public domain.

Feedback For questions, improvements, or remarks, send an email to "db support" (one word) at "h2 database" (one word) dot com. Changelog Contribute a better translation.