#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax t - mysql-error-1064

INSERT INTO `recipe`(`Recipe_Id`, `Recipe_Name`, `Ingredients`, `Method`, `Servings`, `Ranking`) VALUES ([1],['Garlic Chicken'],['4 cloves garlic, chopped','1/2 cup any oil','1/4 cup bread crumbs','4 boneless, skinless chicken breasts''salt as required','black pepper as required'],['(if you have oven Preheat oven to 375 degrees F (190 degrees C))In small pan, stir fry garlic with the oil then mix chicken with garlic and black pepper and add garlic mixture on it and then coat them with bread crumbs then Bake in the preheated oven for 45 minutes to 1 hour. INCASE you donot have oven you can cook it in a sauce pan using 1 cup oil. cook untill it gets golden brown and then serve],[5],[0]);
I do not know where I am wrong. How can this be solved?

You are missing a closing quotation mark after serve. You syntax for the ingredients values is also wrong. It should be:
INSERT INTO recipe
( Recipe_Id ,
Recipe_Name ,
Ingredients ,
Method ,
Servings ,
Ranking
)
VALUES ( 1 ,
'Garlic Chicken' ,
'4 cloves garlic, chopped, 1/2 cup any oil, 1/4 cup bread crumbs, 4 boneless, skinless chicken breasts salt as required,black pepper as required' ,
'(if you have oven Preheat oven to 375 degrees F (190 degrees C))In small pan, stir fry garlic with the oil then mix chicken with garlic and black pepper and add garlic mixture on it and then coat them with bread crumbs then Bake in the preheated oven for 45 minutes to 1 hour. INCASE you donot have oven you can cook it in a sauce pan using 1 cup oil. cook untill it gets golden brown and then serve' ,
5 ,
0
);

Related

What is wrong with the way I am using "turtles-on"?

I want to model agents moving around, and dying if they reach a patch that already has a # of agents above the carrying capacity (which is determined by a slider).
I tried writting it like this:
to check-if-dead
if habitat = "escarabajo" [
ask escarabajos [
if pcolor = one-of [yellow lime orange grey blue ] [die]
if escarabajos-on patch-here >= capacidad-de-carga-bosques [die]
]
]
but I get a message highlighting "escarabajos-on patch-here",and saying > >= expected this input to be an agent or number or string, but got a turtle agentset instead >
The result of escarabajos-on patch-here is an agentset: the set of all escarabajos on the current patch. What you want is the number of escarabajos on the current patch, so you need to count them:
if count escarabajos-on patch-here >= capacidad-de-carga-bosques
That being said, escarabajos-on patch-here is needlessly verbose, since NetLogo also has a <breeds>-here primitive:
if count escarabajos-here >= capacidad-de-carga-bosques
Finally, I have a hunch that you meant:
if member? pcolor [ yellow lime orange grey blue ]
instead of:
if pcolor = one-of [yellow lime orange grey blue ]
The one-of primitive picks an element from a list at random, so your condition would have been true only if the randomly picked color happened to be the color of the current patch. By using member? instead, the condition will be true if the color of the patch is any member of the list.

how to fill a sub area of a density curve with python

I want to shade the area under the density curve for the standard normal distribution by the following ranges:
1) mean-2std , mean-std ---> in red
2) mean +std , mean+2std ---> in red
3) mean -std , mean+st --> in blue
This is a variant on the questions "Shade (fill or color) area under density curve by quantile".
the data used to draw the denisty curve is taken from a column of a dataframe.
eg: This is only part of the data. The column has 256 values.
Gap
1 -3.260010
2 -7.790009
3 -1.179993
4 2.270019
5 9.000000
6 -4.930023
7 -7.920014
To draw the plot I did the following code:
sns.kdeplot(TeslaStock18_19['Gap'], label = 'Gap Density', color = 'darkblue')
Considering all the data, I found out that the distribution is normal. This allows me to use the Empricial rule (68-95) to make some statitical consideraton.
What I would like to obtain is the following plot:
https://www.nku.edu/~statistics/images/Using_1.gif
N.B. I am starting to use Python, It is for a Univeristy project.
This is what I tried to do but it does not fill me completely the area
ptx = np.linspace(meanGap-std, meanGap+std) pty = scipy.stats.norm.pdf(ptx,meanGap,stdGap) plt.fill_between(ptx, pty, color='#0b559f', alpha='0.35')

Lucene cartesian product diferent documents?

I have 3 indexed documents:
Cars: Toyota (gt, gtX, gtx12), Ford (corola...), Volkswagen (gtS), Tesla...
Car models: gt, gtX, gtx12
Car colors: white, red
Example search query: "gt*"
Should return:
Volkswagen gtS white
Volkswagen gtS red
Toyota gt white
Toyota gt red
Toyota gtx12 white
Toyota gtx12 red
Toyota gtX red
Toyota gtX white
I can't add them to index like 'Toyota gt', 'Toyota gtx'... because there will be a relay huge index (even more then 50gb in my case, and search is slow).
I implemented in my own: Search by "car" then by "models" then merge but I'm interested if lucene can handle it.

How to Convert United States State Plane coordinates to Latitude and Longitude in Mathematica?

How to Convert United States State Plane coordinates to Latitude and Longitude in Mathematica?
I'm converting Washington DC Northing and Easting (in feet) of a location to latitude and longitude
Here is the address:
316 PENNSYLVANIA AVENUE SE 20003
And here are the coordinate:
X= 399901.19 Y= 135465.63
I know that I should be ND83 and my SPC Zone is MD-1900
I checked GeodesyData[] and I tried all these:
"NAD27", "NAD831986", "NAD83CORS93", "NAD83CORS94", "NAD83CORS96", \
"NAD83HARN"
with GeoPosition[{399901, 135465, 0}, datum] but with no success. I know in R I can use epsg:2804 or epsg:3559 but in Mathematica, I don't know which code to use, and none of these worked.
I found out how to answer it:
Our coordinates are in datum NAD83 for Maryland 1800. Therefore, our datum string for Mathematica should be "SPCS83MD00"
Knowing the State and the code connected to to the state are crucial to build the datum string. After SPCS83, one adds the state, in this case MD, and the last 2 digits of the four-digit code.
Hence, one can convert to (WGS84) or latitude and longitude as follows:
LatitudeLongitude[GeoGridPosition[{399901., 135466.}, "SPCS83MD00"]]
One more thing:
If you want to find out the extension for SPCS83 or NAD 83 in Mathematica you just need to use, and start typing SPCS83 or NAD83 and it will give you the possible string containing the state and its codes (some states have more than 1 code)
GeoProjectionData["SPCS83MD00"]

How do can I remove text from a string in Ruby when there are multiple instances of the text in the string

An example of the string:
"6 red cables, 4 white cables, 9 blue cables"
I want to remove "cables" so that it reads
"6 red, 4 white, 9 blue"
I looked at the slice and sub methods, but they only remove the first instance of "cables". Can someone point me in the right direction?
You can use String#gsub:
2.2.0 :003 > "6 red cables, 4 white cables, 9 blue cables".gsub(" cables", "")
=> "6 red, 4 white, 9 blue"
Reference (compares sub vs gsub):
http://www.dotnetperls.com/sub-ruby
Answer
cleand_value = "6 red cables, 4 white cables, 9 blue cables".gsub("cables", '')
Output "6 red , 4 white , 9 blue "
Explanation:
value = "abc abc"
# Gsub replaces all instances.
value = value.gsub("abc", "---")
puts value
Output
--- ---
You then can get rid of all the white spaces after the commas the same way.
cleaner_value = cleaned_value.gsub(", ", ",") #replaces all instances
output "6 red, 4 white, 9 blue"
Or use the other solutions and do
cleand_value = "6 red cables, 4 white cables, 9 blue cables".gsub(" cables", '') #notice the space before cables. May cause problems unless you know exactly the input

Resources