Showing posts with label info dump. Show all posts
Showing posts with label info dump. Show all posts

Monday, July 17, 2017

Walkthrough on writing a complex if function

Say that from this sample data of a 538 field from video game records, you're only supposed to remove "System requirements" from the entries with a video game console:

System requirements: Nintendo 64
System requirements: Nintendo 64
System requirements: Nintendo 64; designed for N64 Rumble Pak
System requirements: PlayStation 2
System requirements: PlayStation 2
System requirements: Windows 95/98; 133MHz Pentium or faster processor; Windows 95/98; 64MB RAM; Microsoft DirectX 6.0 (included); quad speed CD-ROM drive; PCI or AGP graphics card; 4MB 3D accelerator for 3D graphics support (optional); 16-bit sound card; keyboard and mouse; joystick (optional); gamepad (optional)
System requirements: PlayStation 2
System requirements: PlayStation 2, memory card (for PS2) 94 KB
System requirements: PlayStation 2
System requirements: Nintendo 64. Designed for N64 Rumble Pak
System requirements: Nintendo Entertainment System
System requirements: Windows 98SW/ME/2000/XP; Pentium III 800 MHz or faster; 256 MB RAM; ; 2.5 GB free hard disk space; 32 MB hardware T&L compatible video card; Windows compatible sound card; DirectX version 9.0c (included) or higher;  8x or faster CD-ROM drive
System requirements: PlayStation 2, memory card (for PS2) 177 KB

Thursday, July 6, 2017

Tutorial on objects and the cell.recon object


What's an object?
You've probably seen this wiki page when trying to access the deeper reconciliation fields in Open Refine:

https://github.com/OpenRefine/OpenRefine/wiki/Variables

This is a pretty confusing page, so let me give a little background about objects. An object is a programming language structure that's basically a container for a bunch of other things, including other objects. The object itself cannot be manipulated, but everything contained in that object can.
Open Refine has a master object and then either objects or fields contained within it.

A field will either yield a string, a boolean, a null, a number, or it will have deeper fields.

Monday, July 3, 2017

Introduction to loops and forRange tutorial with variable data

Problem : I have a column of cells with variable date ranges:
1907-1913
1910-1911
1908-1911
etc.

The cells have to be converted to:
1907; 1908; 1909; 1910; 1911; 1912; 1913
1910; 1911
1908; 1909; 1910; 1911

etc.

Open Refine can be used to convert this. Using add column based on this column, you would use the following GREL command:

forRange(toNumber(substring(value, 0,4)), toNumber(substring(value, 5,9)) + 1, 1, currentYear, currentYear).join("; ")


Yes, it looks daunting. But let's break it down, starting with the forRange command:

Introduction to Arrays

Update 7/28/17: I've fixed up this post because when I first wrote it, I didn't realize what Open Refine's convention was for naming arrays.

You've probably heard a lot about arrays when working with Open Refine, but what exactly is it?

First of all, I need to explain how software computing works before I can explain the array functionality. When any sort of software needs to process data, it has to break it down into chunks that it can understand. The chunks are in the computer's equivalent of headspace -- much like when you're trying to figure things out in your head.

However, a computer can only process data using certain structures. There are several of these data structures, but I'm just going to cover the array.