Posts

Showing posts from December, 2015

Creating custom category attribute in Magento

In this short article contains code for  creating custom category attribute in Magento  . Run this script from your magento root folder and it will create custom attribute of type int in General group. To test whether attribute is created or not Go to your magento admin panel > catelog > manage categories and user General tab you will see  Most Popular Products attribute . <?phprequire_once('app/Mage.php');Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));$installer = new Mage_Sales_Model_Mysql4_Setup;$attribute = array( 'group' => 'General', 'type' => 'int', 'label' => 'Most Popular Products', 'input' => 'select', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_define

Matlab code for uploading images to FTP server

Following is the MATLAB Code for establishing connection with remote FTP Server and uploading image files to this Server. main_path='C:\Users\Dell\Downloads\TakeVideoTakeVideoframes';mov_path='C:\Users\Dell\Downloads\TakeVideoTakeVideoframes2';if ~exist(mov_path, 'dir')        mkdir(mov_path);end;a=dir(main_path);f = ftp('ftp.servername.com','uname','pass');cd(f,'matlab');k = 1;while ~isempty(a)fullfilename = [main_path int2str(k) '.png'];%movfullfname = [mov_path int2str(k) '.png'];disp(fullfilename);x=exist(fullfilename,'file');if x > 0x=1;end;if x        temp=0;        mput(f,fullfilename );        movefile(fullfilename,mov_path);     end;  k = k+1;      end;  

Matlab code for capturing video from webcam

Following is the Matlab Code for Capturing video from local webcam on computer and storing captured video, video frames to local storage on System. my_log = 'c:/tempfiles/videotest/test2.avi';        aviobj = avifile(my_log, 'compression','Cinepak','fps',10,'quality',100);        vid = videoinput('winvideo',1,'YUY2_640x480');         set(vid, 'ReturnedColorSpace', 'rgb');        %vid.LoggingMode = 'disk&memory';        vid.TriggerRepeat = Inf;            set(vid,'FramesPerTrigger', 50);        start(vid);                     i=0;         outputFolder = fullfile(cd, 'frames');        if ~exist(outputFolder, 'dir')        mkdir(outputFolder);        end;         while 1        i=i+1;                img=getsnapshot(vid);        %either use preview or image        image(img);        pause(0.01);        aviobj=addframe(aviobj,img);        img = imresize(img, (1/2));        outputBase