@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...
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>
Remote Power supply simulation
Since we don't have a real remote power supply hardware, we are going to simulate it
using python program.
Basic idea about RPS
Actually remote power supply has a http server.
User can send commands to turn ON/OFF power supply using http request.
We are going...
Arrays of bit-fields, pointers to bit-fields and functions returning bit-fields are not allowed.
The address operator (&) cannot be applied to bit-field members.
The data type of a bit-field must be wide enough to contain the size of the field.
The sizeof() operator cannot be applied to a b...
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...
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)}"&...