I am trying to create a custom item and everything is working fine except for in game in which the name of the item is gibberish. I was following this tutorial and even checked his github repo and everything seems to match up? https://www.youtube.com/watchv=FnOBpLgoDQI&t=730s
Code inside my en_us.json file
{
"item.firstmod.mithrill_ingot":"Mithrill Ingot",
"item.firstmod.mithrill_nugget":"Mithrill Nugget"
}
Code inside my mithrill_ingot.json file
{
"parent": "item/generated",
"textures": {
"layer0": "firstmod:item/mithrill_ingot"
}
}
Can anyone help?
Related
Given a list of repositories on GitHub with 'repoName' and 'userName', I need to find all the '.java' files, and get the content of the java files. Tried to use RestAPI first, but ran into the rate limit very easily, now I'm switching to GraphQL API, but don't know how to achieve that.
Here is how I would do it:
Algo Identify_java_files
Entry: path the folder
Out: java files in the folder
Identify all files in the folder of the repository
For each file
if the type of the file is "blob":
if ".java" is the end of the name of the file
get its content
else if the type of the file is "tree":
Identify_java_files(path of the tree file)
You can easily implement this pseudo code using Python. My pseudo code makes the assumption to use recursion, but it can be done otherwise, it's just for the example. You will need the requests and json libraries.
Here are the queries you might need, and you can use the explorer to test them.
{
repository(name: "checkout", owner: "actions") {
defaultBranchRef {
name
}
}
}
This query allows you to check the name of the default branch of the repository. You will need it for the following queries, or you can use a specific branch but you will have to know its name. I don't know (and don't believe) if you can get all the branches names for a repository.
{
repository(name: "checkout", owner: "actions") {
object(expression: "main:") {
... on Tree {
entries {
path
type
}
}
}
}
}
This query gets the content of the root folder for a specific repository. The expression: "main:" refers to the branch of the repository along with the path. Here the branch is main and the path is empty (it comes after the ":"), meaning we are looking at the root folder. Some repositories are using "master" as default branch, so be sure of which branch to use.
To check the content of a file, you can use this accepted answer.
I updated the example in order for you to be able to try it.
{
repository(name: "checkout", owner: "actions") {
object(expression: "main:.github/workflows/test.yml") {
... on Blob {
text
}
}
}
}
You send your requests to the API using requests or alike, and store the responses as JSON or alike for treatment.
As a side note, I do not think it is possible to achieve this without issuing multiple queries. I recently had to do something similar, and this is my first SO answer, so let me know if anything is unclear.
Edit:
You can use this answer to list all files in a repository.
I have an Ionic app and after adding sentry-cordova, I noticed that my console logs (in browser) now show the following:
Previously, it would name the file and line number rather than "breadcrumbs" and I have no idea how to change this behavior.
It's worth noting that when I hover over breadcrumbs.js in the logs it references: #sentry/browser
This is not so much a solution as a potential workaround but it did the trick for me and should work for anyone using environment variables.
Sentry.init({
dsn: "___DSN___",
integrations: function(integrations) {
return integrations.filter(function(integration) {
if (!environment.production) {
// Disables breadcrumbs unless in production mode
return integration.name !== "Breadcrumbs"
}
})
}
});
I am using SharpSvn in my C# project. I am having a folder with some text files in it and another folders with subfolders in it. I am adding the folder under version control and commit it. So far, so good. This is my code:
using (SvnClient client = new SvnClient())
{
SvnCommitArgs ca = new SvnCommitArgs();
SvnStatusArgs sa = new SvnStatusArgs();
sa.Depth = SvnDepth.Empty;
Collection<SvnStatusEventArgs> statuses;
client.GetStatus(pathsConfigurator.FranchisePath, sa, out statuses);
if (statuses.Count == 1)
{
if (!statuses[0].Versioned)
{
client.Add(pathsConfigurator.FranchisePath);
ca.LogMessage = "Added";
client.Commit(pathsConfigurator.FranchisePath, ca);
}
else if (statuses[0].Modified)
{
ca.LogMessage = "Modified";
client.Commit(pathsConfigurator.FranchisePath, ca);
}
}
}
I make some changes to one of the text files and then run the code againg. The modification is not committed. This condition is false:
if (statuses.Count == 1)
and all the logic in the if block does not execute.
I have not written this logic and cannot quite get this lines of code:
client.GetStatus(pathsConfigurator.FranchisePath, sa, out statuses);
if (statuses.Count == 1) {}
I went on the oficial site of the API but couldn`t find documentation about this.
Can someone that is more familiar with this API tell what these two lines do ?
What changes need to be done to this code so if some of the contents of the pathsConfigurator.FranchisePath folder are changed, the whole folder with the changes to be commited. Any suggestions with working example will be greatly appreciated.
Committing one directory with everything inside is pretty easy: Just call commit on that directory.
The default Depth of commit is SvnDepth.Infinity so that would work directly. You can set additional options by providing a SvnCommitArgs object to SvnClient.Commit()
I'm trying to scrape products from amazon (shoes to be precise) such as from here: http://www.amazon.com/DC-Mens-Skate-Black-Plaid/dp/B005BWAQVU/ref=sr_1_1?ie=UTF8&qid=1333376200&sr=8-1
For some reason the images no longer save and download. I am afraid I may have incorrect parameters for the images.
Here is the excerpt from my code in which that part takes place:
sub get_data
{
my($product_content,$gender,$product_category,$prod_tag,$sub_category)=#_;
my($product_name,$product_code,$brand,$product_price,$image_file,$image_name,$prod_size,$size_name,$color_name,$prod_color);
if($product_content=~m/<div\s*id\=\"atfResults\"[^>]*>([\w\W]+?)<div\s*id\=\"centerBelowStatic\">/is)
{
my $block=$1;
while($block=~m/<div\s*class\=\"image\">\s*<a[^>]*?href\=\"([^>]+?)\"[^>]*>\s*<img[^>]*>/igs)
{
my $source_url=$1;
$source_url=URI::URL->new_abs($source_url,$home_url);
my $final_content=&get_cont($source_url,$home_url,'GET');
if($final_content=~m/<h1[^>]*>\s*<[^>]*>\s*([^>]+?)\s*</is)
{
$product_name=decode_entities($1);
print "\n\n$count :: Product Name :: $product_name\n";
$product_name=~s/\'/\'\'/igs;
}
if($source_url=~m/\/dp\/([^>]+?)\//is)
{
$product_code=$1;
$product_code=~s/\'/\'\'/igs;
}
if($final_content=~m/<span\s*class\=\"brandLink\">\s*<[^>]*>\s*([^>]+?)\s*</is)
{
$brand=decode_entities($1);
print "Product Brand :: $brand\n";
$brand=~s/\'/\'\'/igs;
}
if($final_content=~m/<td\s*class\=\"priceBlockLabelPrice\">\s*Price\s*\:\s*<[^>]*>\s*<[^>]*>\s*<[^>]*>\s*([^>]+?)\s*</is)
{
$product_price=$1;
$product_price=~s/\'/\'\'/igs;
}
if($final_content=~m/<script[^>]*>\s*var\s*colorImages\s*\=\s*\{([\w\W]+?)\]\};/is)
{
my $color_block=$1;
my $col=1;
$image_file="";
$image_name="";
while($color_block=~m/\"large\"\:\[\"([^>]+?)\"/igs)
{
my $img_src=$1;
if($img_src=~m/(?:.+\/)([^>]*?\.[a-z]+)/is)
{
my $img_fname=$1;
getstore($img_src,"Images/$img_fname");
$img_fname=$dir."/Images/$img_fname";
$image_name=$image_name."Product_Image_filename_".$col.",";
$img_fname=~s/\'/\'\'/igs;
$image_file=$image_file."\'$img_fname\',";
$col++;
}
undef($img_src);
last if($col>10);
}
undef($color_block);
}
Everything else seems to save fine, but the images, nada. I'm not really a perl expert either so if it's something obvious, forgive me.
Why would you scrape their site when Amazon provides an API for getting hold of their product details?
You should use WWW::Scripter module for that. Today morning a new version of this module has been released and one of very new features of this new version is image fetching. The module will fetch images with proper referer and cookies (if apply), so you should have no problem to capture images...
Use Firefox and install an add on "Disable HTTP referer at Startup". Then restart firefox and try again. You will get images.
I'm just beginning to use CKEditor, but have a hard time understanding the plugins system.
I was able to add a simple button that says 'Test' when you click on it with :
var myplugin_function = function () {
alert('Test');
}
var plugin_name='myplugin';
CKEDITOR.plugins.add(plugin_name,
{
init:function(c) {
c.addCommand(plugin_name,myplugin_function);
c.ui.addButton(plugin_name,
{
label:'This is my plugin',
command:plugin_name,
icon:this.path+'myplugin.png'
});
}
});
I know this code should be executed only once, for example in a plugin.js, but that's not how I use it. The CKEditor instance, including my plugin code is executed each time the Ajax-page is loaded.
That's why I use this to remove the instance, if it exists :
if (CKEDITOR.instances['mytextarea']) {
CKEDITOR.remove(CKEDITOR.instances['mytextarea']);
}
Then I use the jquery way to create the ckeditor from a textarea:
$('#mytextarea').ckeditor();
But the 2nd time the ajax-page loads, I get an error about the plugin already being registered. So I need a way to remove the plugin and be able to add it again.
Is this even possible?
UPDATE
This seems to work :
I now check if the plugin is already registered with :
if (!CKEDITOR.plugins.registered[plugin_name]) {
}
around the CKEDITOR.plugins.add(b, ... part
You are not showing how you are adding the plugin, so it's hard to tell what's your exact problem; but from the code that you have provided I can suggest that you use variable names better than "a", "b" and "c". It's quite harder to understand the code this way.
Also, CKEDITOR.remove just removes the instance from the instances array, but it doesn't really clear the used resources, you should use CKEDITOR.instances['mytextarea'].destroy( true ) instead