Posts

Showing posts with the label grep

Almighty Grep

Image
Background I used to know the grep command in Linux as a powerful file searching utility. Its so powerful that it even helps search the content of files. I had a challenge today, I needed to populate a select control with the ordinals of certain numbers, precisely the number of floors in a building. Because I already have the number of floors in a public variable which is an array object, I do not wish to reach out to the server to fetch this value again, in order to save execution time; especially for end users with slower links. Solution $scope.Hostels is my public array object and it has the following structure: { "ID": 1, "ClientiD": 2, "HostelName": "sample string 3", "HostelLocationID": 4, "Description": "sample string 5", "Gender": "sample string 6", "Cordinate": "sample string 7", "Istertiary": true, "IsSecondary": true, ...