working on it ...

Filters

Explore InChannel Snippets

Sort by

Found 500 snippets

    public by akira01 modified yesterday at 6:45:33 PM  47  0  2  0

    Watch IT Movie 2017 Onlijne Full HD

    https://www.asus.com/zentalk/thread-175842-1-1.html
    
    https://www.asus.com/zentalk/thread-175842-1-1.html
    
    https://www.asus.com/zentalk/thread-175842-1-1.html

    public by kannuPriya modified Tuesday at 7:26:19 AM  121  0  4  0

    jQuery ready() Method

    The ready event occurs when the DOM (document object model) has been loaded. The ready() method specifies what happens when a ready event occurs.
    $(document).ready(function(){
       
    });

    public by ronrihoo modified Friday at 3:37:37 AM  122  0  5  0

    Example usage for the BackgroundColor class

    Companion usage example for the arbitrary libGDX Table BackgroundColor class.
    BackgroundColor backgroundColor = new BackgroundColor("white_color_texture.png");
    backgroundColor.setColor(2, 179, 228, 255); // r, g, b, a
    table.setBackground(backgroundColor);																														

    public by ronrihoo modified Friday at 3:13:48 AM  88  0  4  0

    Example helper class for GDXFacebook

    This helper class simplifies the usage of GDXFacebook in libGDX games and apps. (This is a backup to https://github.com/ronrihoo/GDX-Facebook-API-Helper and it's used in https://stackoverflow.com/a/46230835/6664817)
    // add package here
    
    import com.badlogic.gdx.Application;
    import com.badlogic.gdx.Gdx;
    import com.badlogic.gdx.utils.Array;
    import de.tomgrill.gdxfacebook.core.*;
    
    public class FacebookApi {
    
        private final static String CLASS_NAME = FacebookApi.class.getSimpleName();
        private final static String ERR_IN = "Error: in " + CLASS_NAME;
        private final static String EXC_IN = "Exception: in " + CLASS_NAME;
    
        private final static boolean VERBOSE_DEFAULT = true;
        private final static boolean DEBUG_DEFAULT = true;
    
        private boolean verbose;
        private boolean debug;
    
        private Array<String> permissions;
    
        private GDXFacebookConfig config;
        private GDXFacebook facebook;
        private GDXFacebookAccessToken token;
    
        /* if there's a class where credentials are stored or retrieved from,
         * then a constructor like this one could be used
         */ /*
        public FacebookApi() {
            this(Credentials.FB_API_ID);
        }
        /**/
    
        public FacebookApi(String appId) {
            this(appId, null, null);
        }
    
        /**
         *
         * @param appId The Facebook API ID is required.
         * @param prefFilename Optional (example: ".facebookSessionData").
         * @param apiVersion Optional. Graph API Version (default: v2.6).
         */
        public FacebookApi(String appId, String prefFilename, String apiVersion) {
            init(appId, prefFilename, apiVersion, DEBUG_DEFAULT);
        }
    
        private void init(String appId, String prefFilename,
                          String apiVersion, boolean debug) {
            setVerbose(VERBOSE_DEFAULT);
            setDebug(debug);
            if (appId != null) {
                setAppId(appId);
            } else {
                try {
                    throw new RuntimeException(EXC_IN +
                            ".init(...): appId is null. Has it been passed correctly?");
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            if (prefFilename != null)
                setPrefFilename(prefFilename);
            if (apiVersion != null)
                setGraphApiVersion(apiVersion);
            initPermissionsArray();
            installGdxFacebookInstance();
            setGdxFacebookInstance();
            addBasicPermissions();
        }
    
        private void setGdxDebug(boolean debug) {
            debugLog("setGdxDebug(boolean debug)");
            if (debug)
                Gdx.app.setLogLevel(Application.LOG_DEBUG);
            // TODO: turn it off when debug == false
        }
    
        private void instantiateConfig() {
            debugLog("instantiateConfig()");
            config = new GDXFacebookConfig();
        }
    
        private boolean verifyConfig() {
            debugLog("verifyConfig()");
            if (config == null) {
                try {
                    instantiateConfig();
                }
                catch (Exception e) {
                    System.out.println(EXC_IN + ".verifyConfig(): \n" + e);
                    return false;
                }
            }
            return true;
        }
    
        private void setAppId(String appId) {
            debugLog("setAppId(String appId)");
            if (verifyConfig())
                config.APP_ID = appId;
        }
    
        private void setPrefFilename(String filename) {
            debugLog("setPrefFilename(String filename)");
            if (verifyConfig())
                config.PREF_FILENAME = filename;
        }
    
        private void setGraphApiVersion(String version) {
            debugLog("setGraphApiVersion(String version)");
            if (verifyConfig())
                config.GRAPH_API_VERSION = version;
        }
    
        private void installGdxFacebookInstance() {
            debugLog("installGdxFacebookInstance()");
            if (verifyConfig())
                facebook = GDXFacebookSystem.install(config);
        }
    
        /**
         * No parameters, as it is handled by GDXFacebookSystem
         */
        public void setGdxFacebookInstance() {
            debugLog("setGdxFacebookInstance()");
            if (facebook != null)
                facebook = GDXFacebookSystem.getFacebook();
        }
    
        /**
         *
         * @return GDXFacebook object.
         */
        public GDXFacebook getGdxFacebookInstance() {
            debugLog("getGdxFacebookInstance()");
            return facebook;
        }
    
        private void initPermissionsArray() {
            debugLog("initPermissionsArray()");
            permissions = new Array<String>();
        }
    
        private void addBasicPermissions() {
            debugLog("addBasicPermissions()");
            permissions.add("email");
            permissions.add("public_profile");
            permissions.add("user_friends");
        }
    
        public void addPermission(String permission) {
            debugLog("addPermission(String)");
            if (permissions != null)
                permissions.add(permission);
            else
                System.out.println(ERR_IN + ": permissions array is null");
        }
    
        /**
         * Basic sign-in with read-mode
         */
        public void signIn() {
            debugLog("signIn()");
            signIn(SignInMode.READ);
        }
    
        public void signIn(SignInMode signInMode) {
            debugLog("signIn(SignInMode)");
            if (facebook != null) {
                if (permissions == null) {
                    addBasicPermissions();
                    debug(CLASS_NAME +
                            ": returned to signIn(SignInMode) from addBasicPermissions()");
                }
                facebook.signIn(signInMode, permissions, new GDXFacebookCallback<SignInResult>() {
    
                    @Override
                    public void onSuccess(SignInResult result) {
                        if (verbose)
                            System.out.println("Successfully signed in Facebook.");
                        token = result.getAccessToken();
                        debug(CLASS_NAME + ".signIn() succeeded.");
                        debug(CLASS_NAME + ": accessToken is " + token);
                    }
    
                    @Override
                    public void onError(GDXFacebookError error) {
                        if (debug)
                            System.out.println(ERR_IN + ".signIn(): " +
                                    error.getErrorMessage());
                        debug("signIn() invoked by GDXFacebook instance, facebook, in " +
                                CLASS_NAME + " faced an error.");
                    }
    
                    @Override
                    public void onCancel() {
                        // When the user cancels the login process
                        debug("signIn() invoked by GDXFacebook instance, facebook, in " +
                                CLASS_NAME + " canceled.");
                    }
    
                    @Override
                    public void onFail(Throwable t) {
                        // When the login fails
                        debug("signIn() invoked by GDXFacebook instance, facebook, in " +
                                CLASS_NAME + " failed.");
                    }
                });
            } else {
                debug(ERR_IN + ".signIn(): " +
                        "GDXFacebook instance, facebook, is null.");
            }
        }
    
        public void signOut() {
            debug(CLASS_NAME + ".signOut()");
            facebook.signOut();
        }
    
        protected void setVerbose(boolean verbose) {
            this.verbose = verbose;
        }
    
        protected void setDebug(boolean debug) {
            this.debug = debug;
            setGdxDebug(debug);
        }
    
        private void debug(String msg) {
            if (debug)
                System.out.println(msg);
        }
    
        private void debugLog(String methodName) {
            if (verbose)
                debug(CLASS_NAME + "." + methodName);
        }
    
    }

    public by Marko555 modified Sep 13, 2017  105  0  2  0

    test123

    // Enter here the actual content of the snippet.						<!DOCTYPE HTML>
    <html>
    
    <head>
        <title>Ensighten Test Site</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta name="description" content="" />
        <meta name="keywords" content="" />
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,minimum-scale=1">
        <!--<script type="text/javascript" src="js/Bootstrap.js"></script>-->
        <!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
        <script src="js/skel.min.js"></script>
        <script src="js/skel-panels.min.js"></script>
        <script src="js/init.js"></script>-->
        
            <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine">
            <link rel="stylesheet" href="css/style.css" />
            <link rel="stylesheetz" href="css/style-desktop.css" />
       
        <link rel="canonical" href="/ensighten-luka-test.eu.pn/left-sidebar.html">
       <script type="text/javascript" src="//nexus.ensighten.com/ens-devtech/luka/Bootstrap.js"></script>
       <script async src="https://cdn.ampproject.org/v0.js"></script> 
       <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
       <meta name="amp-google-client-id-api" content="googleanalytics">
    </head>
    
    <body class="homepage">
    
    
        
    
    <!-- <div id="fbAds"></div>
    <figure></figure> -->
    
        <!-- Header -->    
    
        <div id="header">
            <div id="nav-wrapper">
                <!-- Nav -->
                <nav id="nav">
                
                    <ul>
                        <li class="active"><a href="index.html?adxcel_clickid=34re4">Homepage</a></li>
                        <li><a href="left-sidebar.html" id="button">Left Sidebar</a></li>
                        <li><a href="right-sidebar.html">Right Sidebar</a></li>
                        <li><a href="no-sidebar.html">No Sidebar</a></li>
                    </ul>
                </nav>
            </div>
            <div class="container">
                <!-- Logo -->
                <div id="logo">
                    <h1>&lt;&#8226;&gt;</h1>
                    <span class="tag">SandBox</span>
                </div>
            </div>
        </div>
        <!-- Featured -->
        <div id="featured">
            <div class="container">
                <header>
                    <h2>Welcome to SandBox test site</h2>
                
                </header>
               
                <p>This site is used by DevApps team for testing and presentation purpose.</p>
                <hr />
                <div class="row">
                    <div id="test">
                    </div>
                    <section class="4u">
                        <h3>Maecenas luctus lectus</h3>
                        <p>Curabitur sit amet nulla. Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat, nulla. Sed ac leo.</p>
                        <a href="#" class="button button-style1">Read More</a>
                    </section>
                    <section class="4u">
                        <h3>Maecenas luctus lectus</h3>
                        <p>Donec ornare neque ac sem. Mauris aliquet. Aliquam sem leo, vulputate sed, convallis at, ultricies quis, justo. Donec magna.</p>
                        <a href="#" class="button button-style1">Read More</a>
                    </section>
                    <section class="4u">
                        <h3>Maecenas luctus lectus</h3>
                        <p>Curabitur sit amet nulla. Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat, nulla. Sed ac leo.</p>
                        <a href="#" class="button button-style1">Read More</a>
                    </section>
                </div>
            </div>
        </div>
        <!-- Main -->
        <div id="main">
            <div id="content" class="container">
                <div class="row">
                    <section class="6u">
                        <header>
                            <h2>Mauris vulputate dolor</h2>
                        </header>
                        <p>In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim. Aliquam erat volutpat. Donec leo, vivamus fermentum nibh in augue praesent a lacus at urna congue rutrum.</p>
                    </section>
                    <section class="6u">
                        <header>
                            <h2>Mauris vulputate dolor</h2>
                        </header>
                        <p>In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim. Aliquam erat volutpat. Donec leo, vivamus fermentum nibh in augue praesent a lacus at urna congue rutrum.</p>
                    </section>
                </div>
                <div class="row">
                    <section class="6u">
                        <header>
                            <h2>Mauris vulputate dolor</h2>
                        </header>
                        <p>In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim. Aliquam erat volutpat. Donec leo, vivamus fermentum nibh in augue praesent a lacus at urna congue rutrum.</p>
                    </section>
                    <section class="6u">
                        <header>
                            <h2>Mauris vulputate dolor</h2>
                        </header>
                        <p>In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim. Aliquam erat volutpat. Donec leo, vivamus fermentum nibh in augue praesent a lacus at urna congue rutrum.</p>
                    </section>
                </div>
            </div>
        </div>
        <!-- Tweet -->
        <div id="tweet">
            <div class="container">
                <section>
                    <blockquote>&ldquo;In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim. Aliquam erat volutpat.&rdquo;</blockquote>
                </section>
            </div>
        </div>
        <!-- Footer -->
        <div id="footer">
            <div class="container">
                <section>
                    <header>
                        <h2>Maecenas ligula</h2>
                        <span class="byline">Integer sit amet pede vel arcu aliquet pretium</span>
                    </header>
                </section>
            </div>
        </div>
        <!-- Copyright -->
        <div id="copyright">
            <div class="container">
                Design: <a href="http://templated.co">TEMPLATED</a> Images: <a href="http://unsplash.com">Unsplash</a> (<a href="http://unsplash.com/cc0">CC0</a>)
            </div>
        </div>
       
    </body>
    
    </html>
    						

    public by ronrihoo modified Sep 9, 2017  203  3  5  1

    libGDX Table background color

    Create an instance of this class by giving the constructor the filename of a white PNG from your project resources. Then, use one of the instance's setColor(red, green, blue, alpha) methods. Finally, pass the instance to the libGDX Table using the Table's setBackground(Drawable drawable) method. This is not meant to be a perfect solution for all --
    import com.badlogic.gdx.Gdx;
    import com.badlogic.gdx.graphics.Color;
    import com.badlogic.gdx.graphics.Texture;
    import com.badlogic.gdx.graphics.g2d.Batch;
    import com.badlogic.gdx.graphics.g2d.Sprite;
    import com.badlogic.gdx.graphics.g2d.TextureRegion;
    import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
    
    public class BackgroundColor implements Drawable {
    	
    	private Float x;
    	private Float y;
    	private Float width;
    	private Float height;
    	
    	private Boolean fillParent;
    	
    	private String filename;
    	private Texture texture;
    	private TextureRegion textureRegion;
    	private Sprite sprite;
    	private Color color;
    	
    	public BackgroundColor(String filename) {
    		this(filename, 0.0f, 0.0f, 0.0f, 0.0f);
    	}
    	
    	public BackgroundColor(String filename, float x, float y) {
    		this(filename, x, y, 0.0f, 0.0f);
    	}
    	
    	public BackgroundColor(String filename, float x, float y, float width, float height) {
    		this.setPosition(x, y);
    		this.setSize(width, height);
    		initialize(filename);
    	}
    	
    	private void initialize(String filename) {
    		setFilename(filename);
    		if (x == null || y == null)
    			setPosition();	// x = 0.0f; y = 0.0f;
    		if (width == null || height == null || width < 0.0f || height < 0.0f)
    			setSize();		// width = 0.0f; height = 0.0f;
    		if (color == null)
    			setColor(255, 255, 255, 255);
    		if (sprite == null) {
    			try {
    				setSprite();
    			} catch (Exception e) {
    				System.err.println(e);
    			}
    		}
    		if (fillParent == null)
    			fillParent = true;
    	}
    	
    	private void setTexture() {
    		if (texture != null)
    			texture.dispose();
    		texture = new Texture(Gdx.files.internal(getFilename()));
    	}
    	
    	private void setTextureRegion() {
    		textureRegion = new TextureRegion(texture, (int) getWidth(), (int) getHeight());
    	}
    	
    	private void setSprite() {
    		if (texture == null)
    			setTexture();
    		setTextureRegion();
    		sprite = new Sprite(textureRegion);
    		setSpriteColor();
    	}
    	
    	private void setSpriteColor() {
    		sprite.setColor(color.r, color.g, color.b, color.a);
    	}
    	
    	private void setPosition() {
    		this.x = 0.0f;
    		this.y = 0.0f;
    	}
    	
    	private void setPosition(float x, float y) {
    		this.x = x;
    		this.y = y;
    	}
    	
    	private void setSize() {
    		this.width = sprite.getWidth();
    		this.height = sprite.getHeight();
    	}
    	
    	private void setSize(float width, float height) {
    		this.width = width;
    		this.height = height;
    	}
    	
    	public void setColor(int r, int g, int b, int a) {
    		color = new Color(r/255f, g/255f, b/255f, a/255f);
    	}
    
    	public void setColor(float r, float g, float b, float a) {
    		color = new Color(r/255f, g/255f, b/255f, a/255f);
    	}
    	
    	private void setSpritePosition(float x, float y) {
    		sprite.setX(x);
    		sprite.setY(y);
    	}
    	
    	private void updateSprite(float x, float y, float width, float height) {
    		if (fillParent) {
    			setSpritePosition(x, y);
    			if (width != textureRegion.getRegionWidth() || 
    					height != textureRegion.getRegionHeight()) {
    				setSize(width, height);
    				setSprite();
    			}
    		}
    	}
    	
    	@Override
    	public void draw(Batch batch, float x, float y, float width, float height) {
    		updateSprite(x, y, width, height);
    		sprite.draw(batch);
    	}
    
    	@Override
    	public float getLeftWidth() {
    		// TODO Auto-generated method stub
    		return 0;
    	}
    
    	@Override
    	public void setLeftWidth(float leftWidth) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public float getRightWidth() {
    		// TODO Auto-generated method stub
    		return 0;
    	}
    
    	@Override
    	public void setRightWidth(float rightWidth) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public float getTopHeight() {
    		// TODO Auto-generated method stub
    		return 0;
    	}
    
    	@Override
    	public void setTopHeight(float topHeight) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public float getBottomHeight() {
    		// TODO Auto-generated method stub
    		return 0;
    	}
    
    	@Override
    	public void setBottomHeight(float bottomHeight) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public float getMinWidth() {
    		// TODO Auto-generated method stub
    		return 0;
    	}
    
    	@Override
    	public void setMinWidth(float minWidth) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public float getMinHeight() {
    		// TODO Auto-generated method stub
    		return 0;
    	}
    
    	@Override
    	public void setMinHeight(float minHeight) {
    		// TODO Auto-generated method stub
    		
    	}
    	
    	private void setFilename(String filename) {
    		this.filename = filename;
    	}
    	
    	private String getFilename() {
    		return filename;
    	}
    
    	public float getX() {
    		return x;
    	}
    
    	public void setX(float x) {
    		this.x = x;
    	}
    
    	public float getY() {
    		return y;
    	}
    
    	public void setY(float y) {
    		this.y = y;
    	}
    
    	public float getWidth() {
    		return width;
    	}
    
    	public void setWidth(float width) {
    		this.width = width;
    	}
    
    	public float getHeight() {
    		return height;
    	}
    
    	public void setHeight(float height) {
    		this.height = height;
    	}
    
    	public Boolean getFillParent() {
    		return fillParent;
    	}
    
    	public void setFillParent(Boolean fillParent) {
    		this.fillParent = fillParent;
    	}
    
    }
    																																				

    public by szmerek modified Sep 6, 2017  172  2  4  0

    OnClick without setting an attribute of the link

    //<div id="dog" >Woow woow</div>
    
    
        (function() {
            document.getElementById("dog").onclick = function() { 
                alert('fuf fuf'); 
            };
        })();																								

    public by yourfriendcaspian modified Sep 2, 2017  107  0  1  0

    Instructions for installing the most popular webdrivers, and then the latest version of the standalone Selenium server

    Instructions for installing the most popular webdrivers, and then the latest version of the standalone Selenium server: selenium-instructions.md
    # Steps For Setting Up Selenium And The Webdrivers
    
    ### Install The Firefox Geckodriver
    
    * Download [the latest Geckodriver for Firefox](https://github.com/mozilla/geckodriver/releases)
    * then `mv` that file to `/usr/local/bin/geckodriver` and `sudo chmod +x /usr/local/bin/geckodriver`
    * make sure you have `"webdriver.firefox.profile" : "geckodriver",` in your `nightwatch.json` file if you are using it
    
    ### Install The Chromedriver
    
    * Download the latest version [from the Chrome site](https://sites.google.com/a/chromium.org/chromedriver/downloads)
    * unzip it if it is a zip file
    * then `mv` that file to `/usr/local/bin/chromedriver` and `sudo chmod +x /usr/local/bin/chromedriver`
    
    ### Install the Safari Driver
    
    * Download the `SafariDriver.safariextz` [from the release site](http://selenium-release.storage.googleapis.com/index.html?path=2.45/)
    * Double click on the file and it will open in Safari
    * Accept the file as trusted
    * It will now show in your extensions
    
    ### Build the latest Selenium binary
    
    * `git clone git@github.com:SeleniumHQ/selenium.git`
    * `cd selenium`
    * `./go clean release`
    * `cd build/dist`
    * You can now run the server with the following: `java -jar selenium-server-standalone-3.0.0-beta1.jar`
    * _you may have a server of a different name depending on when you read this tutorial_
    
    ### Running the server
    
    * cd to the directory where you build the jar file
    * run: `java -jar selenium-server-standalone-3.0.0-beta1.jar`
    
    You can also alias the function in a `~/.bashrc` or `~/.zshrc` with:
    
    ```sh
    alias selenium="java -jar /path/to/build/dist/folder/selenium-server-standalone-3.0.0-beta1.jar"
    ```
    
    Remember: _You may have a server of a different name depending on when you read this tutorial_
    
    

    public by yourfriendcaspian modified Sep 2, 2017  94  0  1  0

    Cómo instalar MySql en Debian/derivados, crear Bases de Datos y Usuarios para usarlos en Django

    Cómo instalar MySql en Debian/derivados, crear Bases de Datos y Usuarios para usarlos en Django: Mysql and Django.md
    Instalar Mysql con Python y Django Debian/Derivados 
    =====================
     
     
    Para instalar necesitamos tener unas dependencias en el sistema por ahora mostraremos en equipos **Debian y Derivados**. Pero primero instalares actualizaciones y MySQL
     
     
    ----------
    Actualizaciones y MySQL
    ---------
     
    **Actualizar Sistema** lo hacemos con los siguientes comandos
     
    ```
    $ sudo apt-get update
    $ sudo apt-get upgrade
    ```
     
    > **NOTA:** Cada Sistema tiene sus comandos para actualización, si es que tu máquina no es derivada de Debian **buscalos** :D
     
    #### <i class="icon-file"></i> Instalación de MySQL
     
    Instalamos Mysql (5.5.*)
    ```
    $ sudo apt-get install mysql-server mysql-client
    Passwd for 'root' user: mypasswd
    ```
    Al final ejecutamos este comando para darle mas seguridad a nuestra BD
     
    ```
    $ mysql_secure_installation
    ```
    Revisar atentanmente los cambios que se harán, la primera pregunta es el passwd root
    SI desea mantenerla o cambiarla, y sigue con otras preguntas de seguridad.
     
     
    #### <i class="icon-folder-open"></i> Crear una base de datos y un usuario para la BD
     
    Ahora crearemos la BD a la que se conectara DJango y un Usuario con Passwd para que acceda a ella.
    Existen dos maneras de hacerlo:
    ```
    echo "CREATE DATABASE DATABASENAME;" | mysql -u root -p
    echo "CREATE USER 'DATABASEUSER'@'localhost' IDENTIFIED BY 'PASSWORD';" | mysql -u root -p
    echo "GRANT ALL PRIVILEGES ON DATABASENAME.* TO 'DATABASEUSER'@'localhost';" | mysql -u root -p
    echo "FLUSH PRIVILEGES;" | mysql -u root -p
    ```
    Así deberan poner su passwd de mysql en cada línea ó también pueden hacerlo de la siguiente manera
     
    ```
    $ mysql -u root -p
    ```
    Introducen su passwd y a continuación hacen lo siguiente.
     
    ```
    CREATE DATABASE DATABASENAME;
    CREATE USER 'DATABASEUSER'@localhost IDENTIFIED BY 'PASSWORD';
    GRANT ALL PRIVILEGES ON DATABASENAME.* TO 'DATABASEUSER'@localhost;
    FLUSH PRIVILEGES;
    exit
    ```
     
    #### <i class="icon-pencil"></i> Verificamos Dependencias
     
    Sólo hay unas cuantas dependencias pero hay que estar seguros
     
    ```
    $ sudo apt-get install libmysqlclient-dev python-dev
    ```
     
    #### <i class="icon-trash"></i> Instalando driver mysql-python con PIP
     
    Hasta aquí es todo sólo procedemos a instalar Pip en nuestro entorno virtual o globalmente
     
    ```
    $ sudo pip install mysql-python
    ```
     
     
    ----------
    <i class="icon-hdd"></i> Resumen
    ---------
    Como podrás ver ahora puedes crear DB y Usuarios para cada Proyecto de Django.
     
    
     
     
     
     
    
    
    

    public by yourfriendcaspian modified Sep 2, 2017  104  0  2  0

    Install Mysql with Python and Django Debian/Derivatives - Translated

    Install Mysql with Python and Django Debian/Derivatives - Translated: mysql_python_on_debian.txt
    #Install Mysql with Python and Django Debian/Derivatives 
    
    #To install we need to have some dependencies in the system for now we will show on
    #Debian and Derivatives.
    
    #But first install updates and MySQL
    
    ```
    $ sudo apt-get update
    $ sudo apt-get upgrade
    ```	
    
    # ** NOTE: ** 
    #Each System has its commands for updating, if your machine is not derived from Debian ** look for them **
    
    ##Install MySQL
    
    ```
    $ sudo apt-get install mysql-server mysql-client
    Passwd for 'root' user: <password>
    ```
    
    #At the end we execute this command to give more security to our BD
    
    ```
    $ mysql_secure_installation
    ```
    
    #Check carefully the changes that will be made, the first question is the passwd for root,
    #IF you want to keep or change it, and continue with other security questions.
    
    ##Create a database and a user for the DB
    
    #Now we will create the DB that will be connected to DJango and a User with Passwd to access it.
    #There are two ways to do this:
    
    ```
    echo "CREATE DATABASE <DATABASENAME>;" | mysql -u root -p
    echo "CREATE USER '<DATABASEUSER>'@'localhost' IDENTIFIED BY '<PASSWORD>';" | mysql -u root -p
    echo "GRANT ALL PRIVILEGES ON <DATABASENAME>.* TO '<DATABASEUSER>'@'localhost';" | mysql -u root -p
    echo "FLUSH PRIVILEGES;" | mysql -u root -p
    ```
    
    #So they should put their passwd of mysql in each line or
    #they can also do it of the following way
    
    ```
    $ mysql -u root -p
    ```
    
    #Enter your passwd and then do the following.
    
    ```
    CREATE DATABASE <DATABASENAME>;
    CREATE USER '<DATABASEUSER>'@localhost IDENTIFIED BY '<PASSWORD>';
    GRANT ALL PRIVILEGES ON <DATABASENAME>.* TO '<DATABASEUSER>'@localhost;
    FLUSH PRIVILEGES;
    exit
    ```
    
    #We Check Dependencies
    #There are only a few dependencies but you have to be sure
    
    ```
    $ sudo apt-get install libmysqlclient-dev python-dev
    ```
    
    #So far it's all just proceed to install pip in our virtual environment or globally
    
    ```
    $ sudo -H pip install mysql-python
    ```
    
    #As you can see now you can create DB and Users for each Django Project
    
    
    • Public Snippets
    • Channels Snippets