Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
While working on my Go project today, I realised I had ran into a small problem. I had a package that had a struct that held a pointer to a struct from another package. However, that package also made use of a struct from the other package. In C and C++, this wouldn't pose an issue, as I'd use a header guard. However, in Go, such a program won't compile due to infinite import recursion.
This made me wonder, are there too many packages in my project? Should I favour bigger packages? I've always been told that each package should be specifically focused on one thing.
Right now, my structure is like this.
game/ <-- imports engine, needs to access the resource manager a lot
video/ <-- rendering goes here
renderer.go
shader.go
scene.go
...
engine/ <-- imports video, file, etc
root.go <-- contains a Root struct, handles initialisation etc
resource.go
...
file/
dds.go
config.go
resource_list.go
script.go
...
main.go
...
That said, here are my questions:
How would you solve this? Would you combine the video and engine packages? Redesign your program so that video no longer depends on engine?
How do you decide when it's appropriate to make a new package? Do you base it on functionality? Do you group it by category?
How much use do you make of the main package? I personally tend to get out of it as quickly as possible, maybe because I'm too used to OOP.
As these questions are rather broad and project-specific, I can only hope this is of any help:
Personally, I would try to create a third package on which both video and engine can rely. Depending on the project though, this might be a difficult thing to do, and they might need to be merged.
A new package is usually about one specific task. Depending on the project, this might be database I/O, including all models as well - but it might also be a package that's just about reading configuration files from the disk.
As I've built mostly web-apps, I use the main package to get things started: listening to ports, calling other functions, making sure database connections are closed properly, etc.
Example (not sure if helpful? ) :
I once had a package that was just about configurations (config), which referred to the rest of the packages (for some reason). The other packages however, depended on those configurations inside config. This is where the main package can come in handy: linking the config package with the other packages, by means of parameters.
The comment from VonC is also very useful and elaborate. It will probably help you more than this.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
That may sound like an odd question so let me explain why I ask it. I am just learning Laravel, Vue and Vuetify but I haven't found a coherent set of instructions that actually works for installing them except for this video. Based on the verification steps at the end, it appears that this procedure correctly installs Vue and Vuetify in Laravel.
Unfortunately, I can't find any course on learning Vuetify in Laravel, although this playlist seems pretty clear for a non-Laravel environment. Unfortunately, the playlist's installation instructions seem to result in a very different structure for the project which bears almost no resemblance to what I see in Laravel. And that is confusing me when it comes to actually writing code.
For instance, at the start of the third video, the narrator starts to go through the first Vuetify code that he is going to teach and the files shown in his IDE are very different than what I have in Laravel. While I do have a node_modules and public folder, as he does, I've also got a bunch of other folders, like app, bootstrap, config, database, resources, storage, route, and vendor but I do not have a src folder (nor most of its subfolders, aside from views). I am also lacking an App.vue file, the one he is editing at the start of that video.
I have no idea how to proceed after many hours of searching for videos and tutorials. I am afraid that I am missing a bunch of critical files that I will need but I can't think of any way to determine what those files are nor do I know where to find them.
I am keen to proceed with learning Vuetify but I won't make any progress until I can be certain that I have all the files and folders I need to proceed.
Vue is the most unopinionated framework you have come across. It doesn't require any folder structure (node_modules is imposed by node.js, not by Vue).
So, whatever you think works best for your current project is what you should go for.
Obviously, having this type of freedom can be confusing and counter-productive, especially for those who don't know what they want or don't have much experience. Those often need to be told by more experienced others: "try this thing, it's been tested, works pretty well".
If you're looking for that type of opinionated advice/structure, give Nuxt a try. Nuxt was developed by people using Vue on a daily basis who, at some point, realized having a similar structure across projects might be beneficial and would allow for even faster prototyping.
If all you need is to be certain you're not missing anything crucial, you're not.
All you need to run Vue (and everything that's associated with it, including Vuetify) is one element's id in your page and the vue script loaded, at which point running
new Vue({ el: '#host'})
will create a Vue instance and use the element with id="host" as template.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
Let's say, I have the following structure.
export $GOPATH = ~/workspace/go
Directory-Tree:
~/workspace
+ go
+ src
+ example
+ exp1
- main.go
- client.go
+ utils
- my_utils.go
In the file main.go i'd like to import 'client.go' and 'utils/my_utils.go'.
How to do that?
import {
"./client.go"
}
will give me
local import "./client.go" in non-local package
The same happens with any other file in subdirectories like my "utils" folder.
I've read a lot about this error message and about the GOPATH. However, coming from NodeJS and PHP and C++ I really still don't understand this concept of how GoLang will handle file imports and need some further clarification here.
I've read also that people where going to import everything from "GitHub.com", but it makes no sense for me to first push my code to GitHub before I can test it in my local project.
By the way, I'm also curious why go get will not fetch all sub-dependencies together with the specific library that will be fetch with go get?
I've read also that people where going to import everything from "GitHub.com", but it makes no sense for me to first push my code to GitHub before I can test it in my local project.
You don't have to push it anywhere before you can test it. You only have to choose what your import path is, and then put your code in GOPATH accordingly (or use go mod init with Go 1.11+, which lets you place your code anywhere in the filesystem you want). But you still have to pick that import path — even if you decide to change it later.
By the way, I'm also curious why go get will not fetch all sub-dependencies together with the specific library that will be fetch with go get?
It does.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I would like to ask what and why would be the preferred tool for localizing Laravel projects? I have already used a gettext plugin and it worked well. I like using POedit which allows translators using it without programming skills. Plus, the translation hints are cool, too.
Is there any good reason for using Laravel native localization? Or, are there any cons of using gettext?
Thanks!
Why not both: GetText and native localization?
Using GetText with source text is great for developers to work quickly and efficiently on new features without having to "make up" keys, switching files, maintaining consistency between keys and source text etc. Also, using GetText makes it easier to check if everything is translated and you don't need to worry if some keys/values are obsolete.
Using PHP trans() with keys/values is great for copywriting. It's easy for the marketing team or CEO to change the text for all languages (included the source language) without changing the code.
For these reasons, we created https://translation.io/laravel that allows you to use both syntaxes at the same time (and we suggest to only use PHP key/value when the source text needs to be editable through the translation interface).
The package is here is you need more technical info: https://github.com/translation/laravel
The native localization method is described in the Laravel documentation. You basically maintain language files for all languages you want to translate to. To pull them out of the file, you use trans(), trans_choice() (for plural) or __() helpers in Blade template.
Thats the most basic translation handling. At one level higher you might want save all translations to the database. There exists a few packages on Github which doing this. Like:
https://github.com/dimsav/laravel-translatable
https://github.com/barryvdh/laravel-translation-manager
and more. Just search for Laravel Translation.
This method only works as long as you use Blade for the frontend. If you use VueJs, Angular or React, the blade helpers won't work anymore and you have to find different ways how to handle this. This might depend on existent language handling of the aforementioned frontend framework.
I wrote an blog article about that topic.
#Peter Matisko, can you give us a little update on how did you decide, which one are you preferring to use?
Personally I tried quite a couple of different translation libraries, but gettext is still first choice for me:
extract all the translations from code and generate translation files (*.po)
translations editor that runs on Mac, Windows and Unix (Poedit initial release ~20 years ago)
translating plural forms
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I've been trying to figure out how to add on to the functionality of JMeter for a couple days, and I'm sort of stumped. I basically want to build a testing functionality of a proprietary DB (it's not too important on the specifics here). However, the issue I am encountering is where to even begin with the creation of the functionality.
I've tried various stuff on the JMeter website (an example) and the wiki (an example), but it all boils down to I can't seem to find a repository which I can pull into eclipse (or with just building with ant, I can't seem to download_jars because it can't connect to the repo listed in there). Is there any up to date resources on how to build a JMeter plug in? Or am I doing something wrong here because I am inexperienced in setting up something like this?
Any help is greatly appreciated, but please don't just link the first thing on google; I have done quite a bit of searching already. Thanks!
Edit: It turned out the reason I couldn't get eclipse working with a repo was due to the network restrictions I had to deal with. When I tried on another computer/network, it worked fine. I used this jmeter tutorial, but since it is out of date regarding the repository (they use SVN now), I used http://svn.apache.org/repos/asf/jmeter as the root using subclipse. In case anyone runs into the same problem I did.
I have also searched for a building jmeter plugin for my graph plugin stuff. I got a simple and good source code from Ruben laguna's blog. You can understand the basic structure and steps to create jmeter plugin.
Check out this:
Graph plugin - http://rubenlaguna.com/wp/better-jmeter-graphs/
Enhanced-jdbc-sampler - http://rubenlaguna.com/wp/enhanced-jdbc-sampler-for-apache-jmeter-22/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm curious. I'm looking into creating a CI server and wondering, after the first couple of obvious tasks, what else can an automated build do?
The tasks that I'm aware of (not in any order):
Compile (debug/release versions)
Code style conformance
Automated tests (unit/integration/etc.)
Code coverage
Version incrementing
Deployment
I'm not looking for the names of software, the build engine to use, or anything like that; just the repetitive and (maybe) important tasks that can be automated to make the build process ridiculously simple from an end-user perspective.
The simple answer to this, is basically anything that a script can be written for.
For example if you are using CruiseControl, anything that you can do from an ant script can be automated; and that includes calling other (not necessarily ant scripts as well).
That being said, you've got most bases covered in your initial list. To that I would add
Generation of documentation
Repository maintencnace and backup operations
Auto-update company website, e.g. whenever there's a new release of software, documentation is updated, etc
Reports, e.g. aggregate and summarise bug tracker issues and activity per project/ product
HTH
Building documentation
Building installers
Creating web sites
Initialising virtual images
Setting up databases
Reporting?
You may want to report the things you find during those tasks you outlined above. You could also do things such as duplication reporting, or if you run something like findbugs you could report on issues found (e.g. http://findbugs.sourceforge.net/bugDescriptions.html)
You could also generate a releasable package of the product in the build.
It all about automation. If you can find something that needs to be done, then automate it. For example you can do tonnes of code analysis, or testing. Ultiamtely it comes down to repeating things easily. Find what you need to do to improve quality and automate those(And I strongly fally down on the side of more testing is better).