Posts

mysql how to fix Access denied for user 'root'@'localhost'

sudo mysql -u root use mysql; [mysql] update user set plugin='mysql_native_password' where User='root'; [mysql] flush privileges; Now you should be able to login with your password.

How to get consumer count using JMX API in ActiveMQ

first, get a connection to a JMX server (assumes localhost, port 9010, no auth) First you need to start activemq with jmx service. Add below jvm parameters to java opts- -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.rmi.port=9011 -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.local.only=false JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9010/jmxrmi");       JMXConnector jmxc = JMXConnectorFactory.connect(url);       MBeanServerConnection conn = jmxc.getMBeanServerConnection();       ObjectName activeMQ = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost");       BrokerViewMBean mbean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(conn,           activeMQ, BrokerViewMBean.class, ...

Autologin on boot is not working (Raspbian Jessie Lite)

Create file: sudo mkdir /etc/systemd/system/getty@tty1.service.d sudo nano /etc/systemd/system/getty@tty1.service.d/autologin.conf [Service] ExecStart= ExecStart=-/sbin/agetty --autologin yourUserName --noclear %I 38400 linux replace " yourUserName " with your user run command:  sudo systemctl enable getty@tty1.service

nginx on Ubuntu: Permission denied

If you found these error, run command [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) [warn] 1898#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1 [emerg] 1898#0: open() "/var/log/nginx/access.log" failed (13: Permission denied) while restarting  Nginx  and found it to be a cause of  SeLinux . Be sure to give a try after either disabling SeLinux or temporarily setting it to  Permissive  mode using below command setenforce 0

(13: Permission denied) while connecting to upstream:[nginx]

Run the below command:  sudo setsebool httpd_can_network_connect 1

Increase request timeout Inginx

make following changes to /etc/nginx/nginx.conf -  location / { proxy_connect_timeout  600s; proxy_send_timeout  600s; proxy_read_timeout  600s; fastcgi_send_timeout 600s; fastcgi_read_timeout 600s; ... }

Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required

When you try to send mail from code and you find the error "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required", than the error might occur due to following cases. case 1: when the password is wrong case 2: when you try to login from some App case 3: when you try to login from the domain other than your time zone/domain/computer (This is the case in most of scenarios when sending mail from code) There is a solution for each  Solution for  case 1: Enter the correct password. solution for  case 2: go to security settings at the followig link https://www.google.com/settings/security/lesssecureapps and enable less secure apps . So that you will be able to login from all apps. solution 1 for case 3: (This might be helpful) you need to review the activity. but reviewing the activity will not be helpful due to latest security standards the link will not be useful. So ...

How to redirect to specific tomcat port from nginx configuration

1: Create a file /etc/nginx/conf.d/example.conf 2: sudo chmod +x /etc/nginx/conf.d/example.conf 3: Copy this content and change the domain name according to you domain. server {     server_name  example.com;     rewrite ^(.*) http://www.example.com$1 permanent; } server {   listen          80 default_server;   listen [::]:80 default_server ipv6only=on;   server_name     www.example.com;   root            /opt/apache-tomcat-8.0.24/webapps/ROOT;   location / { proxy_set_header X-Forwarded-Host $host;         proxy_set_header X-Forwarded-Server $host;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_pass http://127.0.0.1:8080/;   } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/html; } }

Porxy for apache to tomcat redirect

1: Open file /etc/apache2/sites-enabled/000-default.conf 2: Change content 3: Restart apache2 <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost ProxyRequests Off     <Proxy *>         Order deny,allow         Allow from all     </Proxy>     ProxyPreserveHost on     ProxyPass / http://localhost:8080/ DocumentRoot /var/www/html # Available ...

Is the JVM a compiler or an interpreter?

First, let's have a clear idea of the following terms Javac  is Java Compiler -- Compiles your Java code into  Bytecode JVM  is Java Virtual Machine -- Runs/ Interprets/ translates Bytecode into  Native Machine Code JIT  is Just In Time Compiler -- Compiles the given bytecode instruction sequence to machine code at  run-time  before executing it natively. It's main purpose is to do heavy optimizations in performance. So now, Let's find answers to your questions.. 1) JVM: is it a compiler or an interpreter?  --  Ans:  Interpreter 2) what about JIT compiler that exist inside the JVM?  --  Ans:  If you read this reply completely, you probably know it now 3) what exactly is the JVM?  --  Ans: JVM is a virtual platform that resides on your RAM Its component,  Class loader  loads the  .class  file into the RAM The  Byte code Verifier  component in JVM checks if there ar...

Example AES technology

import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import org.apache.commons.io.IOUtils; public class Test {     /**      * @param args      */     public static void main(String[] args) {           System.out.println("Listing all table name in Database!");           Connection con = null;           String url = "jdbc:mysql://localhost:3306/";           String db = "test";           String driver = "com.mysql.jdbc.Driver";           String user = "root";           String pass = "root";           String name="";     ...

Heap size for JVM

Two JVM options are often used to tune JVM heap size: -Xmx for maximum heap size, and -Xms for initial heap size. Here are some common mistakes made by developers while using them: Missing m, M, g or G at the end (they are case insensitive). For example, java -Xmx128 BigApp java.lang.OutOfMemoryError: Java heap space The correct command should be: java -Xmx128m BigApp . To be precise, -Xmx128 is a valid setting for very small apps, like HelloWorld. But in real life, I guess you really mean -Xmx128m Extra space in JVM options, or incorrectly use =. For example, java -Xmx 128m BigApp Invalid maximum heap size: -Xmx Could not create the Java virtual machine. java -Xmx=512m HelloWorld Invalid maximum heap size: -Xmx=512m Could not create the Java virtual machine. The correct command should be java -Xmx128m BigApp , with no whitespace nor =. -X options are different than -Dkey=value system properties, where = is used. Only setting -Xms JVM option and its value is greater tha...

Encrypt MySQL data using AES techniques

CREATE   TABLE ` user ` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT , `first_name` VARBINARY(100) NULL , `address` VARBINARY(200) NOT NULL , PRIMARY KEY (`id`) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci   You may be expected the table structure should be: CREATE   TABLE ` user ` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT , `first_name` VARCHAR (50) NULL , `address` VARCHAR (100) NOT NULL , PRIMARY KEY (`id`) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci   To encrypt & decrypt mysql data we will use AES_ENCRYPT() and AES_DECRYPT() functions. These functions used the official AES (Advanced Encryption Standard) algorithm & encode data with a 128-bit key length. 128 bits is much faster and secure enough for most purposes. Why we used VARBINARY data type instead of VARCHAR : Because AES_EN...

How to Share Your 3G/4G Data Card Over Wifi with Ubuntu Linux

follow the link:: http://www.svsarana.com/share_3G_data_internet_over_wifi.php?redirect=1

unlock mobile sony sk17i from too many pattern attemps

You can check whether or not the phone is "hard locked" as a result of incorrectly entering an unlock code. tap the following in - as if you were dialing a number to make  phone a call... *#*'#7378423#*#* A new "hidden" menu will appear. Tap on "service info" Tap on "SIM lock" Look at the entry for "Network" - there's a number after it.   That number is how many unlocking attempts you have left - so if it shows zero - "0" - then you'll know that you've reached the limit for unlock code entries - i.e. [x] Network 0 If it shows a number higher than zero, the problem lies elsewhere. Also - when looking at that "Network" entry, there are brackets in front of the name that will look something like this... [x] Network 5 If there's no x in those brackets, it means that the phone is already unlocked, e.g. [] Network 5 - that's an unlocked phone which may also b...

JavaHL problem in eclipse solved

In most of the cases is due to the lack of the libsvn-java library, so just install it: $ sudo apt-get install libsvn-java         Now you have to tell eclipse where to find this libraries. First, locate where the is: view sourceprint? $ sudo updatedb      now run:                                                                                                                                                                               $ locate libsvnjavahl-1.so     /usr/lib/jni/lib...

jqery plugin for pupup bubbles

hi, I share link for popup bubbles. http://www.1stwebdesigner.com/css/stylish-jquery-tooltip-plugins-webdesign/

keyboard shortcut jquery plugin

Here is link. http://www.openjs.com/scripts/events/keyboard_shortcuts/

easy eclipse set in ubuntu linux

To install eclipse on ubuntu you need to download it first from http://www.eclipse.org/downloads/ Extract the downloaded file by right click on it and extract here or running the following: tar xzf dir / eclipse - SDK - 3.3 . 1.1 - linux - gtk . tar . gz Where eclipse-SDK-3.3.1.1-linux-gtk is your eclipse-SDK name with version and dir is the directory of eclipse-sdk. Now move it to the root directory. Apply the following command to do this. sudo mv dir / eclipse ~   Now you are ready to configure your eclipse. To do this follow the following step by step... sudo mv eclipse / home/<your user name>/opt /   Take care of the permissions: sudo chmod - R + r / home/<your user name>/opt / eclipse sudo chmod + x / home/<your user name>/opt / eclipse / eclipse Create an executable in your path: sudo touch / usr / bin / eclipse sudo chmod 755 / usr / bin / eclipse sudo gedit / usr / bin / eclipse Copy the following content and save the file: ...

liferay tomcat setup on ubuntu linux

Open terminal : CTRL+ALT+T 1. run on terminal: 2. sudo nano /etc/profile 3. add these line : export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/ export LIFERAY_HOME=/usr/local/liferay-portal-6.0.6/tomcat-6.0.29 export PATH=$JAVA_HOME/bin:$LIFERAY_HOME/bin:$PATH replace this by your jdk, liferay path . 4. allow execution for all files location in $LIFERAY_HOME/bin cd $LIFERAY_HOME/bin chmod +x *.sh 5. logout and relogin 6. cd $LIFERAY_HOME/bin ./startup.sh