I'm trying to combine different conditions within the same case. To be more specific, I want to include various parties into my filter. So far, I have following code:
RANGE(edate,date.mdy(9,14,14),date.mdy(8,30,20)) AND partyabbrev = "AfD"
However, I do not just want to include "AfD", but also e.g. "FN", "FiDeSz-KDNP", "PVV", among others. So, my question would be, how do I combine them into partyabbrev-filter? I already tried using AND partyabbrev = "FN" AND partyabbrev = "PVV" etc. but that did not work unfortunately.
Would really appreciate it if you could help me -- I already tried various YT tutorials but it was never really case specific.
Thanks!!
This should do it:
RANGE(edate,date.mdy(9,14,14),date.mdy(8,30,20))
AND any(partyabbrev, "AfD", "FN", "FiDeSz-KDNP", "PVV").
Related
I used to use "iter_dialogs" to get a list of available chats. But this method has stopped working. Can you suggest an alternative? And is it possible to get a list of report-bots to write to them later? I will be very glad of any help.
iter_dialogs() doesn't work anymore, as it has been replaced by get_dialogs(). See Pyrogram's Release Notes for v2:
Iter_ methods have been removed:* This means there is now only one way of iterating through items by using the respective get_* methods which are all turned into generators. Some of the methods have been renamed as well:
iter_history becomes get_chat_history().
iter_chat_members becomes get_chat_members().
iter_dialogs becomes get_dialogs().
iter_profile_photos becomes get_chat_photos().
As for your second question about report bots, I have no idea what you're talking about there. You might want to edit your question to add more detail.
I am new to roblox scripting, and I am working on a game. I am trying to make an exploration game with multiple planets. I want the colors on the surfaces of the planets to vary, but I also wish to use smooth terrain, as it is easier to use and looks nice. from reading a bit online, i have figured out i need to use "GetMaterialColor" or "SetMaterialColor". however, "SetMaterialColor", the one i needed specifically, requires two bits of information- the material and the color.
The issue comes from the "Material" part of this, as I have no idea how to make the script recognize what material I want to change. i tried multiple things, including but not limited to:
(grass, #,#,#)
(grass) (#,#,#)
("Grass"), (#,#,#)
("Grass", #,#,#)
or even just (#,#,#), without trying to get a specific material at all
so yeah, I need some help
here is the code:
local function onTouch(hit)
game.Workspace.Terrain:SetMaterialColor
end
script.Parent.Touched:connect(onTouch)
(there should be stuff after SetMaterialColor, that is what i need help with)
If you read the documentation on Terrain:SetMaterialColor(), you'll see that the first argument is a Material type, which is an Enum. So the method expects an Enum (or number to be more accurate), not a string denoting the material.
At the same time the second argument is a Color3, so (#,#,#) isn't apt, using it with the constructor Color3.fromRGB(#,#,#) is. If you are ever confused about what a method returns or expects, try referring to its documentation on https://developer.roblox.com/.
Here's an example of correct usage:
workspace.Terrain:SetMaterialColor(Enum.Material.Grass, Color3.fromRGB(123,123,123))
And ofcourse, Event:Connect() instead of Event:connect()
I am using biopython to complete a simple task: from a specific genebank fill, extract a gene ID and related information into a table.
When I was trying to compare if the Seq.SeqFeature.SeqFeature.location from different SeqFeature, it gives me False every time. Even in the situation below:
from Bio.SeqFeature import FeatureLocation
location1 = FeatureLocation(0,0,strand = 1)
location2 = FeatureLocation(0,0,strand = 1)
print(location1 == location2) # will print False
Only this will give me a desired result:
print(location1.start == location2.start and location1.end == location2.end and location1.strand == location2.strand) # will print True.
The problem was solved like this, but I am still wandering whether this is by design for some reason or the comparison method just haven't been built in yet.
Below are the process of why I come to this problem:
First I only extracted feat.type == 'CDS' information from genbank file, and found
all pseudo genes are lost.
Then I came up with the idea by recording the information in
feat.type == 'gene' and then look for either 'CDS' or
'misc_feature' to record more information for this gene.
This creates the need of confirming the 'CDS' or 'misc_feature'
is annotated at the same location in case there is multiple
'misc_feature' annotating some domains of the same gene.
I am still wandering whether this is by design for some reason or the
comparison method just haven't been built in yet.
The answer appears to be the latter. As far as I can tell, an __eq__ method for FeatureLocation was supposed to be added in 2011 but didn't make it in. Even other Biopython objects note the lack of ability to compare FeatureLocation objects in their source code comments.
However, it's in the source code for the in progress, not yet released Biopython 1.70
The only difference between the upcoming implementation and yours is comparison of the ref and ref_db fields which default to None, so if you're not using them, no problem.
For more background information, see pull request 1309.
What's the best way to do joins in Meteor/mongo? Use one of these packages, or something else:
publish-with-relations
https://github.com/erundook/meteor-publish-with-relations/blob/master/publish_with_relations.coffee
collection-helpers
https://github.com/dburles/meteor-collection-helpers
I'm very familiar with PWR, but collection-helpers is new to me. It looks like the two are complimentary.
PWR solves the somewhat complex problem of publishing documents to the client via a reactive join based on arbitrarily complex relationships. See this question for more details.
collection-helpers appears to be a set of convenience functions added to the client to be used when traversing collection relationships inside of a template (given that the required documents have already been published). For example, if you have books and authors in separate (but related) collections, you can immediately get myBook.author.fullName inside of a template without having to type out the extra find for the author.
currently the top popular solution in atmosphere seems to be publish-composite https://atmospherejs.com/reywood/publish-composite
This is a new application, and I have an index method on a Search controller. This also serves as the home page for the application, and I'm trying to decide if I am headed down the wrong path from a design pattern perspective.
The method is already 35 lines long. Here is what the method does:
3 lines of setting variables to determine what "level" of hierarchical data is being searched.
Another 10 lines to populate some view variables based on whether a subdomain was in the request or not.
A 10 line section to redirect to one of two pages based on:
1) If the user does not have access, and is signed in, and has not yet requested access, tell them "click here to request access to this brand".
2) If the user does not have access, is signed in, and has already requested access, tell them "so and so is reviewing your request".
Another 10 lines to build the dynamic arel.
I can't get it straight in my head how to separate these concerns, or even if they should be separated. I appreciate any help you can offer!
Summarizing what you've said in something codelike (sorry, don't know ruby; consider it pseudocode):
void index() {
establishHierarchyLevel();
if (requestIncludedSubdomain())
fillSubdomainFields();
else
fillNonsubdomainFields();
if (user.isSignedIn() && !user.hasAccess()) {
if (user.hasRequestedAccess())
letUserIn();
else
adviseUserOfRequestUnderReview();
}
buildDynamicArelWhateverThatIs();
}
14 lines instead of 35 (of course, the bodies of the extracted methods will lengthen the overall code, but you can look at this and know what it's doing). Is it worth doing? That really depends on whether it's clearer to you or subsequent programmers. My guess is it's worth doing, that splitting out little code blocks into their own method will make the code easier to maintain.
That's a lot of variables being set. Maybe this is a good opportunity for a module of some kind? Perhaps your module can make a lot of these decisions for you, as well as acting as a wrapper for a lot of these variables. Sorry I don't have a more specific answer.
Without your code it's somewhat difficult to suggest actual fixes, but it definitely sounds like a really wrong approach and that you're making things much harder than they need to be:
3 lines of setting variables to
determine what "level" of hierarchical
data is being searched
if there is a search form, I would think you would want to pass those straight from the params hash into scopes or Model.where() calls. Setup scopes on your model as appropriate.
Another 10 lines to populate some view variables based on whether a subdomain was in the request or not.
This seems to me like it should be at most 1 line. or that in your view, you should use if statements to change what you'd like your output to be depending on your subdomain.
A 10 line section to redirect to one of two pages based on:
the only thing different in your explanation of the 2 views is "whether the user has requested access" surely this is just a boolean variable? You only need 1 view. Wrap the differences into 2 partials and then in your view and write one if statement to choose between them.
Another 10 lines to build the dynamic arel.
It might be necessary to go into Arel, but I highly highly doubt it. Your actual search call can in most cases (and should aim to be) 1 line, done through the standard ActiveRecord query interface. You want to setup strong scopes in your models that take care of joining to other models/narrowing conditions, etc. through the ActiveRecord Query interface.