Lang files not being used by fabric - minecraft

I have got 4 items working but even with the lang files in the right place, the names are still all broken.
the files are inside of src\resources\assets\cauldrons\lang\en_gb.json
with the contents being
{
"item.cauldrons.gold-base": "golden base",
"item.cauldrons.iron-base": "iron base"
}
I am definitely on the right language in Minecraft, What could be causing this?

Try renaming your lang file to en_us.json and check if you didn't misspell anything.

You can't have '-' in a item/blocks tag, try replacing all instances of dashes with an underscore.

Related

Replacing text string within quotes using sed or awk?

Both sed and g/awk seem very powerful. When I need data manipulated and struggle with syntax I always have answers submitted using both. Personally the syntax of awk is easier for me to grasp (is this common to have a preference?).
I want to spend a few days to trying to study tons of examples of using one or the other, should one specifically be focused on over the other? Does one out perform another in regard to capability? Now onto my question...
I have a .php file that is read and rendered as a json file. It looks like this:
<?php
$selectedSystemStateResults = ["Bird", "Cats", "Cows", "Dog",
"Goats", "Monkey", "Sheep"];
Using sed/awk how could I specify to change "Dog" to "Ducks" ?
Using sed/awk how could I specify to change the 5th variable to
"Impalas" ?
The first scenario I would know the name of the variable being changed, the second scenario I would just want the change the variable in a static position.
Disregard, overthinking it.
I simply modified the php file so that I could replace lines for now.
<?php
$selectedSystemStateResults = [
"Bird",
"Cats",
"Cows",
"Dog",
"Goats",
"Monkey",
"Penguin"]
;

Find longest file in the project IntelliJ IDEA

Hello I want to know any trick or shortcut by which one can know which is the longest file in project.
i.e which file has the longest lines of code.Is there any shortcut or plugin available?
I believe the OP was asking about the length of file, not the length of single line. You can try with such iteration:
(.*\n){100,}
(.*\n){1000,}
(.*\n){10000,}
Although this is kind of hacky it still works.
You can search your whole project using the regex repetition pattern. Just right-click your project folder in the project structure view and choose "Find in path...". Be sure to check "Regex" in the search window that appears.
So you'll start out and match any line with any length in your project
^.$
(If you're not familiar with regex: ^ and $ are used to denote the beginning and end of a line and . matches any character)
Then you gradually increase the number of matched repetitions
^.{1,}$
^.{10,}$
^.{100,}$
^.{1000,}$
(You use {start, end} to indicate to interval of repetitions. If you leave end blank it will match anything from start)
Using this you will soon be left with the longest line(s) in your project.
As I said it's kinda hacky but it's also quick and works if you don't have to automate the task.
Hope this helps you!

How to stop intellij-idea from removing white spaces at end of text lines in my file?

I am using 2018.1.5 community edition of intellij editor to edit a plain text file.
I am not using a project. I start it, on Linux as follows:
idea.sh my_file.mpl
where my_file.mpl is plain text file.
And this works well, except for one big problem.
I need to have an empty space at end of some lines. i.e. after the line character on some line in the file, I insert some white. I see the space is there, by doing View->Active editor->Show White spaces. I can see the small tiny dotts, showing there are white space character at end of line.
But as soon as I save the file, these white spaces are removed from end of line.
This causes a problem for me (for other reason, when this file is read by another app).
Is there an option to tell it intellij NOT to remove white spaces after the last character on the line?
Go to File->Settings->Editor->General and under Other, set the drop down next to Strip trailing spaces on Save to whatever you wish. For future reference, you can press Ctrl-Shift-A and type a search term to find any menu command or setting very quickly. In this case, "trailing spaces" or "strip trailing spaces" works really well.
Newer PyCharm (2020 and beyond) have slightly different answer than Code-Apprentice's.
Go to File->Settings->Editor->General, and then scroll down to Save Files section. The drop down Strip trailing spaces on Save for: is there. You can select None if you don't want any stripping in no circumstances.
Here is an image showing the setting:
If changing the settings in "Editor > General > Save Files" doesn't work, the below might be useful...
There is a discussion here about a possible bug (or at least confusing scenario) where you have set "Strip trailing spaces on Save for"=None and you still get stripping of trailing spaces, as I did. The comment by Oksana Chumak worked for me - namely, I unticked "Enable EditorConfig Support" in Settings > Editor > Code Style. This seems to allow a config file ".editorconfig" to be used which overrides some settings - also see Andriy Bazanov's answer, quoted below...
NOTE: If you have .editorconfig file in your project, such option can
also be controlled via that file. This file can provide more granular
control over what files are affected by those settings.
Settings from .editorconfig file will OVERWRITE IDE settings (the
whole nature of such files), so if you have such files in your project
and such instruction there, you will have to either disable the
EditorConfig for this project or disable plugin completely (if you do
not care about it at all).
I had my .editorconfig and I have used trim_trailing_whitespace=true. So that was the issue. This is what I did to fix the issue.
[*.md]
trim_trailing_whitespace=false
So here's what worked for me. I wanted intellij to keep trimming whitespaces but to keep the whitespace on blank lines.
First like #Michael-Veksler suggested, I changed intellij's default removal on save.
But it kept trimming the trailing whitespace, that was because in my .editorconfig file I had a trim_trailing_whitespace config turned on. So now I've set trim_trailing_whitespace = false.
Lastly, because I still wanted the editor to trim the trailing whitespaces, just not on blank lines I've added to my .eslintrc.js file the following setting:
module.exports = {
...
rules: {
...
'no-trailing-spaces': [2, { "skipBlankLines": true }]
}
}
And now lint-fix on save just takes care of it

Is there a way to reformat braces automatically with Vim?

I would like to reformat some code which looks like this :
if (cond) {
foo;
}
to
if (cond)
{
foo;
}
Since this is C code, I have been looking at cindent/cinoptions to use with = but it seems it does not deal with multiline rules.
I have been looking at formatoptionsto use with gq, and it does not seem to be possible either.
So is it possible using default Vim options or should I use a specific plugin or function ?
:%s/^\(\s*\).*\zs{\s*$/\r\1{/
Breakdown:
^\(\s*\) = capture the whitespace at the beginning of the line
.* = everything else
\zs = start replacement after this
{ = open curly brace
\s*$ = trailing whitespace before line end
\r\1{ = newline, captured whitespace, brace
I don't know if this completely solves your problem, but if this is a one-shot operation, you might want to try regular expressions:
:%s/^\(\s*\)\(.*)\)\s*{\s*$/\1\2^M\1{/
Note that ^M is a control character that is usually generated (depending on your terminal) by pressing CTRL-V followed by ENTER.
EDIT: As pointed out in the comments by Jay and Zyx, \r is a better way of inserting a line break into the replaced string. I wasn't aware of that, many thanks for the hint.
If you install Artistic Style you can do something like:
:set formatprg=astyle\ -b
Then use gq to reformat chunks of code.emphasized text
If you want this enabled every time you edit a C file,
you can add the following to your .vimrc file.
autocmd BufNewFile,BufRead *.c set formatprg=astyle\ -b
I don't know if you can do it within vim itself, but you can try the BSD indent command with the -bl option. With the cursor on the first {, you can type !%indent -blEnter.

Pound sign (#) in filename causing error

I have a very simple file upload that allows users to upload PDF files. On another page I then reference those files through an anchor tag. However, it seems that when a user upload a file that contains the pound sign (#) it breaks the anchor tag. It doesn't cause any type of Coldfusion error, it just can't find the file. If I remove the #, it works just fine. I am sure there are a number of other characters that would have this same issue.
I've tried putting URLEncodedFormat() around the file name inside the anchor but that doesn't help. The only other thing I could think of was to rename the file each time it was uploaded and remove the "#" character (and any other "bad" character).
There has got to be an easier solution. Any ideas?
If you control the file upload code try validating the string with
IsValid("url",usersFileName) or
IsValid("regex",usersFileName,"[a-zA-Z0-9]")
Otherwise if you are comfortable with regex I would suggest something like the previous posters are commenting on
REReplace(usersfilename,"[^a-zA-Z0-9]","","ALL")
These samples assume you will add the ".pdf" and only allows letters and numbers. If you need underscores or the period it would look like this...
REReplace(usersfilename,"[^a-zA-Z0-9\._]","","ALL")
I am not a regex guru, if I have one of these wrong I am sure several will jump in and correct me :)
Pound signs are not legal within filenames on the web. They are used for in-page anchor targets:
<a name="target">
So if you have file#name.pdf, the browser is actually looking for the file "file" and the internal anchor "name.pdf".
Yes, you will have to rename your files on upload.
I can't comment yet,
but Kevink's solution is good unless you need to perserve what you're replacing.
We ran into an instance where we needed to rename the filename but the filename needed to be somewhat preserved (user requirement). Simply removing special characters wasn't an option. As a result we had to handle each replace individually, something like.
<cfset newName = replace(thisFile, "##", "(pound)", "All")>
<cfset newName = replace(newName , "&", "(amp)", "All")>
<cffile action="rename"source = "#ExpandPath("\uploads\#thisFolder#\#thisFile#")#" destination = "#newName#">
Probably you would have to replace # with ## to avoid this, I think this is caused because # is figured as Coldfusion keyword.