Tutorial by Examples: st

var JSONObject = { stringProp: 'stringProp', booleanProp: false, intProp: 8 } var JSONString = JSON.stringify(JSONObject); console.log(JSONString); /* output * {"stringProp":"stringProp","booleanProp":false,"intProp":8} */
var JSONObject = { stringProp: 'stringProp', booleanProp: false, intProp: 8 } var JSONString = JSON.stringify(JSONObject, ['intProp']); console.log(JSONString); /* output * {"intProp":8} */
var JSONObject = { stringProp: 'stringProp', booleanProp: false, intProp: 8 } var JSONString = JSON.stringify(JSONObject, null, 2); console.log(JSONString); /* output: * { * "stringProp": "stringProp", * "booleanProp": false, * "...
Usually you'll end up creating models which will contain a state, and that state will be changing during the lifespan of the object. AASM is a finite state machine enabler library that can help you out with dealing with having an easy passing through the process design of your objects. Having some...
A broadcast join copies the small data to the worker nodes which leads to a highly efficient and super-fast join. When we are joining two datasets and one of the datasets is much smaller than the other (e.g when the small dataset can fit into memory), then we should use a Broadcast Hash Join. The f...
RESTlets allow us to build custom REST-based endpoints into NetSuite; thus, RESTlets form the backbone of nearly any integration into NetSuite. RESTlets provide individual event handlers for four of the most commonly used HTTP request methods: GET POST PUT DELETE When a RESTlet receives a ...
Lastly, we have the Bundle Installation script type, which provides several events that allow us to interact with the installation, update, and uninstallation of a particular bundle. This is a rarely-encountered script type, but important to be aware of nonetheless. The Bundle Installation includes...
This is a step by step guide to set up the automated build process using Jenkins CI for your Android projects. The following steps assume that you have new hardware with just any flavor of Linux installed. It is also taken into account that you might have a remote machine. PART I: Initial setup on ...
There are two type of supervision strategies that we follow to supervise any actor: One-For-One Strategy One-For-All Strategy case object ResumeException extends Exception case object StopException extends Exception case object RestartException extends Exception override v...
Let say you want to build your API to comply jsonapi.org specification and the result should look like: { "article": { "id": "305", "type": "articles", "attributes": { "title": "Asking Alexandria&q...
Connecting to Cassandra is very similar to connecting to other datasources. With Cassandra, credentials are not required. String cassandraIPAddress = "127.0.0.1"; String cassandraKeyspace = "myKeyspace"; String username = "foo"; String password = "bar"; ...
Nested serializers by default don't support create and update. To support this without duplicating DRF create/update logic, it is important to remove the nested data from validated_data before delegating to super: # an ordinary serializer class UserProfileSerializer(serializers.ModelSerializer): ...
If you have a stored DATE or DATETIME (in a column somewhere) it was stored with respect to some time zone, but in MySQL the time zone is not stored with the value. So, if you want to convert it to another time zone, you can, but you must know the original time zone. Using CONVERT_TZ() does the con...
This is really easy. All TIMESTAMP values are stored in universal time, and always converted to the present time_zone setting whenever they are rendered. SET SESSION time_zone='America/Los_Angeles'; SELECT timestamp_sold FROM sales WHERE state_sold = 'CA' Why is this? TIMESTAMP values are...
Javascript timestamps are based on the venerable UNIX time_t data type, and show the number of milliseconds since 1970-01-01 00:00:00 UTC. This expression gets the current time as a Javascript timestamp integer. (It does so correctly regardless of the current time_zone setting.) ROUND(UNIX_TIMEST...
CREATE TABLE times ( dt DATETIME(3), ts TIMESTAMP(3) ); makes a table with millisecond-precision date / time fields. INSERT INTO times VALUES (NOW(3), NOW(3)); inserts a row containing NOW() values with millisecond precision into the table. INSERT INTO times VALUES ('2015-01...
If you have a Javascript timestamp value, for example 1478960868932, you can convert that to a MySQL fractional time value like this: FROM_UNIXTIME(1478960868932 * 0.001) It's simple to use that kind of expression to store your Javascript timestamp into a MySQL table. Do this: INSERT INTO table...
Here's an example of a React component with a "managed" input field. Whenever the value of the input field changes, an event handler is called which updates the state of the component with the new value of the input field. The call to setState in the event handler will trigger a call to ...
Unit tests test parts of the application in isolation. usually a unit under test is a class or module. let(:gift) { create :gift } describe '#find' do subject { described_class.find(user, Time.zone.now.to_date) } it { is_expected.to eq gift } end source This kind if test is as direct ...
Request tests are end to end tests that imitate the behavior of a user. it 'allows the user to set their preferences' do check 'Ruby' click_on 'Save and Continue' expect(user.languages).to eq ['Ruby'] end source This kind of test focuses on user flows and runs through all layers of th...

Page 280 of 369