Tutorial by Examples: c

After the install of an IoC (Inversion of Control) container, some tweaks are needed to make it work. In this case, I'll use Ninject. In the NinjectWebCommon file, that is located in the App_Start folder, substitute the CreateKernel method with: private static IKernel CreateKernel() { ...
In the concrete class that need the service, use the interface to access the service instead of its implementation like: public class BenefitAppService { private readonly IBenefitService _service; public BenefitAppService(IBenefitService service) { _service = service; ...
By default, the full indexed document is returned as part of all searches. This is referred to as the source (_source field in the search hits). If we don’t want the entire source document returned, we have the ability to request only a few fields from within source to be returned, or we can set _so...
By default, a Docker container won't be able to run a GUI application. Before that, the X11 socket must be forwarded first to the container, so it can be used directly. The DISPLAY environment variable must be forwarded as well: docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY &...
Since Node is single-threaded, there is a need of workaround if it comes to a long-running calculations. Note: this is "ready to run" example. Just, don't forget to get jQuery and install the required modules. Main logic of this example: Client sends request to the server. Server sta...
Arrays in MATLAB are held as continuous blocks in memory, allocated and released automatically by MATLAB. MATLAB hides memory management operations such as resizing of an array behind easy to use syntax: a = 1:4 a = 1 2 3 4 a(5) = 10 % or alternatively a = [a, 10] a = ...
<asp:Literal runat="server" text="<%$ AppSettings:MyAppSettingName %>"/>
<div> <form id="form1" runat="server"> <% for (int i = 1; i <= 10; j++) { Response.Write(i) + " "; } %> </form> <div>
Docs file (Input File) Mary had a little lamb its fleece was white as snow and everywhere that Mary went the lamb was sure to go. Hive Query CREATE TABLE FILES (line STRING); LOAD DATA INPATH 'docs' OVERWRITE INTO TABLE FILES; CREATE TABLE word_counts AS SELECT word, count(1) AS count F...
When reading a potentially large file, a while loop has a significant memory advantage over foreach. The following will read the file record by record (by default, "record" means "a line", as specified by $/), assigning each one to $_ as it is read: while(<$fh>) { pri...
If you have a list in memory already, the straightforward and usually sufficient way to process it is a simple foreach loop: foreach my $item (@items) { ... } This is fine e.g. for the common case of doing some processing on $item and then writing it out to a file without keeping the data ...
There are many fine ways to get this done, which others have already suggested. Following along the "get Excel data via SQL track", here are some pointers. Excel has the "Data Connection Wizard" which allows you to import or link from another data source or even within the very ...
php artisan make:request StoreUserRequest php artisan make:request UpdateUserRequest Note: You can also consider using names like StoreUser or UpdateUser (without Request appendix) since your FormRequests are placed in folder app/Http/Requests/.
Sometimes it is necessary to assert when an exception is thrown. Different unit testing frameworks have different conventions for asserting that an exception was thrown, (like NUnit's Assert.Throws method). This example does not use any framework specific methods, just built in exception handling. ...
docker network create -o "com.docker.network.bridge.enable_ip_masquerade"="false" lan-restricted Blocks Local LAN Internet Does not block Host running docker daemon (example access to 10.0.1.10:22)
docker network create -o "com.docker.network.bridge.enable_icc"="false" icc-restricted Blocks Containers accessing other containers on the same icc-restricted network. Does not block Access to host running docker daemon Local LAN Internet
iptables -I INPUT -i docker0 -m addrtype --dst-type LOCAL -j DROP Blocks Access to host running docker daemon Does not block Container to container traffic Local LAN Internet Custom docker networks that doesn't use docker0
docker network create --subnet=192.168.0.0/24 --gateway=192.168.0.1 --ip-range=192.168.0.0/25 local-host-restricted iptables -I INPUT -s 192.168.0.0/24 -m addrtype --dst-type LOCAL -j DROP Creates a network called local-host-restricted which which: Blocks Access to host running docker daem...
Such Example is knowing wide spreading among PWAs (Progressive Web Applications) and in this example we're going to send a simple Backend like notification using NodeJS and ES6 Install Node-GCM Module : npm install node-gcm Install Socket.io : npm install socket.io Create a GCM Enable...
After succesfully setup Spring-Boot application all the configuration is handled in an application.properties file. You will find the file at src/main/resources/. Normally there is a need to have a database behind the application. For development its good to have a setup of dev and a prod environme...

Page 539 of 826