Wednesday, September 29, 2010

How to connect to FTP without any software

Steps

1. Open your browser
2. In browser type : ftp://@ (eg : ftp://dowgeneric@ftp.operative.com) Press enter
3. Enter ftp password.

You will redirect to home ftp directory.

Sunday, September 19, 2010

Salesforce.com Apex Classes and Apex Triggers

Apex Classes:
-------------
You can write sf.com Apex code in Apex classes. Using this Apex classes you can call your own application and pass data from sf.com.

Apex classes can be called from Apex Triggers. Apex classes having logging mechanism. You can create apex classes with any salesforce.com Versions.

Setup -> App Setup -> Develop -> Apex Classes

Apex Triggers:
---------------
You can create your own Apex triggers, and the trigger can be called when you create / update accounts, contacts, opportunity etc..

From Apex trigger you can call your Apex Classes and Apex class will sync information to your application.

Setup -> App Setup -> Develop -> Apex Triggers

This apex classes and Apex Triggers is specific to the sf.com credential, in which credential you deployed.

Debug sf.com System Logs:
--------------------------
Login into sf.com. In the top right corner you can see System Log next to setup. Click System Log (Its for debugging and executing and testing your classes and triggers).
1. Click show filter settings (Make sure Apex Code : DEBUG level for debugging the errors.)

Type the Apex trigger / class code in Execute Apex and click 'Execute' button. See the errors in errors log list.

Friday, September 17, 2010

SalesForce.com Setup Info.

Reset Security Token
---------------------
Security token is necessary when you use api salesforce.com with credentials.
Login into sf.com -> In top right click Setup -> In Personal Setup expand My personal Information -> Click 'Reset my security token'.

Reset Owner Email address for activation etc..
------------------------------------------------
Login into sf.com -> In top right click Setup -> In Personal Setup expand Email -> My Email Settings

Add Trusted Ip's in salesforce.com
-----------------------------------
When you send any request from your organization system through api to salesforce.com with username and password which will not allow with out security token. So, you can add your ip in trusted ip's in salesforce.com. So, which will allow api transaction.

Login into sf.com Setup -> Administration Setup -> Security Controls -> Network Access

Invoking triggers from sf.com to your application:
---------------------------------------------------
If you need to invoke triggers from sf.com to your application, you need add your application web address in All Remote Sites in sf.com

Login into sf.com Setup -> Administration Setup -> Security Controls -> Remote Site Settings -> create New view

Tuesday, September 7, 2010

Dumping MySQL Stored Procedures, Functions and Triggers

Below is the command, Dumping StoredProcedures along with database.

-R - Dump the stored procedures, functions and triggers

 --single-transaction - This command is needed when we take mysqldump to avoid transactions locking tables. you can add --quick for large tables. This option should not use for clustered tables.


Dump the db and skip the definer before we do for the views
mysqldump -u -p -h -R  --single-transaction  | sed 's/DEFINER=[^*]*\*/\*/' > outputfile.sql

Command to take a backup of only stored procedures and functions

mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt --skip-trigger > outputfile.sql


--no-data --routines --events --triggers

#databases=`mysql --user="" --password="" --host="" -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`


username=$1
password=$2
databases=("db1" "db2" )

for db in ${databases[@]}; do
  if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] && [[ "$db" != "$IGNORE_DATABASE" ]] && [[ "$db" != "sys" ]]; then

echo "Dumping DDL database: $db"

# No Data
mysqldump --user="${username}" --password="${password}" --host="${host}" --no-data --routines --events --triggers "$db" > ./"V1__create_initial_scheme_${db}".sql

  fi
done

mysqldump --user="${username}" --password="${password}" --host="${host}" --no-create-info --skip-triggers --compact "alerts_configs" alert_types alert_notification_templates > ./"default-master-data_alerts_configs".sql

Dump selected tables
mysqldump -uuser -ppwd --tables tblName1 tblName2 > dbname_tables.sql

Issue i faced when i export routines and import.

This version of MySQL doesn’t yet support ‘multiple triggers with the same action time and event for one table’

Use –skip-triggers also. To avoid above error. Because, triggers are default loaded in mysqldump.

Importing outputfile.sql is usual as MySQL database import.
use information_schema;
select ROUTINE_NAME from ROUTINES where ROUTINE_SCHEMA = '' ;
select TRIGGER_NAME from TRIGGERS where TRIGGER_SCHEMA = '' ;



Stored procedure in mysql introduced after 5.x

-- Stored Procedure
DELIMITER $$
DROP PROCEDURE IF EXISTS MIGRATE_CUSTOMER_FIELD_MAPPING_DATA$$
CREATE PROCEDURE MIGRATE_CUSTOMER_FIELD_MAPPING_DATA()
BEGIN
-- Declare the variables in the beginning
DECLARE no_more_customer INT DEFAULT 0;
DECLARE customer_id int(11);

-- Declare the cursor
DECLARE cur_customer CURSOR FOR
  SELECT ID FROM CUSTOMER;

-- Declare handler for exception
  DECLARE CONTINUE HANDLER FOR NOT FOUND
SET no_more_customer = 1;

-- Open the cursor
OPEN cur_customer;
-- Fetch the data from cursor into variable
FETCH cur_customer INTO customer_id;
REPEAT
 INSERT INTO CUSTOMER_FIELD_MAPPING(CUSTOMER_ID, DEVICE_TYPE_ID, SERIAL_NUMBER_UNIQ, ZIGBEE_MAC_ID_UNIQ,CREATED_ON)
       VALUES (customer_id, 1, "TRUE", "TRUE", NOW());

 INSERT INTO CUSTOMER_FIELD_MAPPING(CUSTOMER_ID, DEVICE_TYPE_ID, SERIAL_NUMBER_UNIQ, ZIGBEE_MAC_ID_UNIQ,CREATED_ON)
       VALUES (customer_id, 2, "TRUE", "TRUE", NOW());

FETCH cur_customer INTO customer_id;
UNTIL no_more_customer = 1
END REPEAT;
-- close the cursor
CLOSE cur_customer;

-- End the stored procedure with delimiter
END$$

DELIMITER ;

call MIGRATE_CUSTOMER_FIELD_MAPPING_DATA();

DROP PROCEDURE IF EXISTS MIGRATE_CUSTOMER_FIELD_MAPPING_DATA;




// Below script tag for SyntaxHighLighter