Friday, February 28, 2014

MySQL ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES)

Answer is,  :)

You probably have an anonymous user ''@'localhost' or ''@'127.0.0.1'.

refer : http://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw

Then delete those anonymous users,

mysql> DELETE FROM mysql.user WHERE User='';
mysql> flush privileges;

Done..!

Saturday, August 31, 2013

WSO2 ESB - Adding complex SOAP headers to a message

WSO2 ESB comprises of about 40+ mediators, using which you can perform several actions on the the SOAP messages being passed through. One such requirement would be to manipulate SOAP headers of a message.


What if you need to add a complex header structure to the message as follows,



A real use case of this kind of a requirement will be, you have a secured proxy service in ESB with UsernameToken Policy applied, but the backend service is not secured according to WSSE standards, but having its own way of authenticating, hence it requires messages coming to that endpoint having the structure of the headers as above, and username and password header values need to set with the username and password contains in the WSSE usernameToken of the original request.

That can be achieved using a class / custom mediator which involves writing some Java code, but if you need to avoid deploying / maintain a separate package for that you can chose either Header mediator, XSLT mediator or Script mediator.

Here I'm going to show how the script mediator can be used for the above use case.

Since you have enabled WS security in the proxy service, a valid SOAP request needs to contain the WSSE security headers, as follows.


As highlighted in the above request message, you have to extract the username and password values coming in the request and set those in the header structure which is expected by the backend service.

In order to do that your Script Mediator configuration will be as follows,

That's it..! If you do a full log in insequence you will see the message with added complex headers.. In a future post I Will show you how to use Header mediator and XSLT mediator to achieve the same task.

References
[1] http://docs.wso2.org/display/ESB470/Script+Mediator
[2] http://wso2.com/project/mashup/0.2/docs/e4xquickstart.html

Saturday, March 2, 2013

If your laptop's touchpad suddenly stopped working...

If you are working in Linux (Ubuntu) execute the following command,

   gconftool-2 --set --type boolean /desktop/gnome/peripherals/touchpad/touchpad_enabled true

Thursday, December 27, 2012

WSO2 Stratos 2.0 Alpha - Released !

Its was a great moment, before the year end 2012 we were able to release an Alpha version of long awaited WSO2 Stratos 2.0, and It was a great experience to be in part of the Stratos 2.0 team.

Stratos 2.0 is the next version of Stratos 1.x, and provides features including,

  •   Git / Git-hub integration support
  •   Pluggable cartridges ( PHP, MySQL and WSO2 carbon cartridges)
  •   Autoscaling into EC2 or Openstack  
  •   Custom Domain Mapping support


I will explain further on Stratos 2.0 architecture and functionality in future posts.

For more details you can refer to [1]

[1] http://www.mail-archive.com/dev@wso2.org/msg12504.html

Thursday, November 8, 2012

SSH: Agent admitted failure to sign using the key.

When you are trying to ssh to a remote server using passwordless login, you might get an exception
   "Agent admitted failure to sign using the key."

Issue may be the private key is not properly added (default location : ~/.ssh/id_rsa )

To fix the issue, (preferably in a separate terminal) issue the following command
    $ ssh-add

This will add the private key giving the output "Identity added: /home/wso2/.ssh/id_rsa (/home/sajith/.ssh/id_rsa)"

Now you can ssh to the remote server as expected...
     $ ssh user@remoteserver


Sunday, October 21, 2012

Vim editor - Paste toggle

You may have experienced an additional spaces or unexpected indentation when you paste some text into Vim from another application. To avoid that you need to set paste toggle option in Vim

Follow the steps below

$ vim ~/.vimrc

Put the following in your vimrc (change to whatever key you want):
set pastetoggle=

save and exit.

To paste from another application:
   * Start insert mode.
   * Press F2 (toggles the 'paste' option on)
   * Use your terminal to paste text from the clipboard.
   * Press F2 (toggles the 'paste' option off).


Friday, June 15, 2012

HowTo.. ?

A collection of some important "HowTo"s that I have come across..

Hope to periodically update the list as I get to know of a new "HowTo" ..



Mount a remote samba server shared directory in Linux (Ubuntu)

      $  mount -t cifs //10.2.5.5/shared -o username=un,password=pw /test


Extract a "tar.gz" file in Linux
    
     $ tar -xzf tar-file-name.tar.gz
  • tar - the tar command.
  • x - extract the archive.
  • z - uncompress the archive using gzip.
  • f - use archive file.
  • tar-file-name.tar.gz - the name of the tar.gz to create.
The tar command will extract all the files/folders in the archive to the current directory. 

Create a "tar.gz" file in Linux
    
     $ tar -czf new-tar-file-name.tar.gz file1 file2 folder1 folder2
  • tar - the tar command.
  • c - create new archive.
  • z - compress the archive using gzip.
  • f - use archive file.
  • new-tar-file-name.tar.gz - the name of the tar.gz to create.
  • file-or-folder-to-archive - the name of the folder we want to archive.

Mounting and un-mounting Qemu image


nbddevice="/dev/nbd2"
nbdmount="/dev/nbd2p1"


modprobe nbd max_part=8
qemu-nbd -c /dev/nbd2 image_path
mount /dev/nbd2p1 $work_dir/$image_template


umount $work_dir/$image_template
qemu-nbd -d /dev/nbd2



wget java
-------------
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com"  http://download.oracle.com/otn-pub/java/jdk/6u39-b04/jdk-6u39-linux-x64.bin