Many requestShippingRates errors [closed] - debugging

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 8 years ago.
Improve this question
I cannot seem to find out how to track down this bug: I can see it has something to do with Shipping Rates, but there's very little information being posted into the error log.
2013-01-08T15:45:36+01:00 DEBUG (7): requestShippingRates
There are many of these errors being posted.

If you have shell access, try using the following command to search for instances of requestShippingRates. Run it from your /var/www/app directory. the * means look at everyting, the -R means recurse directories, and the -i means ignore upper / lowercase.
grep "requestShippingRates" * -R -i
You did not mention whether or not these errors are showing up in your php log, but you could also grep the following:
grep "error_log(" * -R -i
That will show anything written to the php error log.

There are a couple of possibilities, one is that the string is contained in your code, so simply searching the project for 'requestShippingRates', and find the one that is a string being passed to Mage::log. The other, which is probably more likely, is that at some point somebody has put something along the lines of Mage::log(__FUNCTION__) in one of the requestShippingRates functions. You should be able to find that easy enough by searching for n requestShippingRates (i.e. match the n at the end of a function declaration).

Related

Create Batch Script to Scan Multiple Files [closed]

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 7 months ago.
Improve this question
I'm looking to make a batch script. What I have is a ton of different logs in a ton of different places, all with a bit of important info and a lot of useless info.
Some of these logs are directly named, and some are named by date and time.
I'm trying to make a script that can basically scan them for me so I don't have to go through each folder and log and scan manually.
Some examples:
OmegaManager\logs\omega.log - scan for "State:" and "has been updated"
OmegaManager\logs\instance-0.log - scan for "shutdown"
KRBanking\PlayerDatabase*logs are numbers* - copy all information or scan for changes since last time?
KRBanking\ServerLogs*logs are dates and times* - scan for "Deposited" and "Withdrawed"
And then output the whole line.
Is this even moderately possible? Thanks in advance.
Yes, this is possible. Batch files support loops, conditions, and filtering/searching.
A FOR loop allows you to iterate through files or directories, you'll find more information in this SO post.
To find strings in a file, you have several options, i.e. find and findstr, see riptutorial.com:
FIND can scan large files line-by-line to find a certain string with no wildcard support.
FINDSTR has more features and supports regular expressions with wildcards in the search string.
Super simple example for one of your use cases
The batch script must be placed where your files are. Otherwise, you need to add a full path instead of just "omega.log".
FINDSTR /L /C:"State:" /C:"has been updated" omega.log
To start with batch programming, you can read the findstr documentation and some tutorials.

Search / replace in bash script with dynamic part [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm writing a bash script and I want to edit a PHP config file, find a string and replace by another.
The hard part is that I want this search/replace to be dynamic.
Here is an example:
define('APP_VERSION', '1.0.31');
The goal is to replace 1.0.31 by another version number.
How could I achieve that? I've tried with sed, but can't isolate the version number part (because it's not always the same, so I can't directly search for 1.0.31)
Thanks
The point of regexes is to match non-static text. To replace any version number with 123 use
sed "s/define('APP_VERSION', *'[^']*')/define('APP_VERSION', '123')/"

file substitution based on word matching [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
i have a file say test.sh which contains the following details
check_interval 1
retry_interval 1
event_handler_enabled 1
i want to replace event_handler_enabled 1 line by event_handler_enabled 0
Kindly help
sed -i "s/\(event_handler_enabled.*\)1/\10/" test.sh
Let's see what did sed do:
First, it found the line that you want to change. The line starts with event_handler_enabled(actually it doesn't care how many spaces before).
And then, it found the 1: (\(event_handler_enabled.*\)1)
Finally, it change the 1 to 0.
Done.
P.S. As the back references, it means that sed will find all the characters behind the event_handler_enabled and put them in the right place :)

how to grep only current directory for specific files [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
Hello I have a question I want to find a keyword in a directory without recursion. And I want to check only for the .c extensions.
For example I try;
grep -r 'keyword' --include=*.c .
And it works. But I dont want recursive search I just want the current directory's results so I remove the -r
grep 'keyword' --include=*.c .
However this gives me an error that ". is a directory". Actually I have an idea to write the contents of recursive grep to a textfile and grep that textfile for the file extensions but I think it wont be efficient at all. Thanks for your support.
I suggest this:
grep 'keyword' *.c
The other answer is clean and efficient.
But I have the feeling that you insist on using "-r" and/or "--include", maybe for reasons not mentioned.
bash-3.1$ grep -r --include="*.c" -dskip 'keyword' ./*
Closer to your original syntax, you can use:
grep --include=*.c 'keyword' *
This reports directories without searching them.

Ruby detect if a column value has changed [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
So I have this line:
if self.company_changed?
And it works fine but this detects if the company has changed on the object. I need to know if the database value has changed and not if the value in memory has changed. So I tried this:
if :company_changed?
This seems to work in debug mode when I only execute the one line. If I let it run, it fails in testing on an infinite loop.
My question is what can be used in ruby to check to see if the column value has actually changed.
I'm pretty sure you're actually talking about ActiveRecord. In which case, you'd need to re-fetch the record to see if the value has changed in the database.
self.class.find(self.id).company != self.company
A general purpose method for this might be something like:
def attr_changed_in_db?(attr)
self.class.find(self.id).attributes[attr] != self.attributes[attr]
end
There is an excellent screencast on this by the great Ryan Bates.

Resources