Pages

Friday, November 14, 2014

Ubuntu-Connect an Android device using MTP in Ubuntu 14.04 LTS

After Much of Fiddle I was able to connect my ASUS Zenfhone 5 to my ubuntu via MTP Here is How..

1. First we need to install some MTP Apps so run the following command

 sudo apt-get install libmtp-common mtp-tools libmtp-dev libmtp-runtime libmtp9  

Then run

 sudo apt-get dist-upgrade  

2. Then we're going to amend the fuse.conf file. FUSE is an application that aims to provide a secure method for non privileged users to create and mount their own file system implementations.

Run the following command

 sudo nano /etc/fuse.conf  

You will get following lines remove # before last line which allows other users to mount their own file systems

 # /etc/fuse.conf - Configuration file for Filesystem in Userspace (FUSE)  
 # Set the maximum number of FUSE mounts allowed to non-root users.  
 # The default is 1000.  
 #mount_max = 1000  
 # Allow non-root users to specify the allow_other or allow_root mount options.  
 user_allow_other  

3. Now connect your device using MTP option and run following command
 lsusb  
You will get a list as follows
 Bus 002 Device 007: ID 413c:8160 Dell Computer Corp. Wireless 365 Bluetooth  
 Bus 002 Device 005: ID 413c:8162 Dell Computer Corp. Integrated Touchpad [Synaptics]  
 Bus 002 Device 004: ID 413c:8161 Dell Computer Corp. Integrated Keyboard  
 Bus 002 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)  
 Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub  
 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  
 Bus 001 Device 006: ID 0b05:5480 ASUSTek Computer, Inc.   
 Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub  
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  

I find the only device connected to my system of name  ASUSTek Computer is my ASUS mobile we need two parts from above line

0b05:5480

Make a note of these and now we will add these to another rules file

4. Run following command

sudo nano /lib/udev/rules.d/69-mtp.rules

Now add the following lines to the file see the idProduct and idVendor we have added change it in accordance with your device

# ASUSTek Computer, Inc.
ATTR{idVendor}=="0b05", ATTR{idProduct}=="5480", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

5. Now we need to add this information to another rules file

sudo nano /etc/udev/rules.d/51-android.rules
 
Now add the following lines to the open file
 ATTR{idVendor}=="0b05", ATTR{idProduct}=="5480", MODE=”0666"  

Remember to add correct idVendor and idProduct

6. Restart the service
 sudo service udev restart  

7. Reboot Device

 sudo reboot

That's It

Wednesday, November 12, 2014

PHP-Localize php.ini configs for any directory

Recently while installing Joomla 3.0 I came across a blocker My Hosting Provider's php.ini said

magic_quotes_gpc = on;

which was hindering my way in installation of Joomla on Hosting Space I had...

I was looking for a work around and here is what I did simply...

1. Created a file called php.ini(or php5.ini-to taste of your php installation) in my local directory and added 

magic_quotes_gpc = off;

2. Secondly I created .htaccess and added following lines of code to the same

 
 <IfModule mod_suphp.c>  
  suPHP_ConfigPath /home/blart/public_html/interiors  
  <Files php.ini>  
   order allow,deny  
   deny from all  
  </Files>  
 </IfModule>  

The following directory contains my php.ini file
/home/blart/public_html/interiors  


That's it and I had my  php.ini localized

Saturday, September 13, 2014

Ubuntu LAMP-Enable Curl and mcrypt

To EnaBLE CURL FIRST WE NEED TO DOWNLOAD AND INSTALL 
Curl Libraries for this enable the following command
 
 sudo apt-get install curl libcurl3 libcurl3-dev php5-curl  
 
To Enable Mcrypt we need to download and Install 
Mcrypt libraries
 
 sudo php5enmod mcrypt  
 
Mcrypt is already there and is just not enabled.
 
If its still not accessible locate "mcrypt.so" if you find the same 
 at a location like 
 
/usr/lib/php5/20121212/mcrypt.so
 
edit its path in mcrypt.ini and then run the command
 
"sudo php5enmod mcrypt"
 
That's it this enables both of these php extensions. 

Sunday, August 24, 2014

Zend-Using ZendX library in Zend

Recently I had to use Jquery UI components in one of my applications.I used ZendX Library to counter the same and I worked upon the same as the same as follows

 In bootstrap.php

       protected function _initJquery() {  
     $view = Zend_Layout::startMvc()->getView();  
     $view->addHelperPath("ZendX/JQuery/View/Helper",  
                 "ZendX_JQuery_View_Helper"  
                );  
     Zend_Controller_Action_HelperBroker::addHelper(  
               new ZendX_JQuery_Controller_Action_Helper_AutoComplete()  
                );  
     $view->jQuery()  
        ->enable()  
        ->setVersion('1.11.0')  
        ->setUiVersion('1.10.4')  
        ->addStylesheet('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css')  
        ->uiEnable();  
   }  

In View

 <?php  
 $this->jQuery()->addJavascriptFile($this->baseUrl().'/assets/js/validation/jquery.validate.min.js');  
 $this->headScript()->prependFile($this->baseUrl().'/assets/js/validation/myvalidation.js');  
 ?>  

Layout

 <?php   
 echo $this->jQuery();  
 echo $this->jQuery()->uiEnable();  
 echo $this->headScript();  
 echo $this->headLink();  
 echo $this->headTitle('My Website');  
 ?>  

ZendX-Use events and properties of jquery-ui widgets in Zend forms

Recently I added a ZendX Date Picker to one of my Zend Applications now I was able to add properties but I was unable to add events so I had to use another Zend magic function
Zend_Json_Expr

As shown in code below

    /*************Order Date From****************************************/     
         $order_date_from = new ZendX_JQuery_Form_Element_DatePicker('order_date_from',  
               array('jQueryParams' => array('dateFormat' => 'yy-mm-dd',  
                 'onClose'=>new Zend_Json_Expr('function( selectedDate ) {$( "#order_date_to" ).datepicker( "option", "minDate", selectedDate );}')  
                 ))  
           );  
         $order_date_from->setAttribs(array('class'=>"",  
             //'id'=>'datepickerfrom'  
         )  
           );  
         $order_date_from->removeDecorator('DtDdWrapper')  
           ->removeDecorator('HtmlTag')  
           ->removeDecorator('Errors')  
           ->removeDecorator('Label');  
         $this->addElement($order_date_from);  
         /*************Order Date From****************************************/  
         /*************Order Date To****************************************/  
         $order_date_to = new ZendX_JQuery_Form_Element_DatePicker('order_date_to',  
               array('jQueryParams' => array(  
                 'onClose'=>new Zend_Json_Expr('function( selectedDate) {$( "#order_date_from" ).datepicker( "option", "maxDate", selectedDate );}'),  
                 'dateFormat' => 'yy-mm-dd'              
                 ))  
           );  
         $order_date_to->setAttribs(array('class'=>"",  
             //'id'=>'datepickerto'  
         )  
           );  
         $order_date_to->removeDecorator('DtDdWrapper')  
           ->removeDecorator('HtmlTag')  
           ->removeDecorator('Errors')  
           ->removeDecorator('Label');  
         $this->addElement($order_date_to);  
         /*************Order Date To****************************************/  

Thursday, June 26, 2014

Fix wordpress image urls in post on migration

Whenever we migrate wordpress from old domain to new domain we seldom encounter url errors where image urls in post do not get updated etc..

To Tackle this out here is a simple sql script

 UPDATE wp_posts SET post_content = REPLACE (  
 post_content,  
 'olddomain.com/wp-content/',  
 'newdomain.com/wp-content/');  

Tuesday, April 29, 2014

Linux-Scrap Website from terminal

Fool the server that we are using mozilla if unable to do via simple way
 $ wget --user-agent="Mozilla 2.0" -m http://www.itfeast.blogspot.com  
The Simple way
 $ wget -m --tries=7 "http://www.itfeast.blogspot.com"  

Sunday, April 27, 2014

Zend 1.12-Render individual form opening and closing tags

Though I am still looking for a workout of the same from zend function's.But still to get best of results I use following manually added code.
 <form action="<?php echo $this->form->getAction() ?>"  
    enctype="<?php echo $this->form->getEnctype() ?>"  
    method="<?php echo $this->form->getMethod() ?>"  
    id="<?php echo $this->form->getId() ?>"  
    class="<?php echo $this->form->getAttrib('class') ?>" >  
 </form>  


Saturday, April 26, 2014

Zend-Option Group in Zend_Form_Element_Multiselect

 $techDoc = new Zend_Form_Element_Multiselect(‘technical_doc’);  
 $techDoc->setLabel(‘Technical Documents’)  
 ->setMultiOptions(array(“Option Group 1″ => array(“option1″,”option2″,”option3″),  
 “Option Group 2″=>array(“option1″,”option2″,”option3″)));  

Tuesday, April 22, 2014

Change default wordpress login URL

Change default Login URL-Wordpress

Add the following line to the end of .htaccess

RewriteRule ^login$ http://YOUR_SITE.com/wp-login.php[NC,L]