Tutorial by Examples: a

Event Type- DDL_COMMAND_START DDL_COMMAND_END SQL_DROP This is example for creating an Event Trigger and logging DDL_COMMAND_START events. CREATE TABLE TAB_EVENT_LOGS( DATE_TIME TIMESTAMP, EVENT_NAME TEXT, REMARKS TEXT ); CREATE OR REPLACE FUNCTION FN_LOG_EVENT() RETURNS EVE...
var="hello" function foo(){ echo $var } foo Will obviously output "hello", but this works the other way around too: function foo() { var="hello" } foo echo $var Will also output "hello"
function foo() { local var var="hello" } foo echo $var Will output nothing, as var is a variable local to the function foo, and its value is not visible from outside of it.
Calculating the power of a given number can be done recursively as well. Given a base number n and exponent e, we need to make sure to split the problem in chunks by decreasing the exponent e. Theoretical Example: 2² = 2x2 2³ = 2x2x2 or, 2³ = 2² x 2In there lies the secret of our recursive al...
This example shows a very basic example of how to utilize onCommand. I don't suggest processing your commands directly in onCommand, but this does the trick for this simple case. In this example we attempt to set the player's gamemode. The first thing we need to do is make sure that the sender isn...
Most examples show instantiating and holding a LazySingleton object until the owning application has terminated, even if that object is no longer needed by the application. A solution to this is to implement IDisposable and set the object instance to null as follows: public class LazySingleton : ID...
systemd is the de facto init system in most Linux distributions. After Node has been configured to run with systemd, it's possible to use the service command to manage it. First of all, it needs a config file, let's create it. For Debian based distros, it will be in /etc/systemd/system/node.service...
Creating a project in scala is very similar to creating one in java. Here is what the entry class should look like: package com.example.myplugin; //{$TopLevelDomain}.{$Domain}.{$PluginName} import org.bukkit.plugin.java.JavaPlugin import org.bukkit.command.CommandSender import org.bukkit.comma...
Mage::helper('catalog/image')->init($item->getProduct(), 'thumbnail'); Mage::helper('catalog/image')->init($item->getProduct(), 'small_image'); Mage::helper('catalog/image')->init($item->getProduct(), 'image');
Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getThumbnail()); //Thumbnail Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getSmallImage()); //Small Image Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage(...
$rootId = Mage::app()->getStore($storeId)->getRootCategoryId(); $categories = Mage::getModel('catalog/category')->getCollection() ->addAttributeToSelect('*') ->addFieldToFilter('path', array('like'=> "1/$rootId/%")) ->addAttributeToFilter('level', 2...
SET FOREIGN_KEY_CHECKS=0; -- Customers TRUNCATE `customer_address_entity`; TRUNCATE `customer_address_entity_datetime`; TRUNCATE `customer_address_entity_decimal`; TRUNCATE `customer_address_entity_int`; TRUNCATE `customer_address_entity_text`; TRUNCATE `customer_address_entity_varchar`; T...
SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE `catalog_product_bundle_option`; TRUNCATE TABLE `catalog_product_bundle_option_value`; TRUNCATE TABLE `catalog_product_bundle_selection`; TRUNCATE TABLE `catalog_product_entity_datetime`; TRUNCATE TABLE `catalog_product_entity_decimal`; TRUNCATE TAB...
SET FOREIGN_KEY_CHECKS=0; TRUNCATE `sales_payment_transaction`; TRUNCATE `sales_flat_creditmemo`; TRUNCATE `sales_flat_creditmemo_comment`; TRUNCATE `sales_flat_creditmemo_grid`; TRUNCATE `sales_flat_creditmemo_item`; TRUNCATE `sales_flat_order`; TRUNCATE `sales_flat_order_address`; TRUNCA...
SET FOREIGN_KEY_CHECKS=0; TRUNCATE `log_customer`; TRUNCATE `log_visitor`; TRUNCATE `log_visitor_info`; TRUNCATE `log_visitor_online`; TRUNCATE `log_quote`; TRUNCATE `log_summary`; TRUNCATE `log_summary_type`; TRUNCATE `log_url`; TRUNCATE `log_url_info`; TRUNCATE `sendfriend_log`; TRUNC...
{-# LANGUAGE RecordWildCards #-} import Text.XML.Light data Package = Package { pOrderNo :: String , pOrderPos :: String , pBarcode :: String , pNumber :: String } -- | Create XML from a Package instance Node Package where node qn Package {..} = node qn [ un...
A static data member of the class may be fully defined within the class definition if it is declared inline. For example, the following class may be defined in a header. Prior to C++17, it would have been necessary to provide a .cpp file to contain the definition of Foo::num_instances so that it wou...
$store = Mage::app()->getStore(); $storeId = Mage::app()->getStore()->getStoreId(); $storeCode = Mage::app()->getStore()->getCode(); $websiteId = Mage::app()->getStore()->getWebsiteId(); $storeGroupId = Mage::app()->getStore()->getGroupId(); $storeName = Mage::app()-&...
Custom attribute in sales related tables like: sales_flat_quote, sales_flat_order_item, sales_flat_order, etc table In your installation file sql/some_setup/mysql-install-0.1.0.php: <?php $installer = $this; $installer->startSetup(); $installer->addAttribute('quote', 'custom_field'...
Since a signal handler will be called by the kernel using the C calling convention, we must tell the compiler to use the C calling convention when compiling the function. volatile sig_atomic_t death_signal = 0; extern "C" void cleanup(int signum) { death_signal = signum; } int mai...

Page 954 of 1099