Tag Archives: programming

GZip compression and decompression in C#

The snippets below illustrate GZip compression and decompression using the GZipStream classes.

Posted in C# | Also tagged , , , , , , , , , , | Leave a comment

Using PhantomJS to request a web page

PhantomJS is a very nice headless browser which uses the WebKit browser engine. It can be used for many purposes. However, I’m going to illustrate PhantomJS by performing a Bing search query and also executing JavaScript code on the page. Libraries such as jQuery can be injected into the page to perform all kinds of [...]

Posted in Bash, JavaScript | Also tagged , , , , , , , , , | Leave a comment

Parsing (X)HTML into a DOM tree in C#

As a quick alternative to the Html Agility Pack, HTML can be parsed into a DOM tree using the built-in XmlDocument class. The following snippets illustrate HTML parsing in C#.

Posted in C# | Also tagged , , , , , , , , , | Leave a comment

Alphanumeric/natural sorting in C# using IComparer

These snippets illustrate the natural sorting order. Suppose you’re using numbers within your file names. For example: file1.png file2.png … file10.png file11.png file12.png You’d expect to see them in the above order. However, A�they are (by default) sorted as follows. file1.png file10.png file11.png file12.png file2.png …

Posted in C# | Also tagged , , , , , , , | Leave a comment

(JavaScript) Augment Storage Prototype with getObject, setObject

Provides getter/setter functionality for objects in local storage. Utilizes JSON.stringify and JSON.parse.

Posted in JavaScript | Also tagged , , , , , , | Leave a comment

(C#) C# LINQ & Extension method continued

Also extended C# LINQ and Extension method (simple) to include the last (MAX) Date Created property, added a new Folder class (model) with properties and included them in a List. Also, amended the LINQ statement to get the MAX(Date Created) .

Posted in C# | Also tagged , , , , | Leave a comment

Play a movie in fullscreen (Objective-C)

Hi, In reply to http://snipd.net/objective-c-play-a-video-in-full-screen#comment-290 .A�The following snippets show how to play a movie in fullscreen.

Posted in Objective-C | Also tagged , , , , , , | Leave a comment

(Java) Operational System Validator

Check which operating system the program is running. The program explains itself.

Posted in Java | Also tagged , , , , | Leave a comment

(PHP) PHP Miles to Latitude and Miles to Longitude Converter

There are tons of functions out there to calculate the distance between two points, but what if you know one point and want to calculate the latitude (“vertical”) or longitude (“horizontal”) equivalent of a fixed distance, in miles? An example application would be in generating a minimum & maximum latitude and longitude bounding box around [...]

Posted in PHP | Also tagged , , , | Leave a comment

(Java) Java inheritance example

This example demonstrates advanced object-oriented concepts including inheritance, getters/setters, method overloading and reflection.

Posted in Java | Also tagged , , , , , | Leave a comment