@Controller
public class EditPetForm {
@RequestMapping("/pets")
public String setupForm(@RequestParam("petId") int petId, ModelMap model) {
Pet pet = this.clinic.loadPet(petId);
model.addAttribute("pet", pet);
return "petForm...
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...
You can show username for autenticated users
<div sec:authorize="isAuthenticated()">
Welcome, <span sec:authentication="name">Username</span>
</div>
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...
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()
data newclass(keep=first_name sex weight yearborn);
set sashelp.class(drop=height rename=(name=first_name));
yearborn=year(date())-age;
if yearborn >2002;
run;
Data specifies the target data set. Keep option specifies columns to print to target.
Set specifies source data set. Drop s...
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 ...
Get year from date
<p>
Year: <span th:text="${#dates.year(today)}">2017</span>
</p>
Get month
<p>
Month number: <span th:text="${#dates.month(today)}">8</span>
Month: <span th:text="${#dates.monthName(today)}"&...