working on it ...

Filters

Explore InChannel Snippets

Sort by

Found 500 snippets

    public by IsCODER modified Monday at 11:09:57 AM  33  0  2  0

    Bubble sort in C

    C programming basic by Isfatul Karim
    #include<stdio.h>
    /*
      *Bubble sort
      *Isfatul Karim
    */
    int main()
    {
    	int n;
    	printf("Enter size of array: ");
    	scanf("%d",&n);
    	int l;
    	int data[n];
    	printf("Enter array elements: ");
    	for(l=0;l<n;l++)
    	{
    		scanf("%d",&data[l]);
    	}
    	int i,j;
    	for(i=0;i<n;i++)
    	{
    		for(j=i+1;j<n;j++)
    		{
    			if(data[i]>data[j])
    			{
    				int temp=data[i];
    				data[i]=data[j];
    				data[j]=temp;
    			}
    			else
    			{
    				continue;
    			}
    		}
    	}
    	printf("After bubble sort: \n");
    	for(l=0;l<n;l++)
    	{
    		printf("%d ",data[l]);
    	}
    	return 0;
    }
               

    public by paulsimmons modified Mar 16, 2017  38  0  2  0

    WooCommerce Ajax Product Filter by FMEAddons

    Ajax Product filter WooCommerce plugin by FMEAddons allows you to implement advanced search on your online store which will help your customers to find desired product (s) in a blink with the help of advance layered navigation filters. Adding ajax based product filtering on your online store will help you to eliminate delay in the searching process
    <? php                                     

    public by paulsimmons modified Mar 16, 2017  36  0  3  0

    Custom Registration Form Wordpress

    WooCommerce doesn't allow you to edit registration form? Try, Custom registration form WordPress addon which will enable you to add the fields and edit registration page. With this addon, you can get any type of information from your website users on registration. This addon will help you to understand the likeness of your users and you can make yo
    // Enter here the actual content of the snippet.                                    

    public by simonwalker modified Mar 15, 2017  27  0  3  0

    Magento GeoIP Store Switcher Extension | FME

    Magento GeoIP Store Switcher by FME is a geo-targeting extension which detects the visitor’s real-time location and redirects them to a region customized store view. Using this Magento GeoIP store switcher extension, you can create multiple store views, customize their theme, and display relevant products on the front. Allow the visitors to manuall
    // https://www.fmeextensions.com/magento-geo-ip-default-store-view.html        

    public by simonwalker modified Mar 15, 2017  29  1  3  0

    Magento Customer Registration Attributes Extension by FME

    Magento Customer Registration attributes extension by FME allows you to add customer attribute to user registration form & account pages. You can hide the custom attributes and restrict them by creating different customer attributes. Using this Magento add customer attribute extension, you can make the custom registration form attributes mandatory
    // https://www.fmeextensions.com/magento-additional-registration-attributes-fields.html            

    public by makli1971 modified Mar 13, 2017  34  0  3  0

    HTML5 Basic Template

    This snippet is a simple, basic HTML5-Template. I use it for getting support when creating a HTML5-Page from scratch.
    <!DOCTYPE html>
    <html>
    <head>
    	<meta charset="utf-8">
    	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    	<link rel="stylesheet" href="styles.css">
    	<script src="script.js"></script>
    </head>
    <body>
    
    </body>
    </html>

    public by toledano modified Mar 6, 2017  33  1  2  0

    Servicio para crear sesiones en el almacén local

    Servicio para crear sesiones en el almacén local: session.auth.service.js
    (function(angular){
      'use strict';
    
      angular
        .module('cmi')
        .service('session', sessionService);
    
      sessionService.$inject = ['$log', 'localStorage'];
    
      function sessionService($log, localStorage){
        // jshint validthis: true
        var self = this;
    
        // API Pública
        self.getUser = getUser;
        self.setUser = setUser;
        self.getAccessToken = getAccessToken;
        self.setAccessToken = setAccessToken;
        self.destroy = destroy;
    
        var _user = JSON.parse(localStorage.getItem('session.username'));
        var _accessToken = JSON.parse(localStorage.getItem('session.accessToken'));
    
        function getUser(){
          return _user;
        }     // getUser()
    
        function setUser(user){
          _user = user;
          localStorage.setItem('session.username', JSON.stringify(user));
          return _user;
        }     // setUser()
    
        function getAccessToken(){
          return _accessToken;
        }     // getAccessToken()
    
        function setAccessToken(token){
          _accessToken = token;
          localStorage.setItem('session.accessToken', JSON.stringify(token));
          return _accessToken;
        }     // setAccessToken()
    
        function destroy(){
          setUser(null);
          setAccessToken(null);
        }     // destroy()
      }
    })(angular);
    

    public by Warrenmiller modified Mar 1, 2017  61  0  3  0

    Office 365 support - +1-800-8268068

    Office 365 products and tools provide its user, reliability and a wonderful environment to communicate through internet. But sometime issues come during using the office 365 application. If you face any problem while using office 365 products, now do not worry for your issues with office 365.Our office 365 support executives will help from your any kind of problem. For more information please visit the url given below.
    http://www.microsoftoutlookoffice365.com/outlook-365-support.html
    

    public by tomsim modified Mar 1, 2017  175  2  4  0

    Send UDP WOL Magic Package

    C program to send UDP magic package to wake on lan
    /* Compile on Windows:
    cl /nologo /W3 /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_X86_" /link wsock32.lib wol.c
    Compile on linux:
    gcc wol.c -o wol
    
    Change the subnet on line 161 to match your network (sorry!)
    Must configure nic to accept magic package and setup power profile to allow
    wake on lan from nic.  Not for WiFi.
    */
    #ifdef _WIN32
    #define WIN32_LEAN_AND_MEAN
    #include <winsock2.h>
    #else
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>
    #include <arpa/inet.h>
    #endif
    
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <errno.h>
    #include <stdarg.h>
    #include <string.h>
    
    #ifdef _WIN32
    #define ERR_RETURN( x, e) if (x == SOCKET_ERROR) { checkError( e); return(0); }
    #else
    #define ERR_RETURN( x, e) if (x < 0) { checkError( e); return(0); }
    #define SOCKET int
    #endif
    
    static int checkError( char *szMsg)
    {
    #ifdef _WIN32
    	int err = WSAGetLastError();
    	if ((err == WSAEINTR) || (err == WSAEWOULDBLOCK) || (err == WSAEINPROGRESS))
    	{
    		printf( "Warning error=%08.8x\n", errno);
    		return 1;
    	}
    	else
    	{
    		printf("Error %d: %s\n", err, szMsg);
    		WSACleanup();
    		return 0;
    	}
    #else
    	perror(szMsg);
    	if ((errno == EINTR) || (errno = EWOULDBLOCK) || (errno == EINPROGRESS))
    		return 1;
    	else
    		return 0;
    #endif
    }
    #ifdef _WIN32
    /*--------------------------------------------------------
      Window socket startup
      --------------------------------------------------------*/
    int socketStartWin32(void)
    {
    	WSADATA wsaData;
    	if (WSAStartup(0x202,&wsaData) == SOCKET_ERROR)
    	{
    		printf("WSAStartup failed with error %d\n",WSAGetLastError());
    		WSACleanup();
    		return -1;
    	}
    	return 0;
    }
    void socketEndWin32(void)
    {
       WSACleanup();
    }
    #endif
    
    /* Magic package format:
    	06 x 255 or (0xff)
    	16 x MAC Address of target PC
    
    */ 
    int main(int argc, char **argv)
    {
    	int i;
    	unsigned char tosend[102];
    	unsigned char mac[6];
    
    	if ((argc < 2) || (strlen(argv[1]) < 17))
    	{
    		printf("Usage wol <mac address aa:bb:cc:dd:ee:ff>\n");
    		exit(0);
    	}
    
    	/** store mac address **/
    	for (i=0; i < sizeof(mac); i++)
    	{
    		char *cp = &argv[1][i*3];
    		mac[i] = 0x00;
    		sscanf(cp,"%2X", (unsigned int *) &mac[i]);
    	}
    	if (argc > 2)	// validate before sent
    	{
    		int ecn = 0;
    		printf( "Send magic package to ");
    		for (i=0; i < sizeof(mac); i++)
    		{
    			if (i) printf(":");
    			printf( "%.2X", mac[i]);
    			if (!mac[i]) ecn++;
    		}
    		printf("\n");
    		if (ecn)
    		{
    			printf("Invalid mac address\n");
    			exit(0);
    		}
    	}
    
    
    	/** first 6 bytes of 255 **/
    	for( i = 0; i < 6; i++) {
    		tosend[i] = 0xFF;
    	}
    	/** append it 16 times to packet **/
    	for( i = 1; i <= 16; i++)
    	{
    		memcpy(&tosend[i * 6], mac, 6 * sizeof(unsigned char));
    	}
    
    #ifdef _WIN32
    	if (socketStartWin32())
    		exit(-1);
    #endif
    	if (1)
    	{
    		int udpSocket;
    		struct sockaddr_in udpClient, udpServer;
    		int broadcast = 1;
    		int rv;
    
    		udpSocket = socket(AF_INET, SOCK_DGRAM, 0);
    
    		/** you need to set this so you can broadcast **/
    		if (setsockopt(udpSocket, SOL_SOCKET, SO_BROADCAST, (char *) &broadcast, sizeof broadcast))
    		{
    			checkError("setsockopt (SO_BROADCAST)");
    			exit(1);
    		}
    		udpClient.sin_family = AF_INET;
    		udpClient.sin_addr.s_addr = INADDR_ANY;
    		udpClient.sin_port = 0;
    
    		bind(udpSocket, (struct sockaddr*)&udpClient, sizeof(udpClient));
    
    		/** …make the packet as shown above **/
    
    		/** set server end point (the broadcast addres)**/
    		udpServer.sin_family = AF_INET;
    		udpServer.sin_addr.s_addr = inet_addr("192.168.1.255");
    		udpServer.sin_port = htons(9);
    
    		/** send the packet **/
    		rv = sendto(udpSocket, tosend, sizeof(unsigned char) * sizeof(tosend), 0, (struct sockaddr*)&udpServer, sizeof(udpServer));
    		if (argc > 2) printf( "Sent %d bytes\n", rv);
    	}
    
    #ifdef _WIN32
    	socketEndWin32();
    #endif
    	return 0;
    }
    
                                        

    public by javieralejandroenc20 modified Feb 27, 2017  61  0  3  0

    Untitled

    c++
    // Enter here the actual content of the snippet.            
    • Public Snippets
    • Channels Snippets