Tutorial by Examples: c

<!DOCTYPE html> <html> <head> <title>Styled Maps</title> <meta charset="utf-8"> <style> #map { height: 100%; } </style> </head> <body> <div id="map"></div> <script type="t...
To compile a PHP extension in a typical Linux environment, there are a few pre-requisites: Basic Unix skills (being able to operate "make" and a C compiler) An ANSI C compiler The source code for the PHP extension you want to compile Generally there are two ways to compile a PHP ex...
A Producer is some monadic action that can yield values for downstream consumption: type Producer b = Proxy X () () b yield :: Monad m => a -> Producer a m () For example: naturals :: Monad m => Producer Int m () naturals = each [1..] -- each is a utility function exported by Pipes ...
A Consumer can only await values from upstream. type Consumer a = Proxy () a () X await :: Monad m => Consumer a m a For example: fancyPrint :: MonadIO m => Consumer String m () fancyPrint = forever $ do numStr <- await liftIO $ putStrLn ("I received: " ++ numStr) ...
We use runEffect to run our Pipe: main :: IO () main = do runEffect $ naturalsUntil 10 >-> intToStr >-> fancyPrint Note that runEffect requires an Effect, which is a self-contained Proxy with no inputs or outputs: runEffect :: Monad m => Effect m r -> m r type Effect = Pr...
To run script in debug mode you should add -d option in the command line: $perl -d script.pl If t is specified, it indicates to the debugger that threads will be used in the code being debugged: $perl -dt script.pl Additional info at perldocperlrun
Sometimes a complex IF condition is needed. Let's take and example, Assuming we have the following raw data: ItemIDItem NameItem Status1Item 1Tentative1Item 1Pending1Item 1Approved The Goal is: Let's assume our business user ask to see which items are not approved and which are approved. Tentati...
Use >-> to connect Producers, Consumers and Pipes to compose larger Pipe functions. printNaturals :: MonadIO m => Effect m () printNaturals = naturalsUntil 10 >-> intToStr >-> fancyPrint Producer, Consumer, Pipe, and Effect types are all defined in terms of the general Prox...
data: lv_temp type string. data: ls_temp type sy. data: lt_temp type table of sy.
Unsafe is stored as a private field that cannot be accessed directly. The constructor is private and the only method to access public static Unsafe getUnsafe() has privileged access. By use of reflection, there is a work-around to make private fields accessible: public static final Unsafe UNSAFE; ...
User controls are made for reusability across ASP.NET pages, similar to master pages. Instead of sharing base page layout, user controls share group of HTML/ASP.NET built-in server controls or a specific form layout, e.g. comment submission or guest notes. A user control can contain both HTML contr...
If you want to instantiate an instance of user control inside ASPX code behind page, you need to write user control declaration on Page_Load event as follows: public partial class Default : System.Web.UI.Page { protected void Page_Load(Object sender, EventArgs e) { Control contr...
Like standard ASP.NET built-in server controls, user controls can have properties (attributes) on its definition tag. Suppose you want to add color effect on UserControl.ascx file like this: <uc:UserControl ID="UserControl1" runat="server" Color="blue" /> At t...
Where a method to be tested uses information from one call to pass on to subsequent calls, one approach that can be used to ensure the methods are called in the expected order is to setup the expectations to reflect this flow of data. Given the method to test: public void MethodToTest() { va...
When you can't / don't want to use Strict Mocks, you can't use MockSequence to validate call order. An alternate approach is to use callbacks to validate that the Setup expectations are being invoked in the expected order. Given the following method to test: public void MethodToTest() { _ut...
Moq provides support for validating call order using MockSequence, however it only works when using Strict mocks. So, Given the following method to test: public void MethodToTest() { _utility.Operation1("1111"); _utility.Operation2("2222"); _utility.Operation3(&...
Mocking an interface that inherits from IEnumerable to return canned data is quite straightforward. Assuming the following classes: public class DataClass { public int Id { get; set; } } public interface IEnumerableClass : IEnumerable<DataClass> { } The following approach can ...
Assume that we are using Page object model. Page Object class: import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public cla...
Given you've already installed composer up and running and it's accessible globally, you can simply create new Symfony projects as stated in the official documentation. Now you can create a new Symfony project with composer: composer create-project symfony/framework-standard-edition my_project_nam...
CppUTest is an xUnit-style framework for unit testing C and C++. It is written in C++ and aims for portability and simplicity in design. It has support for memory leak detection, building mocks, and running its tests along with the Google Test. Comes with helper scripts and sample projects for Visua...

Page 573 of 826