How to Structure React and bootstrap-react projects?
Here you can see my folder structure. Is this the best practice?
|-COPYRIGHT.md
|-dist
| |-app
| |-bundle.js
| |-bundle.js.map
|
|-index.html
|-.git
|-.gitignore
|- node_modules
|-package.js
|-README.md
|
|-src
| |-app
| | |-components
| | | |-Footer.js
| | | |-Header.js
| | | |-Home.js
| | |
| | |-index.js
| |
| |-css
| | |-bootstrap.min.css
| | |-footer.css
| | |-header.css
| | |-styles.css
| |
| |-fonts
| | |-glyphicons-halflings
| |
| |-images
| | |-logo.jpg
| |
| |-index.html
| |
| |-js
| | |-es5-sham.min.js
| | |-es5-shim.min.js
| | |-html5shiv.min.js
| | |-html5shiv-printshiv.min.js
| | |-react-bootstrap.js
| | |-react-bootstrap.min.js
|
|-webpack.config.js
In the next step I would make my homepage multilingual. I need three languages de, en, fr.
I would like separate the languages like this.
How to change the languages in the Navbar?
Which of you has something already programmed and sends me a link of his Github repository? How do I program the routes correctly? In Footer I'll use three images as a flag for switching languages. But to be recognized by the browser language principle.
|-Languanges
|-de
| |-Impressum.js
|
|-en
| |-Imprint.js
|
|-fr
| |-empreinte.js
Related
The help command will not show when I do "?help", I get no errors either and just cannot figure out why it's not appearing, please help.
let embed = new discord.MessageEmbed()
.setTitle("Haunt Bot Commands")
.setDescription('Utility: ?invite | ?support | ?prefix | ?avatar | ?info | ?whois',
'Query: ?calculate | ?anime',
'Moderation: ?kick | ?ban | ?mute | ?warn | ?purge | ?warnings',
'Economy: ?bal | ?daily | ?roll | ?bet | ?give',
'Music: ?play | ?np | ?lyrics | ?pause | ?search | ?queue | ?skip | ?vol',
'Fun: ?kiss | ?hug | ?pat | ?slap | ?wink | ?cuddle',
'NSFW: ?neko | ?foxgirl')
.setThumbnail(bot.user.avatarURL({dynamic:true, size: 1024}))
.setFooter("Thank you so much for choosing Haunt, it means the world to me! <3")
.setColor("#78d7fa")
return message.noMentionReply(embed);
}
What is "noMentionReply"? Where did you get that from? I'm pretty sure the correct function is
message.channel.send(message);
let embed = new discord.MessageEmbed()
.setTitle("Haunt Bot Commands")
.setDescription('Utility: ?invite | ?support | ?prefix | ?avatar | ?info | ?whois',
'Query: ?calculate | ?anime',
'Moderation: ?kick | ?ban | ?mute | ?warn | ?purge | ?warnings',
'Economy: ?bal | ?daily | ?roll | ?bet | ?give',
'Music: ?play | ?np | ?lyrics | ?pause | ?search | ?queue | ?skip | ?vol',
'Fun: ?kiss | ?hug | ?pat | ?slap | ?wink | ?cuddle',
'NSFW: ?neko | ?foxgirl')
.setThumbnail(bot.user.avatarURL({dynamic:true, size: 1024}))
.setFooter("Thank you so much for choosing Haunt, it means the world to me! <3")
.setColor("#78d7fa")
message.channel.send(embed);
}
There isn't a "noMentionReply" function on the message object unless you defined it somewhere. If you meant to use a function, just do "noMentionReply(embed)"
I'm doing some development using Mbed Studio and after linking I see this sort of output:
Elf2Bin: test-sp2
| Module | .text | .data | .bss |
|----------------------|---------------|---------|------------|
| [lib]\c_w.l | 5900(+196) | 16(+0) | 348(+0) |
| [lib]\fz_wv.l | 26(+0) | 0(+0) | 0(+0) |
| [lib]\libcpp_w.l | 1(+0) | 0(+0) | 0(+0) |
| [lib]\libcppabi_w.l | 44(+0) | 0(+0) | 0(+0) |
| anon$$obj.o | 94(+94) | 0(+0) | 2048(+0) |
| main.o | 1798(+0) | 0(+0) | 460(+0) |
| mbed-os\cmsis | 13531(+0) | 168(+0) | 6609(+0) |
| mbed-os\connectivity | 70226(+140) | 295(+0) | 45532(+40) |
| mbed-os\drivers | 3852(-16) | 0(+0) | 0(+0) |
| mbed-os\events | 2016(+0) | 0(+0) | 3104(+0) |
| mbed-os\hal | 2090(+0) | 8(+0) | 115(+0) |
| mbed-os\platform | 9442(+0) | 64(+0) | 1104(+0) |
| mbed-os\rtos | 1792(+0) | 0(+0) | 8(+0) |
| mbed-os\targets | 34347(+1459) | 296(+0) | 394(+0) |
| Subtotals | 145159(+1873) | 847(+0) | 59722(+40) |
Total Static RAM memory (data + bss): 60569(+40) bytes
Total Flash memory (text + data): 146006(+1873) bytes
I understand what this output means, mostly.
But what do the (+xxx) next to the byte counts mean?
For example, in
| mbed-os\connectivity | 70226(+140) | 295(+0) | 45532(+40) |
What does the (+140) in the .text section mean? Could it be the change in size from the last link?
Could it be the change in size from the last link?
Yes.
I am building a system that allows users to build up their own apps with React Native. This takes place on a React website. Each user will have a base application that holds the skeleton code, however the app they build on the website should be able to deployed to the phone easily and live in the skeleton app.
Is it possible to firstly do this? Also, would AppHub or Microsoft's CodePush allow me to do this?
I realise that these apps are built for deploying new releases, however I am wanting to push specific code, to specific users.
Here's some research. We ended up moving forward with CodePush
| | apphub.io | codepush.tools | react-native-auto-updater | getsiphon.com | rollout.io |
|--------------------------------------|------------------------|----------------------------|---------------------------|----------------------|-----------------------------------------|-
| Open Source Client | y | y | y | n | |
| Image Support | y | y | n | y | |
| HTTPS | y | y | n/a | y | |
| CLI Tooling | y | y | n/a | y | |
| Gradual Rollout | n | y | n/a | n | |
| SLA | "via ""Contact Us""" | ? (beta) | n/a | "via ""Contact Us""" | |
| Cost | "via ""Contact Us"" | | | | |
| | | | | | |
| ""Scale Plan"" (no private hosting): | | | | | |
| 1100$/mo for 5m DAU | | | | | |
| 2100$/mo for 10m DAU" | ? (free in beta) | n/a | "via ""Contact Us""" | | Ask apphub about multi-env / multi-file |
| On-Premise | y | n | n/a | y | |
| Cloud Hosting | y | y | n/a | y | |
| Documented API | y | n | y | n | |
| Web UI | y | n | n/a | n | |
| iOS | y | y | y | y | |
| Android | y | y | y | y | |
| Multiple Environments | """Debug"" and normal" | y | n | n | |
| Known Packaging | y | y | y | n | |
| Contact | support#apphub.io | codepushfeed#microsoft.com | | | |
| Delta Updates | n | y | ? | ? | |
It sounds technically possible. And you would have to carefully read the respective TOS to see if it violates them.
I want to show what my UserControl/Control is doing when I plug a list of data in it, what happens when the user press certain keys, selecting text etc...
I feel somehow a sequence diagramm is not really suited for showing several loops and doing stuff within the loops.
Am I wrong or how can I cope with that case?
If you are talking about a loop, then you have a series of operations that take place for all elements in the loop.
I would model the operations done in the loop as a sequence diagram by itself, if the operation in the loop are fairly complex.
I don't think we can have rules of thumb here, but when the process with the loop itself is complex, and the loop is relatively less complex, we can have them in a single sequence diagram.
If the process that has the loop is not very complex, but the loop is complex, then I would draw a sequence diagram for the operations of the loop and have a note that this entire sequence is called by a loop.
You can also have both sequence diagrams if needed.
Update:
We have to add some notes to the diagram because it is not straightforward to denote a "condition" in a sequence diagram.
The validate is part is something like
do validation
if validation succeeds
proceed to next (business or other) logic
if validation fails
feedback to user (or some other logic)
+----+ +----+ +----------------+ +----------------+
|User| | UI | | Your Validator | | Business Logic |
+----+ +----+ +----------------+ +----------------+
| select | | |
|--------------->| doValidation | |
| |------------------>|----+ |
| | | | Validate |
| | |<---+ |
| | | |
| | | (validation fails: |
| | Validation Fail | feedback to client) |
| |<------------------| |
| | | |
| | | |
| | | (validation succeeds: |
| | | proceed to |
| | | business logic) |
| | | |
| | | someLogic |
| | |----------------------->|
| | | |
UPDATE 2
Why use sequence diagram in a case as mine?
Because you still have to show the sequence of operations, and the developer still needs this information for coding :-)
With UML, as you probably already know, nothing is imposed. You are at your freedom to denote something in some fashion, provided your team also understands it the way you intended. These notes are also helpful.
I should have mentioned this before, some use an "option" fragment to denote a if else. This is more or less a note (I see it this way) but is perhaps more evident. I use them only when both the IF and the ELSE parts are both complex.
+----+ +----+ +----------------+ +----------------+
|User| | UI | | UI - Backend | | Busines Logic |
+----+ +----+ +----------------+ +----------------+
| Add Record | | |
|--------------->| doinsertOrUpdate | |
| |------------------>| |
| | | exists(record) |
| | |----------------------->|
| | | |
____|________________|___________________|________________________|__________
|[Record exists] | | | |
| | | | Get Record | |
| | | |----------------------->| |
| | | | | |
| | | |--------+ | |
| | | | | Set UI Values | |
| | | |<-------+ | |
| | | | | |
| | | | Update Record | |
| | | |----------------------->| |
| | | | | |
| | | Send Message | | |
| | |<------------------| | |
| | | "Record found, | | |
| | | Updated" | | |
|___|________________|___________________|________________________|_________|
| | | |
| | | |
______|________________|___________________|________________________|_________
| [Record does not | | | |
| exist] | | | |
| | | |--------+ | |
| | | | | Generate | |
| | | | | Seqeuence | |
| | | |<-------+ | |
| | | | | |
| | | | Create New Record | |
| | | |----------------------->| |
| | | Send Message | | |
| | |<------------------| | |
| | | "New Record | | |
| | | Created" | | |
|_____|________________|___________________|________________________|_________|
| | | |
| | | |
| | | |
See this for an example using an alt block.
I have implemented the A* algorithm in AS3 and it works great except for one thing.
Often the resulting path does not take the most “natural” or smooth route to the target.
In my environment the object can move diagonally as inexpensively as it can move horizontally or vertically.
Here is a very simple example; the start point is marked by the S, and the end (or finish) point by the F.
| | | | | | | | | |
|S| | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
|F| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
As you can see, during the 1st round of finding, nodes [0,2], [1,2], [2,2] will all be added to the list of possible node as they all have a score of N.
The issue I’m having comes at the next point when I’m trying to decide which node to proceed with. In the example above I am using possibleNodes[0] to choose the next node. If I change this to possibleNodes[possibleNodes.length-1] I get the following path.
| | | | | | | | | |
|S| | | | | | | | |
| |x| | | | | | | |
| | |x| | | | | | |
| | | |x| | | | | |
| | |x| | | | | | |
| |x| | | | | | | |
|F| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
And then with possibleNextNodes[Math.round(possibleNextNodes.length / 2)-1]
| | | | | | | | | |
|S| | | | | | | | |
|x| | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
|F| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
All these paths have the same cost as they all contain the same number of steps but, in this situation, the most sensible path would be as follows...
| | | | | | | | | |
|S| | | | | | | | |
|x| | | | | | | | |
|x| | | | | | | | |
|x| | | | | | | | |
|x| | | | | | | | |
|x| | | | | | | | |
|F| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
Is there a formally accepted method of making the path appear more sensible rather than just mathematically correct?
You need to add a Tie-breaker to your heuristic function. The problem here is that there are many paths with the same costs.
For a simple Tie-breaker that favors the direct route you can use the cross-product. I.e. if S is the start and E is the end, and X is the current position in the algorithm, you could calculate the cross-products of S-E and X-E and add a penalty to the heuristic the further it deviates from 0 (= the direct route).
In code:
dx1 = current.x - goal.x
dy1 = current.y - goal.y
dx2 = start.x - goal.x
dy2 = start.y - goal.y
cross = abs(dx1*dy2 - dx2*dy1)
heuristic += cross*0.001
See also http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html#S12, which is an excellent tutorial about A* in general.
If you want paths that look natural, you need to make sure that your costs correspond to the length on a cartesian coordinate system. That means the cost of moving diagonally should be sqrt(2) times the cost of moving vertically or horizontally.
You can add 'control effort' to the cost calculations for each square. The actor will try not to turn or change direction too much as that will add a cost to the path:
http://angryee.blogspot.com/2009/03/better-pathfinding.html
If I remember correctly, the trick to this is to add an extra parameter to the cost function (for every step between adjacent nodes, or squares in your case) that penalises turns slightly more than normal (for example, having a relative cost of greater than sqrt(2) for digonal moves). Now, there's probably a fine line between smoothing out the path and actually decreasing the optimality of the route (elongating it), however, and you're not going to be able to avoid this in any way. There's a certain trade-off you'll need to discover specific to your own application, and this can only really be achieved by testing.
There was an article on a game dev site, I believe, that detailed exactly how this could be done, but I can't seem to find it at the moment. Have a play around with your cost function anyway and see what results you get - I'm pretty sure that's the way to go.
What is more 'sensible'? Straighter? You need to quantify it properly if the algorithm is going to do anything about it.
Since moving diagonally is as inexpensive as moving horizontally/vertically, all the paths are equivalent according to all the criterion available to A*. If you want a more 'sensible' path, you need to tell the algorithm that some paths are more desirable than others, effectively weighting horizontal/vertical as 'better' than diagonal. As far as I can see, that would be altering the parameters of your environment.