Loading resources on OnLoad function

I am trying to load a json file using the cc.loader.load function in onLoad() function as shown below, I also have used some console.log() functions to see the order of execution.

const {ccclass, property} = cc._decorator;  @ccclass export default class NewClass extends cc.Component {  // LIFE-CYCLE CALLBACKS:  objectFromResource: Object  onLoad () {     console.log("Starting onLoad() Function")     var url = cc.url.raw('resources/json_resource.json')     cc.loader.load(url, (err, res) => {         cc.log(res)         this.objectFromResource = res         console.log("Loaded URL")     });     console.log("Ending onLoad() Function") }  start () {     console.log('Starting start() Function')     console.log(this.objectFromResource) //logging as null     console.log('Ending start() function') }  update (dt) {  }  } 

The output is as following:

Cocos Creator v2.1.1 JSONReader.ts:16 Starting onLoad() Function JSONReader.ts:33 Ending onLoad() Function JSONReader.ts:37 Starting start() Function JSONReader.ts:38 undefined JSONReader.ts:39 Ending start() function JSONReader.ts:22 {__type__: "cc.JsonAsset", _name: "json_resource", _objFlags: 0, _native: "", json: Array(784)} JSONReader.ts:24 Loaded URL 

The resource is loaded after the onLoad() and start() functions are completed. How to load the resource on OnLoad() function before the start() method is called?

Trouble on writing Backend code. How to begin writing server side (Backend) code for Android? or even resources to learn writing them

I’ve recently started Android Programming one month back and, I’m loving it. I also started Java along with it. I just have some C experience from college. So I’m very much a beginner.

I’m working on this project where i need to reduce operational cost of a fintech start-up so that it’s easier for it’s agents to work in rural and remote villages by creating an App for them.

It’s a simple app which lists daily collection of loans that are to be made by the agent and OTP verification of the transaction is done and customers receive their receipts through SMS.

I want my App to communicate with the server and send queries for fetching data and be able to modify the databases as and when required. Also a message functionality is required(Just to send a OTP).

One major hurdle is making the app to communicate with my cloud server. Someone told me that i need to learn WAMP server(Windows Android MySQL PHP) however i have no clue what that is. I’ve scoured the web for information over where to begin all the articles are either too advanced or too short and spoon-fed which doesn’t go into detail at all. In fact this is my first question on this topic, so please if you find something on google just let me know I may have missed but don’t downvote the question.

A solution or even pointing towards the resources will be very very helpful. Because I am totally at loss over what to do. I’ve also read about Google’s Firebase, however I’m not sure if i should use it since it reduces the learning curve and limits our flexibility.

Thank you very much

Hands on experience in data entry, content writing and in Human resources. Worked with MNC’s as well for $6

I am expertise in my field. I have 7years of experience in the field of data entry and Human Resources. You just need to share your all the requirements with me. So I can provide you the work on time.

by: kakuli001
Created: —
Category: Data Entry
Viewed: 150


UX Resources for HF engineers

I’m looking for resources which are a good introduction for Human Factors engineers to help learn UX methods, techniques and tools which may not be part of a traditional HF education.

I come from a software development background so the domain seems very natural to me, but we have a separate HF team who don’t come from a software background. There are plenty of complimentary skills and methods, but often the outputs can be different or ontology quite different.

I’ve found lots of resources, in particular pluralsight videos which aim to teach UX to software developers but nothing which really targets HF as a background.

Can anyone point me to anything dedicated, or specific examples which might resonate with an HF engineer?

When scheduling intervals across multiple resources, why sort?

I am reading this book and am at a point when the Interval Partitioning Problem is discussed. The pseudocode they provide for it is the following:

Sort the intervals by their start times, breaking ties arbitrarily Let I_1, I_2, ..., I_n denote the intervals in this order For j = 1, 2, 3, ..., n     For each interval I_i that precedes I_j in sorted order and overlaps it         Exclude the label of I_i from consideration for I_j     Endfor     If there is any label from {1, 2, ..., d} that has not been excluded then         Assign a nonexcluded label to I_j     Else         Leave I_j unlabeled     Endif Endfor 

Here n is the number of intervals and d is the depth of the intervals (the maximum number of overlapping intervals)

What I don’t understand is why sort the intervals in the first place. I think the algorithm would work even without this step. In other words, it would work no matter the order of I_1, I_2, …, I_n. Am I correct? Is there something I am missing?

Adding resources to subresource REST API

I’m trying to build an web API that closely represents a library of books. I currently have the following routes.

  • GET /api/books
  • GET /api/books/:bookID
  • GET /api/libraries
  • POST /api/libraries
    • This route currently accepts a books parameter in the body (with the body represented as an object), that should be an array of bookIDs.
  • GET /api/libraries/:libraryID
  • DELETE /api/libraries/:libraryID

What I’m trying to decide is how to allow users to add/delete books to an existing library.

Option 1:

  • POST /api/libraries/:libraryID/books/:bookID
    • No body will be accepted in this route
  • DELETE /api/libraries/:libraryID/books/:bookID

Option 2:

  • POST /api/libraries/:libraryID/books
    • Body will be an array of bookIDs represented as an array.
  • DELETE /api/libraries/:libraryID/books
    • Body will be an array of bookIDs represented as an array.

Option 3:

Some combination of 2 & 3, OR something completely different that I haven’t thought of yet.


What is the most common method to handle this for a REST API? In the future I might also consider PUT /api/libraries/:libraryID, but that would change the entire books array, and replace it, as opposed to just adding or deleting a specific book(s).

Access embedded resources with REST API

I am currently working on my very first REST API with embedded/nested resources and need some advice about the general workflow and implementation. Some hints about best practices and useful resources, docs etc. are very much appreciated since all I found so far was dealing with rather simple examples.

Assume having different document types customer, order and article like this (pseudo-code):

# customer {     "_id": <uuid>,     "_created" : <timestamp>,     "_edited": <timestamp>,     "name": <string>,     ... }  # order {     "_id": <uuid>,     "_created" : <timestamp>,     "_edited": <timestamp>,     "customer": <customer id>,     "paid_on": <timestamp or null>,     "articles": <array of article ids>,     ... }  # article {     "_id": <uuid>,     "_created" : <timestamp>,     "_edited": <timestamp>,     "name": <string>,     "description": <string>,     "price": <integer>,     ... } 

My API endpoints for fetching the data are:

/api/customer/<id> /api/article/<id> /api/order/<id> 

As you can see from my document structure above, an order document references both article documents and a customer document. However, when requesting an order document via a GETrequest, the retrieved data still contains un-serialized nested documents for the customer and the articles fields which are referenced by their ids.

It is quite obvious that the referenced documents need to be serialized in order to retrieve a “complete” set of data. How should that serialization be implemented according to best practices?

As a beginner I came up with the following approaches:

  • Request order document and “fill in” needed documents in front-end by performing additional requests (seems to be ugly since I this would result in many individual requests for more complex documents).
  • Implement query arguments like ?serialize="articles"&serialize="customer" or a more general ?serialize="all" (feels more elegant since it would require a single request to get the desired data, but would lead to bulky handling of query arguments in back-end when dealing with complex documents).
  • Use GraphQL to request big/complex documents (might be the Swiss-army knife for requesting nested documents, but gathering some decent REST experience before moving to advanced technologies seems to be more appropriate since I am a beginner).
  • Build REST API based on OData Protocol (might give some guide-lines about implementing “pure” REST APIs since the format/protocol is defined and eliminates one degree-of-freedom/decision in the implementation).

Some databases or database connectors might have nested document serialization implemented by default like python-eve. However, I am currently reading data from a file-based source (TinyDB which is basically a big json file), so I need to implement this on my own (final decision about database/datastorage not done yet)

Validating Static resources in a Web Application

Like most web applications mine has static resources that must be part of the deployment or the user receives a 404 response from the server. My thought was to use unit testing to validate two things 1. the resource exists, and 2. the content was not modified. I have tried the following code but it expects (I think) that the files exist in the unit test project.

Solution structure: WebApplicationProject – … – public – file.* – otherfile.* – web.config

WebApplicationProject.Tests – AssetTests.cs

Am I going about this all wrong, should this not be part of a unit test and some other gait on the CI build process (Azure DevOps), or am I missing something super obvious? I’m likely asking the wrong questions and going about this the wrong way, because I know I’m not the first person to want to do something like this.

I’ve read other posts around testing with files, but they all are using test files to drive data for input in some method that consumes the file, or some process that generates a file for comparison. I don’t want to do either of these things.

I have also played with the settings making the file an embedded resource, and to always deploy with the project, but the unit test project still cannot access the file the way I’m going about this.

[TestClass] public class AssetTests {     [TestMethod]     [DeploymentItem(@".\files\file.*")]     public void AwardLetters()     {         string path = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "file.*");// gets the working path for the testing dll, no files exist here.         Assert.IsTrue(File.Exists("file.*"), "FAIL: file {0} not found", "file.*");// nothing I have tried has access to the projects static resources     } } 

All results end in a file not found exception so far.

I am open to all suggestions, but if you suggest that I have two copies of the files, please fully explain why this is desirable.