View gist:ee8d1b904acb4ad17027ed5901be37ae
set serveroutput on size 100000; | |
declare | |
--Text to find, case insensitive. Use % for like. | |
V_TEXT varchar(50) := '%what I want to locate%'; | |
--Tables schema | |
V_SCHEMA varchar(50) := 'SCHEMA_NAME'; | |
--List of tables to skip; comma-separated or NONE | |
V_SKIP_NAMES varchar(200) := 'NONE'; | |
--Using temporary table | |
V_TEMPORARY_TABLE number := 0; |
View PostgreSQL-Search_contents.sql
DO $$ <<lookup_contents>> | |
DECLARE | |
_search VARCHAR := 'something'; --what are you looking for? | |
_limit INTEGER := 1000000; | |
_total_columns INTEGER := 0; | |
_total_read INTEGER := 0; | |
_mark INTEGER; | |
_text_columns REFCURSOR; | |
_text_column RECORD; | |
_address_columns REFCURSOR; |
View SQLServer.sql
DECLARE @search_column VARCHAR(255); | |
DECLARE @search_value VARCHAR(255); | |
DECLARE @search_type INT; /* 1: specific column 2: string columns 3: numeric columns */ | |
SET @search_column = 'SEARCHING_COLUMN_NAME'; --wrap with %% for wider search | |
SET @search_value = 'Any value'; --wrap with %% for wider search | |
SET @search_type = 1; | |
DECLARE @containing_tables TABLE | |
( |
View data_replication.sql
/* | |
Replicates all data from the remote database to the local database. The local contents are removed, all current local data is erased and not recoverable. | |
You have to set the value for @LINKED_SERVER_NAME as your local Linked Server name for the remote SQL Server instance. | |
*/ | |
print 'Starting replication...'; | |
--Control for structure alterations over the process | |
declare @CONTROL_TABLES table | |
( | |
TABLE_NAME varchar(255) NOT NULL, | |
CONSTRAINT_NAME varchar(255) NULL, |
View NumericUtils.java
/** | |
* Identify a numeric value. | |
* | |
* @param value Value to be evaluated. | |
* @param digits May use digits or not. | |
* @return True when the value is a numeric representation. | |
*/ | |
public static boolean isNumeric(String value, boolean digits) | |
{ | |
String unmarked = value; |
View TimeUtils.java
/** | |
* Formats the amount of time in a friendly way. | |
* | |
* @param millis Amount of time in milliseconds. | |
* @param nicly When the amount of time is less than 1 minute, the message will be cool. | |
* @return Friendly description of the amount of time. | |
*/ | |
public static String friendlyAmountTime(long millis, boolean nicly) | |
{ | |
long hours = TimeUnit.MILLISECONDS.toHours(millis); |
View Utils.java
/** | |
* Extract the XML content, human friendly, of the <b>JAXBElement</b> object. | |
* | |
* @param object Object JAXBElement | |
* @return XML content | |
* @throws Exception Will be thrown always when object is not a valid JAXB instance. | |
*/ | |
public static String extractXMLFromJAXBObject(Object object) throws Exception | |
{ | |
try |
View utils.js
var options = ["<option value='2'>Green</option>","<option value='1'>Red</option>","<option value='3'>Blue</option>"]; | |
options.sort(function (option1, option2) | |
{ | |
var name1 = option1.toUpperCase(); | |
var name2 = option2.toUpperCase(); | |
name1 = name1.substr((name1.indexOf(">") + 1)).substr(0, name1.substr((name1.indexOf(">") + 1)).indexOf("<")); | |
name2 = name2.substr((name2.indexOf(">") + 1)).substr(0, name2.substr((name2.indexOf(">") + 1)).indexOf("<")); | |
return name1.localeCompare(name2); |
View Utils.java
/** | |
* Orders the map entries by value. | |
* | |
* @param map Map with entries to be ordered. | |
* @return Map ordered by its value. | |
*/ | |
public static <K, V extends Comparable<? super V>> LinkedHashMap<String, String> orderedMapByValues(Map<K, V> map) | |
{ | |
SortedSet<Map.Entry<K, V>> orderedEntries = new TreeSet<Map.Entry<K, V>>(new Comparator<Map.Entry<K, V>>() | |
{ |
View Utils.java
/** | |
* Retrieves the friendly format of the number of bytes.<br> | |
* Is possible to convert it using decimal base, applying <b>International System of Units (SI)</b>, or binary system. | |
* As result you get: | |
* <ul> | |
* <li>Following SI: 1 kB, 1 MB, 1 GB, 1 TB, 1 PB e 1 EB</li> | |
* <li>Binary system: 1 KiB, 1 MiB, 1 GiB, 1 TiB, 1 PiB, e 1 EiB</li> | |
* </ul> | |
* References: | |
* <ul> |