Snipt - snipt.net
General Information:
Latest News:
Python: Examples 28 Apr 2013 | 04:52 am
>>> str = "foo"; lst = ["abra", 2038, "cadabra"] >>> for char in str: ... print char ... f o o >>> for elem in lst: ... print elem ... abra 2038 cadabra
Python: Dynamic Typing 28 Apr 2013 | 04:51 am
>>> from types import * >>> >>> def what (x): ... if type(x) == IntType: ... print "This is an int." ... else: ... print "This is something else." ... >>> what(4) This is an int. >>> >>> what("4") Thi...
Decode image to Base64 string 27 Apr 2013 | 02:58 pm
var image = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("some/path/to/image.jpg"); string imageData = String.Empty; using (var stream = await image.OpenStreamForRead...
UPDATE multiple en uno solo 27 Apr 2013 | 02:09 am
UPDATE empleados SET orden = CASE id_empleado WHEN 12 THEN 1 WHEN 254 THEN 4 WHEN 87 THEN 8 WHEN 23 THEN 14 END, edad = CASE id_empleado WHEN 12 THEN 32 WHEN 254 THEN 19 WHEN 87 THEN 43 WHEN 23 THEN 5...
SQL Sort Alphabetical Split Between 2 Columns 27 Apr 2013 | 01:22 am
/* This will create an alphabetized list, displaying the items in alternating columns. Works nice with repeater alternating template. */ DECLARE @Divisor INT SELECT @Divisor = (CASE WHEN (SELECT COU...
Javascript Array Remove - By John Resig 26 Apr 2013 | 10:51 pm
// Array Remove - By John Resig (MIT Licensed) Array.prototype.remove = function(from, to) { var rest = this.slice((to || from) + 1 || this.length); this.length = from
SQL Trusted Foreign Keys 26 Apr 2013 | 06:15 pm
/* If a (1) is returned the key is not trusted and your execution plans are not being optimized */ select name,is_not_trusted from sys.foreign_keys where is_not_trusted = 1 /* To fix the untrusted k...
Safe Submit Button 26 Apr 2013 | 06:09 pm
//http://www.codeproject.com/Tips/581356/Safe-Submit-Button
SQL Moving Database Steps and Scripts 26 Apr 2013 | 05:53 pm
-- This QUERY provides you with DB Names and Paths. SELECT DB_NAME([database_id]) AS N'database_name',[name] AS N'logical_name',[physical_name] FROM sys.master_files WHERE [database_id] > 4; /* MOVE ...
SQL Find Index Fragmentation of Objects 26 Apr 2013 | 05:46 pm
-- FIND INDEX FRAGMENTATION OF ALL OBJECTS IN DATABASE SELECT ps.database_id, ps.OBJECT_ID, ps.index_id, b.name, ps.avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NU...