(1) You can use XML comments for that
<!-- Document here whatever needed -->
(2) It is better to use XSDs instead of DTDs. XSDs also have documentation dedicated tags. Please see below.
<xsd:annotation> <xsd:documentation>Document here whatever needed</xsd:documentation> </xsd:annotation>
Distinct compared through what? Calling
Distinct()
without andIEqualityComparer
does the same as if you normally use==
, meaning it looks if the references are equal. I’m guessing you want to compare by country name or country id, which means you’ll need a customIEqualityComparer
, luckily enough they’re quite easy to implement:class NewmodelEqualityComparer : IEqualityComparer<Newmodel> { public bool Equals(Newmodel n1, Newmodel n2) { // Replace '.countries' with whatever property you want to compare return n1.countries == n2.countries; } public int GetHashCode(Newmodel n) { return n.GetHashCode() } }
Your call to
Distinct
then needs to simply pass this as its equality comparer, like so:.Distinct(new NewmodelEqualityComparer()).Take(100).ToList();
Notice how I switched the positions of
Take
andToList
, this is because if youToList
first and thenTake
100 the whole underlying original List will be processed and then 100 will be taken. We can make this a lot more efficient by first taking 100 and then converting the underlying collection to a list, saving potentially thousands of calls toDistinct
. This is due to deferred execution provided byIEnumerable
and LINQ
You do not need the MovieActor class
Change to:
public class Movie { public int Id { get; set; } public string Title { get; set; } public List<Actor> Actors { get; set; } } public class Actor { public int Id { get; set; } public string Name { get; set; } public List<Movie> Movies { get; set; } }
Then you can select the Actor and you have the list of Movies as a property on the actor.
SQLAlchemy allows producing (almost) any SQL function expression using the
func
utility:func.round(n, x)
There is a problem with your
sql_mode
.As of MySQL 5.7.x, the default sql mode includes ONLY_FULL_GROUP_BY. (Before 5.7.5, MySQL does not detect functional dependency and ONLY_FULL_GROUP_BY is not enabled by default).
ONLY_FULL_GROUP_BY: Non-deterministic grouping queries will be rejected
For more details check the documentation of sql_mode
Method 1:
Check default value of sql_mode:
SELECT @@sql_mode
Remove
ONLY_FULL_GROUP_BY
from console by executing below query:SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
Method 2:
Access phpmyadmin for editing your
sql_mode
Since you have not provided the join condition in your example, So after using a join condition between your tables(I am presuming that column as id), You may try below query on MySQL-
UPDATE tb_joborderdetail q INNER JOIN tb_survey as s ON q.id = s.id SET s.survey_id = (SELECT MAX(s.survey_id) FROM tb_survey) + 1 WHERE q.id = 42
There is error in your code because of:
x['is_good'] = x.apply(lambda row : selector(x), axis=1)
should be :
x['is_good'] = x.apply(lambda row : selector(row), axis=1)
It was taking series not rows that’s why you got the error.
Well, you where on the right track. Personally I would simply merge them:
final_value = {} for key in personale_result: final_value[key] = (personale_dip[key][0], personale_dip_costo[key][0], personal_result[key])
With your input this will give you:
>>> final_result {'a': [550.0, 1.0, 550.0], 'b': [157.65, 150.0, 23647.5]}
Now personale_dip and personale_dip_costo are of type {string, list}. Currently your personale_result will simply ignore other values in that list, as will final_result.
See here including an example using
FromDateTime
You have MAIL_ENCRYPTION=465, you want to set it to:
MAIL_ENCRYPTION=ssl