store the cookie with three parts.
function onLogin($user) {
$token = GenerateRandomToken(); // generate a token, should be 128 - 256 bit
storeTokenForUser($user, $token);
$cookie = $user . ':' . $token;
$mac = hash_hmac('sha256', $cookie, SECRET_KEY);
$cookie .= ':' . $mac...
I get the file path from document directory and read that file in chunks of 1024 and save (append) to NSMutableData object or you can directly write to socket.
// MARK: - Get file data as chunks Methode.
func getFileDataInChunks() {
let doumentDirectoryPath = NSSearchPathForDirectoriesI...
The sec:authorize attribute renders its content when the attribute expression is evaluated to true
<div sec:authorize="hasRole('ROLE_ADMIN')">
Content for administrators
</div>
<div sec:authorize="hasRole('ROLE_USER')">
Content for users
</div&g...
To prepare the ios build first we need to create the cordova project.
lets create the project by the command line tool.
cordova create hello com.example.hello "HelloWorld"
Go to the project dir by cd hello.
we are now in the project directory, lets check which platforms are availa...
Get the source code from the NopCommerce website and open it in Visual Studio
In the plugins folder of NopCommerce solution, add a project of type class library with the plugin name prefixed by Nop.Plugin like Nop.Pugin.CategoryName.PluginName as the name. Then build the solution.
Dele...
Create files for your messages
messages.properties
messages_en.properties
messages_fr.properties
...
Write messages in this files like this
header.label.title=Title
Configure path to this files (in this case in folder D:/project/messages) in application properties like:
...
Upon calling a function there are new elements created on the program stack. These include some information about the function and also space (memory locations) for the parameters and the return value.
When handing over a parameter to a function the value of the used variable (or literal) is copied...
A comment starts with a forward slash followed immediately by an asterisk (/*), and ends as soon as an asterisk immediately followed by a forward slash (*/) is encountered. Everything in between these character combinations is a comment and is treated as a blank (basically ignored) by the compiler.
...
C99
C99 introduced the use of C++-style single-line comments. This type of comment starts with two forward slashes and runs to the end of a line:
// this is a comment
This type of comment does not allow multi-line comments, though it is possible to make a comment block by adding several single ...
Write message in messages.properties
welcome.message=Hello, {0}!
Replace {0} with the user name inside thymeleaf tag
<h3 th:text="#{welcome.message(${some.variable})}">Hello, Placeholder</h3>
You can add comment and status to order.
Get order :
$orderid = 12345;
$order = Mage::getModel('sales/order')->load($orderid);
And add comment:
//$isNotify means you want to notify customer or not.
$order->addStatusToHistory($status, $message, $isNotify);
$order->save()
Install by using npm install --save react-native-router-flux
In react-native-router-flux, each route is called a <Scene>
<Scene key="home" component={LogIn} title="Home" initial />
key A unique string that can be used to refer to the particular scene.
componen...
Define a custom loss function:
import keras.backend as K
def euclidean_distance_loss(y_true, y_pred):
"""
Euclidean distance loss
https://en.wikipedia.org/wiki/Euclidean_distance
:param y_true: TensorFlow/Theano tensor
:param y_pred: TensorFlow/Theano ...
This example will help to verify the given time is within a period or not.
To check the time is today, We can use DateUtils class
boolean isToday = DateUtils.isToday(timeInMillis);
To check the time is within a week,
private static boolean isWithinWeek(final long millis) {
return System.c...
You can use list variable to form <select> elements
<select th:field="*{countries}">
<option th:each="country: ${countries}"
th:value="${country.id}"
th:text="#{${'selected.label.' + country.name}}"/>
<...
Large chunks of code can also be "commented out" using the preprocessor directives #if 0 and #endif. This is useful when the code contains multi-line comments that otherwise would not nest.
#if 0 /* Starts the "comment", anything from here on is removed by preprocessor */
/*...