Snipd - snipd.net - Snipd
General Information:
Latest News:
Using Parallel LINQ (PLINQ) in C# 9 Dec 2012 | 10:55 pm
The snippets below illustrate Parallel LINQ by crawling a web page in parallel. The Crawler class is responsible for crawling a web page (only one level deep) and returning a list of documents. The Do...
GZip compression and decompression in C# 9 Dec 2012 | 09:27 pm
The snippets below illustrate GZip compression and decompression using the GZipStream classes. GZip class using System; using System.IO; using System.IO.Compression; namespace GZipExample { public cla...
Using PhantomJS to request a web page 9 Dec 2012 | 06:00 pm
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 ...
Parsing (X)HTML into a DOM tree in C# 9 Dec 2012 | 05:45 pm
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#. The main program using S...
Alphanumeric/natural sorting in C# using IComparer 9 Dec 2012 | 05:12 pm
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 i...
(JavaScript) Augment Storage Prototype with getObject, setObject 30 Nov 2012 | 07:50 am
Provides getter/setter functionality for objects in local storage. Utilizes JSON.stringify and JSON.parse. if (window.Storage) { Storage.prototype.setObject = function(key, value) { this.setItem...
(C#) C# LINQ & Extension method continued 10 Oct 2012 | 07:40 pm
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 LIN...
Play a movie in fullscreen (Objective-C) 6 Oct 2012 | 04:00 pm
Hi, In reply to http://snipd.net/objective-c-play-a-video-in-full-screen#comment-290 . The following snippets show how to play a movie in fullscreen. PlayerView.h // // PlayerView.h // // Created by F...
(Java) Operational System Validator 5 Oct 2012 | 09:50 pm
Check which operating system the program is running. The program explains itself. public class OSValidator { public static boolean isWindows() { String os = System.getProperty(...
(PHP) PHP Miles to Latitude and Miles to Longitude Converter 1 Sep 2012 | 08:10 am
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”) equivalen...