Monthly Archives: September 2013

WTF, upgrading a theme and lost all script and statistic data.

 

Thank you! Word-press.

Recently, I simply clicked a “theme upgrade” button from word-press dashboard and lost all scripts including google analytics, Cluster map and counter. It starts from “0” except google analytics.

Moreover the White Screen of Death shows up after adding google analytics Java script code in Main Index Template file, index.php. My case was quite simple to resolve it. Firstly log in admin php page, www.yourwebsite.com/wordpress/wp-admin

Then I could access word-press dash board again!

Remove Java script code from index.php file and my blog returns back.

 

Where is an installed packages on the Ubuntu using apt-get?

Useful article from

http://www.howtogeek.com/howto/ubuntu/see-where-a-package-is-installed-on-ubuntu/

 

Once you use the apt-get utility to install a package, sometimes it seems to disappear into nowhere. You know it’s installed, you just have no idea where.

If you know the name of the executable, you can use the which command to find the location of the binary, but that doesn’t give you information on where the supporting files might be located.

There’s an easy way to see the locations of all the files installed as part of the package, using the dpkg utility.

dpkg -L <packagename>

Example: I had installed davfs2, but I wasn’t sure where the configuration file was, so I ran this command:

geek@ubuntuServ:~$ dpkg -L davfs2

davfs2: /usr/share/lintian/overrides/davfs2
davfs2: /usr/share/davfs2/GPL
davfs2: /usr/share/doc/davfs2/BUGS
davfs2: /usr/share/doc/davfs2/copyright
davfs2: /usr/share/davfs2/NEWS
davfs2: /usr/share/doc/davfs2/THANKS
davfs2: /usr/share/doc/davfs2/NEWS.gz
davfs2: /usr/share/doc/davfs2/README.gz
davfs2: /usr/share/doc/davfs2
davfs2: /usr/share/doc/davfs2/TODO
davfs2: /etc/davfs2/secrets
davfs2: /usr/share/davfs2/THANKS
davfs2: /usr/share/doc/davfs2/README.Debian
davfs2: /usr/share/davfs2/BUGS
davfs2: /etc/davfs2/davfs2.conf
davfs2: /usr/share/davfs2/ChangeLog
davfs2: /usr/share/davfs2/FAQ
davfs2: /etc/davfs2
davfs2: /usr/share/doc/davfs2/changelog.Debian.gz
davfs2: /usr/share/davfs2/secrets.template
davfs2: /usr/share/doc/davfs2/changelog.gz
davfs2: /usr/share/davfs2/TODO
davfs2: /usr/share/davfs2/davfs2.conf.template
davfs2: /usr/share/davfs2/README
davfs2: /usr/share/davfs2
davfs2: /usr/share/doc/davfs2/FAQ

Well, now I don’t have to wonder anymore. The conf file is clearly  /etc/davfs2/davfs2.conf. If I wanted to see just what files were installed into /etc, you could always grep the output like this:

geek@ubuntuServ:~$ dpkg -L davfs2 | grep etc

davfs2: /etc/davfs2/secrets
davfs2: /etc/davfs2/davfs2.conf
davfs2: /etc/davfs2

Even easier to read.

Update: Changed from -S to -L thanks to a tip from sebest.

Accessing Devices without Sudo in Ubuntu.

Source from: http://www.tincantools.com/wiki/Accessing_Devices_without_Sudo

On Linux, OpenOCD requires superuser privileges to communicate with your USB drivers. You can giveOpenOCD superuser priveleges with the sudo command, like this:

sudo openocd [-f ...]

…but sudo prompts the user for the root password. Suppose you want to allow a user to run OpenOCDwithout a root password, or you just don’t want to type sudo each time you run OpenOCD. This guide will demonstrate how to configure Ubuntu Linux to allow a particular user to run OpenOCD for a device withoutsudo.

 

Step 1: Add the User to the plugdev Group

Determine if the user is part of the plugdev group with the groups command. Open a terminal window and type:

groups USERNAME

…replacing USERNAME with the name of the user account. The groups command will print a list of all of the user’s groups. Look for the group plugdev. If the user is not already a member of plugdev, add the user with the adduser command:

sudo useradd -G plugdev USERNAME

Run groups USERNAME again to verify that the user is now part of plugdev.

 

Step 2: Determine your Device’s Vendor ID and Product ID

The vendor ID and product ID for the Flyswatter and Flyswatter2 are as follows:

idVendor = 0403
idProduct = 6010

For any other device, plug it in, then use the lsusb command to retrieve your hardware’s vendor ID and product ID. You will need them below.

 

Step 3: Add the Device to udev

Now you need to add your hardware to the plugdev group. In the terminal window, navigate to/etc/udev/rules.d and list the contents of the directory.

cd /etc/udev/rules.d
dir

In a fresh installation of Ubuntu 10.04 you should see two files listed: 70-persistent-cd.rules and 70-persistent-net.rules. If you see other files, proceed with caution. If in doubt contact your system administrator. If you are ready to proceed, create a new file in the gedit text editor.

sudo gedit 10-my-usb.rules

You can name this file whatever you want, so long as it ends in “.rules”. However, rules files by convention begin with a number. Linux parses rules files in lexical order, and the number makes it easy to see which files will be parsed first. Choosing a low number (like 10, as above) means that your file will be parsed before system rules files.

Add the following text to the file, replacing VENDOR_ID and PRODUCT_ID with the values you found in Step 2 above.

ATTRS{idProduct}=="[VENDOR_ID]", ATTRS{idVendor}=="[PRODUCT ID]", MODE="666", GROUP="plugdev"

For the Flyswatter or Flyswatter2, the text should look like this:

ATTRS{idProduct}=="6010", ATTRS{idVendor}=="0403", MODE="666", GROUP="plugdev"

On older Ubuntu installations you may need to use SYSFS instead of ATTRS, like this:

SYSFS{idProduct}=="6010", SYSFS{idVendor}=="0403", MODE="666", GROUP="plugdev"

Save the file and close it. Now tell Ubuntu to reload udev rules by entering the following in the terminal window:

sudo udevadm trigger

Any member of the plugdev group should now be able to run OpenOCD without using sudo.