working on it ...

Filters

Explore Public Snippets

Sort by

Found 17k snippets matching: disco

    public by DinhoPutz modified Jan 30, 2019  45  0  3  0

    Como obter o espaço em disco ocupado por cada tabela do Banco de Dados

    Como obter o espaço em disco ocupado por cada tabela do Banco de Dados O código abaixo retorno espaço em disco ocupado por cada tabela do banco de dados em em execução.
    SELECT
        t.NAME AS Entidade,
        p.rows AS Registros,
        SUM(a.total_pages) * 8 AS EspacoTotalKB,
        SUM(a.used_pages) * 8 AS EspacoUsadoKB,
        (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS EspacoNaoUsadoKB
    FROM
        sys.tables t
    INNER JOIN
        sys.indexes i ON t.OBJECT_ID = i.object_id
    INNER JOIN
        sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
    INNER JOIN
        sys.allocation_units a ON p.partition_id = a.container_id
    LEFT OUTER JOIN
        sys.schemas s ON t.schema_id = s.schema_id
    WHERE
        t.NAME NOT LIKE 'dt%'
        AND t.is_ms_shipped = 0
        AND i.OBJECT_ID > 25
        AND P.rows > 0
    --     and t.NAME like 'PEC_pre%'
    GROUP BY
        t.Name, s.Name, p.Rows
    ORDER BY
        EspacoTotalKB DESC

    public by cghersi modified Apr 3, 2013  3205  1  5  0

    BATCH MS-DOS: Simulate network disconnection

    This command can be used to simulate a broken network connection towards a particular IP. In the example, 10.0.2.4 is the IP that we want to break the connection with; 10.0.3.52 is another IP of a physical machine present in the LAN.
    rem break the connection
    route add 10.0.2.4 mask 255.255.255.255 10.0.3.52
    
    rem re-establish the connection
    route delete 10.0.2.4

    public by DavidEGrayson modified Apr 12, 2016  2528  0  3  0

    This is a copy of https://meta.discourse.org/t/certain-info-strings-on-fenced-code-blocks-break-formatting-between-the-blocks/42467

    This is a copy of https://meta.discourse.org/t/certain-info-strings-on-fenced-code-blocks-break-formatting-between-the-blocks/42467: discourse_fence_bug.md
    I just encountered a bug while I was writing a post on a Discourse-powered forum and would like to report it.
    
    It seems like if I have two fenced code blocks with an info string of "{.cpp}", where each block starts with a line equal to "\`\`\`{.cpp}" and ends with a line equal to "\`\`\`", then any text formatting between the two blocks of code does not work at all, and we see the markup instead of seeing nicely-formatted text.  See below for an example:
    
    ```{.cpp}
    // Here is a block of C++ code.
    ```
    
    For some reason we cannot have `monospace`, _italic_, **bold**, or [link](https://example.com) text in this paragraph, which is between two blocks of C++ code.  In fact, I can't find any other Markdown, BBCode or HTML that does work in this area.
    
    We can't even have multiple paragraphs.
    
    ```{.cpp}
    // Here is a second block of C++ code.
    ```
    
    A workaround for this is to remove the `{.cpp}` info string on the first code block, but of course that destroys the code highlighting in that first block.  I couldn't find any better solution even though I tried info strings of ".cpp", "cpp", and "c++".
    
    I made a [copy of this post as a Gist](https://gist.github.com/DavidEGrayson/05e71787bd36139f59088f59101a04a5) so you can see the markup I used and verify that it works correctly in GitHub-flavored Markdown.
    
    --David
    
    

    public by romych78 modified Jan 30, 2015  1831  3  6  0

    Linux shell processes discovery

    // to show processes which blocking files on file system (in the example filter by specific value)
    
    lsof -n | awk '/sess_/'
    
    // what processes doing right now
    
    ps -e -o pid,comm,wchan=WIDE-WCHAN-COLUMN  
    
    // more details about some process with PID, for example, 10406
    
    strace -p 10406

    public by papershredder432 modified Dec 20, 2017  259  0  4  0

    Error for Discord Bot

    (node:8748) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of null at CommandMessage.run (C:\Users\Ulti\Desktop\Misc\AngelicGaming\node_modules\discord.js-commando\src\commands\message.js:230:28) at at runMicrotasksCallback (internal/process/next_tick.js:115:5) at process._tickCallback (internal/process
    const commando = require('discord.js-commando');
    class EightBallCommand extends commando.Command {
        constructor(client) {
            super(client, {
                name: '8ball',
                group: 'random',
                memberName: '8ball',
                description: 'Ever hear of an 8-Ball? Well that is what this command is.'
            });
        }
        async run(message, args) {
            var answers = [
                'Yes.', 'No.', 'Possibly.', 'Maybe.', 'Never.', 'Of course.', 'Reply hazy try again.'
            ];
            var answers = answers[Math.floor(Math.random() * answers.length)];
            message.reply(answer.toString())
            if(message.content === ""){
                bot.reply('There is nothing you are asking! Try again but ask a question this time')
            }
        }
    }
    module.exports = EightBallCommand;

    public by cghersi modified Mar 18, 2014  2722  1  7  1

    How to detect the current IP addresses of local machine in Java

    This method checks the local network interfaces to discover the actual IP address associated, trying to skip the bogus addresses (localhost, virtual ones, etc.)
    private static ArrayList<String> retrieveLocalIPs(){
    	ArrayList<String> defaultStr = new ArrayList<String>(); 
    	try{
    		Enumeration<NetworkInterface> ni = NetworkInterface.getNetworkInterfaces();
    		while(ni.hasMoreElements()){
    			NetworkInterface currni = ni.nextElement();
    			if (!currni.isLoopback() && 	// no loopback addresses or interfaces
    				!currni.isVirtual() && 		// no virtual network interfaces
    				currni.isUp()) { 			// only active network interfaces are considered here
    				Enumeration<InetAddress> addresses = currni.getInetAddresses();
    				while(addresses.hasMoreElements()){
    					InetAddress address = addresses.nextElement();
    					if (!address.isLoopbackAddress() && 	// no loopback addresses here, please
    						!address.isMCSiteLocal() && 	  	// no multicast addressed	
    						(address.getHostName() != null) &&	// hostname should not be null        						        						
    						(address instanceof Inet4Address)) { 	  // only ipv4 addresses	    					
    						
    						//ok, we got the address: not we have to check if it is well formed:        					
    						if(address.toString().contains("/")){
    							/* address is something like mypc.domain/10.0.1.45, 
    							 * therefore we have to extract only the IP address: 
    							 */
    							String str2add = address.toString().split("\\/")[1];
    							if (validateIPv4Address(str2add)) {
    								defaultStr.add(str2add);
    							}else{
    								log.warn("skipping bogus ipv4 address " + str2add);
    							}
    						}else{								
    							if (validateIPv4Address(address.toString())) {
    								defaultStr.add(address.toString());
    							}else{
    								log.warn("skipping bogus ipv4 address " + address.toString());
    							}								
    						}
    					}	    				
    				}
    			}
    		}
    	}catch(Exception ex) {
    		return null;
    	}
    	return defaultStr;
    }
    
    private static boolean validateIPv4Address(String ipAddress) {
    	String[] parts = ipAddress.split( "\\." );
    
    	try{ 
    		if (parts.length != 4)
    			return false;
    
    		for (String s : parts) {
    			int i = Integer.parseInt(s);
    
    			if ((i < 0) || (i > 255)) 
    				return false;
    		}
    	}catch(Exception er){
    		return false;
    	}
    	return true;
    }

    public by marksimon232 modified Jan 24, 2015  2557  1  5  2

    SQL SERVER 2012

    Am migrating sql server 2005 to sql server 2012 . what are all the changes need to be done in stored procedures/ discontinued features in 2012?.Thanks in advance.
    The simplest solution I see is just do follows;
    
    In General guide for upgrading the database.
    
        1) Run upgrade advisor on the databases for the instance you want to upgrade.
        2) If any issues found, talk to your dev team/ Vendor for fixing the same.
        3) If issues fixed proceed with the actual upgrade. -- Do check for the other dependencies on the database which might effect the functionality if the instance gets upgraded or something like that.
        4) Get the downtime for the database.
        5) create a latest full backup of the database -- any other strategy will also work, just make sure you can recover the database.
        6) take a clone of the server if its a virtual server to roll back any changes.
        7) run the upgrade on the sql 2005 instance from the 2012 set up. -- do check the pre-requirements for upgrade to sql 2012.
        8) If everything fine then you have a upgraded instance.
        9) also check the compatibility of the databases.
        10)if all fine then congrats you have upgraded your sql server instance.
    
    When you migrating to SQL 2012, this points needs to be consider first.
    
    - Using the SQL 2012 Upgrade Advisor
    - Reviewing the “breaking changes” section in the Books Online
    - Reviewing the “behavioral changes” section in the Books Online
    - Executing DBCC CHECKDB WITH DATA_PURITY (DBCC CHECKDB WITH DATA_PURITY;)
    - Executing DBCC UPDATEUSAGE command (DBCC UPDATEUSAGE(db_name);)
    - Updating statistics (USE db_name; GO EXEC sp_updatestats;) with full scan (USE db_name; GO EXEC sp_MSforeachtable @command1='UPDATE STATISTICS ? WITH FULLSCAN';)
    - Refreshing your views using sp_refreshview
    - Taking backups
    - Upgrading your hardware (As SQL Server 2012 does not support AWE)
    
    Upgrades are a necessary part of any development lifecycle. The chances of having a successful upgrade increases along with the amount of planning and preparation you invest in building a proper upgrade process.
    

    public by paulsimmons modified Mar 30, 2017  1079  0  5  0

    Magento Follow Up Emails Extension

    Magento Follow Up Email is a complete extension developed by FMEAddons that allows store owners to integrate and advance email marketing system in their online store based on Magento. With the help of this powerful extension, they can send emails after occurring of different events such as new order completion, Cart abandonment, Birthday, Christmas
    // Enter here the actual content of the snippet.                        

    public by paulsimmons modified Apr 4, 2017  1040  0  5  0

    WooCommerce Variable Pricing Plugin by FMEAddons

    If you want to convert potential customers to successful business leads, then WooCommerce variable pricing extension is a powerful tool for achieving this goal. This addon provides you an easy interface to offer bulk discounts on various sections on your website. You can give a special offer to your customers such as buy three products and get one
    // Enter here the actual content of the snippet.            

    public by Nyx modified Jun 29, 2018  459  3  4  0

    Ectoplasm Roles

    Ectoplasm Roles we use in our server! | https://discord.gg/Wv8YcgM
    https://discord.gg
    https://discord.gg/Wv8YcgM
                   Ectoplasm
                  
                   Executive Officer
                   Manager
                   Officer
                   Trial Officer
                   Event Manager
                   Chill Bots
                   Event Winner
                   
                   Hibernator  Lvl. 70
                   Dreamer     Lvl. 50
                   Lounger     Lvl. 40
                   Chiller     Lvl. 30
                   Settler     Lvl. 20
                   Relaxer     Lvl. 10
                   Rester      Lvl. 05
                   
                   Trusted 
                   New Ectoplasm
    • Public Snippets
    • Channels Snippets