Tutorial by Examples: c

import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.widget.T...
Throwable has two direct subclasses, Exception and Error. While it's possible to create a new class that extends Throwable directly, this is inadvisable as many applications assume only Exception and Error exist. More to the point there is no practical benefit to directly subclassing Throwable, as ...
A namespace can be given an alias (i.e., another name for the same namespace) using the namespace identifier = syntax. Members of the aliased namespace can be accessed by qualifying them with the name of the alias. In the following example, the nested namespace AReallyLongName::AnotherReallyLongNam...
Call this function with parameter argument as array with type 'any'. It will return you json string. Json string is used to submit array in web service call as request input parameter in Swift. //----------------------- let array = [["one" : 1], ["two" : 2], ["three" ...
Using the magick command (or `convert for IM 6.x users) you con convert any image format to any other. with no other arguments, as little processing as possible will be done to move from one format to the other. Simply specify your input and output files. To convert a JPEG to a PNG: $ magick image....
This example demonstrate how to dynamically insert data into MySQL using Python Scrapy. You do not need to edit pipelines.py file for any project. This example can be used for all your project. Just yield you_data_dictionary from your Spider and inside pipelines.py a query will be created automat...
Enable pipelines in your settings.py ITEM_PIPELINES = { 'project_folder.pipelines.MyPipeline': 100 } Then write this code in items.py # -*- coding: utf-8 -*- from scrapy import Item, Field from collections import OrderedDict class DynamicItem(Item): def __setitem__(self, key, v...
Create a new Xamarin Forms app using PCL File -> New Solution -> Multiplatform App -> Xamarin Forms -> Forms App; Name the project as EffectsDemo Under the iOS project, add a new Effect class that inherits from PlatformEffect class and overrides the methods OnAttached, OnDetached and ...
There may be multiple reason why you want to create a text file in batch. But whatever the reason may be, this is how you do it. If you want to overwrite an existing text file use >. Example: @echo off echo info to save > text.txt But if you want to append text to an already existing t...
You may want to copy files from one place to another. In this example we'll teach you. You can use the command xcopy. The syntax is xcopy c:\From C:\To Example: @echo off xcopy C:\Folder\text.txt C:\User\Username\Desktop There are also switches you can use. If you want to view them open up co...
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...
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...
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...
$model = Mage::getModel('catalog/product')->getCollection() Filter based on store: $mode->addStoreFilter($storeId) Filter based on product type: $mode->addAttributeToFilter('type_id', 'configurable') $mode->addAttributeToFilter('type_id', 'simple') Filter based on status: $m...
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...

Page 722 of 826