Tutorial by Examples: ect

Professionally made web applications don't expose the internal details of the server environment to the user. When you place an order at your retailer, you don't see (or have to type) https://mydealer.com:8443/Dealerapp/entryPage.html, but just mydealer.com, although the app server needs all the det...
MongoDB.connect('mongodb://localhost:27017/databaseName', function(error, database) { if(error) return console.log(error); const collection = database.collection('collectionName'); collection.insert({key: 'value'}, function(error, result) { console.log(error, result); }); }...
const MongoDB = require('mongodb'); MongoDB.connect('mongodb://localhost:27017/databaseName') .then(function(database) { const collection = database.collection('collectionName'); return collection.insert({key: 'value'}); }) .then(function(result) { co...
To detect a touch in Unity it's quite simple we just have to use Input.GetTouch() and pass it an index. using UnityEngine; using System.Collections; public class TouchExample : MonoBehaviour { void Update() { if (Input.touchCount > 0 && Input.GetTouch(0).phase == Touch...
$skuList = array('SKU-1', 'SKU-2',...,'SKU-n); $_productCollection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToFilter('sku', array('in' => $skuList)); OR $_productCollection = Mage::getResourceModel('catalog/product_collection') ->addAttributeToFilter('s...
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var foo = new ClassWithDependency(); foo.DoSomething(); var bar = new InjectedDependency(); foo.Dependency = bar; ...
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var dep = new DefaultDependency(); var foo = new ClassWithDependency(dep); foo.DoSomething(); var bar = new Injected...
Imagine you have a class manager to manages sending mails (be called MailManager). In this, you have to log mails that are sent. A good solution is to transform the MailManager class into a service and then inject class for creating logs (Monolog for example) into the MailManager creating a service...
QVector<T> provides dynamic array template class. It provides better performance in most cases than QList<T> so it should be first choice. It can be initialized in various ways: QVector<int> vect; vect << 1 << 2 << 3; QVector<int> v {1, 2, 3, 4}; Th...
Q_OBJECT macro appears in private section of a class. Q_OBJECT requires the class to be subclass of QObject. This macro is necessary for the class to declare its signals/slots and to use Qt meta-object system. If Meta Object Compiler (MOC) finds class with Q_OBJECT, it processes it and generates C+...
insert into schema.table (field1, field2) select 'Static Value', foreignField from schema.otherTable;
<asp:ObjectDataSource ID="ObjectDataSourceEmployees" runat="server" TypeName="MyPackage.MyDataAccessClass" DataObjectTypeName="MyPackage.Employee" SelectMethod="GetEmployees" UpdateMethod="SaveEmplo...
By default, Jackson (the library Play JSON uses) will try to map every public field to a json field with the same name. If the object has getters/setters, it will infer the name from them. So, if you have a Book class with a private field to store the ISBN and have get/set methods named getISBN/setI...
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() { ...
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 ...
Data Access Object(DAO) design pattern is a standard J2EE design pattern. In this design pattern data is accessed through classes containing methods to access data from databases or other sources, which are called data access objects. Standard practice assumes that there are POJO classes. DAO can b...
Achieving multitenancy on database server with multiple databases hosted on it. Multitenancy is common requirement of enterprise application nowadays and creating connection pool for each database in database server is not recommended. so, what we can do instead is create connection pool with datab...
docker inspect command can be used to debug the container logs. The stdout and stderr of container can be checked to debug the container, whose location can be obtained using docker inspect. Command : docker inspect <container-id> | grep Source It gives the location of containers stdout an...
It is a good practice to encrypt your Web.config file if you have sensitive information there, for example a connection string with password. With the ASP.NET IIS Registration tool (Aspnet_regiis.exe) you can easily encrypt specific sections of Web.config file. A command with elevated privileges is...
You will need the guice-bridge in your project. @ApplicationPath("api") public class ApiRest extends ResourceConfig { @Inject public ApiRest(ServiceLocator serviceLocator, ServletContext servletContext) { packages("net.sargue.app.api"); GuiceBrid...

Page 65 of 99