Tutorial by Examples: al

$router = new \Phalcon\Mvc\Router(false); $router->removeExtraSlashes(true); $request = new \Phalcon\Http\Request(); $action = strtolower($request->getMethod()); // get, post, etc. $modules = ['calendar', 'main', 'user']; // names of the modules you create // you can define other static...
Step 1: Locate your download of Node.js, typically it is installed under C:/program files/nodejs Step 2: Open Visual Studios and navigate to "Tools>Options" Step 3: In the options window navigate to "Projects and Solutions>External Web Tools" Step 4: Add new entry with y...
If Sitecore is setup in a CM-CD enviornment there could be a need to fire events on CD server when CM events are fired. The example could be firing publish:end:remote on CD when content editors done publish on CM. In order to make sure that events are firing the following steps are required to be ...
This example shows how to perform basic mathematical operations using BigDecimals. 1.Addition BigDecimal a = new BigDecimal("5"); BigDecimal b = new BigDecimal("7"); //Equivalent to result = a + b BigDecimal result = a.add(b); System.out.println(result); Result : 12 ...
What we have is a list of credit cards and we'd like to calculate the premiums for all those cards that the credit card company has to pay out. The premiums themselves depend on the total number of credit cards, so that the company adjust them accordingly. We already have a function that calculate...
Gson gson = new Gson(); //Create a Gson object MyType target = new MyType(); //This is the object you want to convert to JSON String json = gson.toJson(target); // serializes target to Json MyType target2 = gson.fromJson(json, MyType.class); // deserializes json into target2
Any String can be evaluated at runtime. class Example def self.foo :foo end end eval "Example.foo" #=> :foo
Ruby keeps track of local variables and self variable via an object called binding. We can get binding of a scope with calling Kernel#binding and evaluate string inside a binding via Binding#eval. b = proc do local_variable = :local binding end.call b.eval "local_variable" #=&gt...
The instance_eval method is available on all objects. It evaluates code in the context of the receiver: object = Object.new object.instance_eval do @variable = :value end object.instance_variable_get :@variable # => :value instance_eval sets self to object for the duration of the co...
For browsers that do not support the progress element, you can use this as a workaround. <progress max="100" value="20"> <div class="progress-bar"> <span style="width: 20%;">Progress: 20%</span> </div> </pr...
C99 Since C99, C has variable length arrays, VLA, that model arrays with bounds that are only known at initialization time. While you have to be careful not to allocate too large VLA (they might smash your stack), using pointers to VLA and using them in sizeof expressions is fine. double sumAll(si...
We can declare a series of expressions in the REPL like this: Prelude> let x = 5 Prelude> let y = 2 * 5 + x Prelude> let result = y * 10 Prelude> x 5 Prelude> y 15 Prelude> result 150 To declare the same values in a file we write the following: -- demo.hs module De...
Suppose we have an array of integers and we want to figure out the maximum value without holding the whole array in memory all at once. This approach can be adapted to handle a variety of other situations in which data needs to be processed while being deserialized instead of after. extern crate se...
Selecting only the attribute value of a link:href will return the relative URL. String bodyFragment = "<div><a href=\"/documentation\">Stack Overflow Documentation</a></div>"; Document doc = Jsoup.parseBodyFragment(bodyFragment); ...
Sometimes we need to change words position from one place to another or reduce size of the words and change the color of words automatically to improve the attraction of our website or web apps. JQuery helps a lot with this concept using fadeIn(), hide(), slideDown() but its functionality are limite...
When using interop methods, you can use GetLastError API to get additional information on you API calls. DllImport Attribute SetLastError Attribute SetLastError=true Indicates that the callee will call SetLastError (Win32 API function). SetLastError=false Indicates that the callee will not call...
img{ float:left; width:100px; margin:0 10px; } .div1{ background:#f1f1f1; /* does not create block formatting context */ } .div2{ background:#f1f1f1; overflow:hidden; /* creates block formatting context */ } https://jsfiddle.net/MadalinaTn/qkwwmu6m/2/ Using the o...
private List<FooBar> _fooBars; public List<FooBar> FooBars { get { return _fooBars ?? (_fooBars = new List<FooBar>()); } } The first time the property .FooBars is accessed the _fooBars variable will evaluate as null, thus falling through to the assignment statement ass...
Noting that zip transposes a tuple of lists into a list of tuples, ghci> uncurry zip ([1,2],[3,4]) [(1,3), (2,4)] and the similarity between the types of transpose and sequenceA, -- transpose exchanges the inner list with the outer list -- +---+-->--+-+ -- | | ...
C++11 The alignas keyword can be used to force a variable, class data member, declaration or definition of a class, or declaration or definition of an enum, to have a particular alignment, if supported. It comes in two forms: alignas(x), where x is a constant expression, gives the entity the ali...

Page 135 of 269