Tutorial by Examples: c

I use Spring Boot 1.4.4.RELEASE , with MySQL as the Database and Spring Data JPA abstraction to work with MySQL. Indeed ,it is the Spring Data JPA module that makes it so easy to set up Pagination in a Spring boot app in the first place. Scenario expose an endpoint /students/classroom/{id} . It wi...
A program can easily waste time by calling a processor-intensive function multiple times. For example, take a function which looks like this: it returns an integer if the input value can produce one, else None: def intensive_f(value): # int -> Optional[int] # complex, and time-consuming cod...
By default STI model class name is stored in a column named type. But its name can be changed by overriding inheritance_column value in a base class. E.g.: class User < ActiveRecord::Base self.inheritance_column = :entity_type # can be string as well end class Admin < User; end Migr...
Having type column in a Rails model without invoking STI can be achieved by assigning :_type_disabled to inheritance_column: class User < ActiveRecord::Base self.inheritance_column = :_type_disabled end
In a basic implementation the task module must define a run/1 function that takes a list of arguments. E.g. def run(args) do ... end defmodule Mix.Tasks.Example_Task do use Mix.Task @shortdoc "Example_Task prints hello + its arguments" def run(args) do IO.puts "Hello ...
We'll assume you're doing this in Visual Studio 2015 (VS 2015 Community, in my case). Create an empty Console project in VS. In Project | Properties change the Output Type to Windows Application. Next, use NuGet to add FsXaml.Wpf to the project; this package was created by the estimable Reed Cop...
Presumably, your program will do something. Add your working code to the project in place of Program.fs. In this case, our task is to draw spirograph curves on a Window Canvas. This is accomplished using Spirograph.fs, below. namespace Spirograph // open System.Windows does not automatically o...
You have to create a XAML file that defines the main window that contains our menu and drawing space. Here's the XAML code in MainWindow.xaml: <!-- This defines the main window, with a menu and a canvas. Note that the Height and Width are overridden in code to be 2/3 the dimensions of the...
The XAML file for the spirograph parameters is below. It includes three text boxes for the spirograph parameters and a group of three radio buttons for color. When we give radio buttons the same group name - as we have here - WPF handles the on/off switching when one is selected. <!-- This fi...
namespace Spirograph type MainWindow(app: App, model: Model) as this = inherit MainWindowXaml() let myApp = app let myModel = model let whenLoaded _ = () let whenClosing _ = () let whenClosed _ = () let menuExitHandler _ = System.Wind...
In MVC, there are some scenerios where you want to specify an action for routing purposes, either for a link, form action, or a redirect to action. You can specify an action via the MVC namespace. When given a Controller, such as HomeController: public class HomeController : Controller { pub...
ASP.Net exposes Cache API to store data in the cache for retrieval later. Getting Started Store string Cache["key"]="value"; Retrieve string var value=""; if (Cache["key"] != null) value = Cache["key"].ToString(); You can also use t...
By unlisted package, I mean a package that is not available through Package Control (yet). So, you can't find it in packagecontrol.io. BUT, you can still install it using Package Control, so you'll get all the advantages. For example, they'll be automatically updated, just like a "regular&quot...
Main Component File: //our root app component import {Component, NgModule, ViewChild, ViewContainerRef, ComponentFactoryResolver, ComponentRef} from '@angular/core' import {BrowserModule} from '@angular/platform-browser' import {ChildComponent} from './childComp.ts' @Component({ selector: ...
Let's say we want to move a given date a numof months. We can define the following function, that uses the mondate package: moveNumOfMonths <- function(date, num) { as.Date(mondate(date) + num) } It moves consistently the month part of the date and adjusting the day, in case the date re...
To get a list of the service on your system, you may run: service --status-all The output of service --status-all lists the state of services controlled by System V. The + indicates the service is running, - indicates a stopped service. You can see this by running service SERVICENAME status for...
ng new NewProject or ng init NewProject
The Flexbox (Flexible box) layout, introduced in CSS3 provides a more efficient way to lay out, align and distribute space among children elements(flex items) within a container element(flex container). Most importantly even when their sizes are unknown or dynamic and hence the term "flex"...
Caveat: alloca is only mentioned here for the sake of completeness. It is entirely non-portable (not covered by any of the common standards) and has a number of potentially dangerous features that make it un-safe for the unaware. Modern C code should replace it with Variable Length Arrays (VLA). Ma...
import sys from PyQt5.QtWidgets import QApplication, QWidget from PyQt5.QtGui import QIcon class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.setGeometry(300, 30...

Page 714 of 826