This is second part of the guide of how to implement custom function into Google Drive Spreadsheets.
UPDATE: If you would like to easily update calculated values from this custom function, than you have to go following way: http://stackoverflow.com/questions/17341399/refresh-data-retrieved-by-a-custom-function-in-google-spreadsheet – I just followed mentioned guide there and I have extra button in menu now, which allows me easily refresh all values which were calculated by my custom function.
I have been receiving many questions how exactly use the script mentioned in previous part of this guide so I decided, that it would be better to write it down incl. screenshots.
Get URL paths of your magento folder structure – Absolute URL Path
Mage::getBaseUrl() => Gets base url path e.g. http://my.website.com/
Mage::getBaseUrl(‘media’) => Gets MEDIA folder path e.g. http://my.website.com/media/
Mage::getBaseUrl(‘js’) => Gets JS folder path e.g. http://my.website.com/js/
Mage::getBaseUrl(‘skin’) => Gets SKIN folder path e.g. http://my.website.com/skin/
Get DIRECTORY paths (physical location of your folders on the server) – Relative URL Path
Mage::getBaseDir() => Gives you your Magento installation folder / root folder e.g. /home/kalpesh/workspace/magento
Mage::getBaseDir(‘app’) => Gives you your Magento’s APP directory file location e.g. /home/kalpesh/workspace/magento/app
Mage::getBaseDir(‘design’) => Gives you your Magento’s DESIGN directory file location e.g. /home/kalpesh/workspace/magento/design
Mage::getBaseDir(‘media’) => Gives MEDIA directory file path
Mage::getBaseDir(‘code’) => Gives CODE directory file path
Mage::getBaseDir(‘lib’) => Gives LIB directory file path
Get Current URL – whole URL path
app Mage::getBaseDir(‘app’) /var/www/magento/app/
code Mage::getBaseDir(‘code’) /var/www/magento/app/code
design Mage::getBaseDir(‘design’) /var/www/magento/app/design/
etc Mage::getBaseDir(‘etc’) /var/www/magento/app/etc
lib Mage::getBaseDir(‘lib’) /var/www/magento/lib
locale Mage::getBaseDir(‘locale’) /var/www/magento/app/locale
media Mage::getBaseDir(‘media’) /var/www/magento/media/
skin Mage::getBaseDir(‘skin’) /var/www/magento/skin/
var Mage::getBaseDir(‘var’) /var/www/magento/var/
tmp Mage::getBaseDir(‘tmp’) /var/www/magento/var/tmp
cache Mage::getBaseDir(‘cache’) /var/www/magento/var/cache
log Mage::getBaseDir(‘log’) /var/www/magento/var/log
session Mage::getBaseDir(‘session’) /var/www/magento/var/session
upload Mage::getBaseDir(‘upload’) /var/www/magento/media/upload
export Mage::getBaseDir(‘export’) /var/www/magento/var/export
FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)
If this is error, which You are getting form Bitbucket server while trying to clone Your private repository, you can try following:
- Start Git bash command line at the location where You want have Your repository cloned.
- Copy clone command from Your repository web page – like: git clone firstname.lastname@example.org:username/repositoryName.git ./desiredTargetFolderName
- first paste following command into bash: ssh -vT email@example.com
- Than run clone command and it should work
Hope it will help someone.
If You`re still having problems with pulling data from Your repository (because of permission), check Your home ssh folder, if it contains correct public key file, usually it is:
I was working on some calculations using Google Drive Spreadsheet.
Than I found out, that I would need SUM values only from cells, which has bold font… Than I found out, that there is no simple way, how to do that with basic functions included in Spreadsheet application. That was the moment, when I found out, that there is option create a custom fuction by my own needs using Google Apps Script!
I was just solving issue, where I needed to keep an order of items returned from the MySQL database listen in the WHERE IN clause.
SELECT * FROM table WHERE id IN (1,5,8,73,5,4,88)
This will return rows ordered by its primary key (in my case column id). Here is updated query, which will keep order of items listed in WHERE IN clause:
SELECT * FROM table WHERE id IN (1,5,8,73,5,4,88) ORDER BY FIELD(id,1,5,8,73,5,4,88)
Please note first item in brackets behind ORDER BY – there should be set same column, which was used at WHERE IN clause.
UPDATE: There was missing function called FIELD after ORDER BY – code is fixed now.
First of all, make sure, that you have correct settings in Your Facebook app setup. To check it, go to: https://developers.facebook.com/apps
- on the left side choose You app
- than on the top right click on “Edit App” button
- On the left should be choosen: Settings -> Basic
- Go down into the section called: “Select how your app integrates with Facebook”
- Find setup for Page Tab and check if you have set correct width of used app layout (mine was 520px)
- Save changes, if anything changed
- Than on the left choose Settings -> Advanced
- In the section “Canvas Settings” should be following setup for canvas height: fluid
When You are working with facebook apps, you do need sometimes to add administrators or moderators to Your application. If selected person is not in Your friend list, You cannot add him to the list using auto-suggest box. Thats the moment, when You will need to know user`s facebook profile id (uid). Real problem is coming when user is using Facebook vanity URL for his/her profile (like www.facebook.com/some.selected.vanity.url). Continue reading
Today I was solving generating of random data for testing and manipulation with the date of the birth.
Here are two simple SQL queries solving both:
Query for generate random date of birth in whole table
date_of_birth=CONCAT_WS('-',(FLOOR( 1900 + RAND( ) *100)),(FLOOR( 1 + RAND( ) *12 )),(FLOOR( 1 + RAND( ) *28 )))
Query for selecting date of birth and calculation of age in MySQL:
DATE_FORMAT(NOW(), '%Y') - DATE_FORMAT(date_of_birth, '%Y') - (DATE_FORMAT(NOW(), '00-%m-%d') < DATE_FORMAT(date_of_birth, '00-%m-%d')) AS age
I just got to project, which is hosted on server, where the developers has to connect via Cisco VPN to upload stuff or access SSH. Problem is, that Cisco is unable to create client, which would run with no troubles on Windows 7 64bit!!! Solution is quiet simple: Continue reading
I just needed to specify special layout for the articles of selected categories. I was looking for some solution online, but none of them worked. Mostly you can find this:
JRequest::getInt('catid', '', 'get');