Naming decision: "Create it if it doesn't exist" in one word - naming

Exact duplicate of
Function name for creating something if it's not there yet
I have a function which checks if a certain thing exists, and if not, creates it. What would be a good word for it? Right now I'm using "maintain", so the function is called maintain_buffer_on_path, but I think that "maintain" is misleading. Can you think of a better one-word name?

I usually use ensure for this.

EnsureExists (or simpler Ensure) seems to be some kind of a convention.

I've heard the word vivify to refer to this.

I've used summon for this before.

Related

Accessing Area.Name Throws Error

I'm just trying to find a way to access the name property of an Area element inside Revit Python Shell, tried looking on Jeremy Tammik's amazingly informative blog, tried AUGI, Revit API docs, been looking for 2 days now...
Tried accessing via a bunch of ways, FilteredElementsCollector(doc).OfCategory(BuiltInCategory.OST_Areas), tried by Area class, tried through AreaTag, every single time I get an error under every circumstance and it's driving me nuts, it seems like such a simple issue that I can't seem to grasp!
EDIT: Also tried by element id, through tags, through area schemes, nada, no go...
Can anyone please tell me how to access this property via RPS?
I would say two things:
areaObject.LookupParameter("Name")
areaObject.GetParameters("Name")
...are valid methods. Please notice how I used GetParameters() NOT GetParameter(). There are some drawbacks to using either one of the two. The lookup method will return FIRST parameter that matches the name which in many cases might be a different parameter for different elements. It's not very reliable.
GetParameters() method will return them all if there are multiple so then you have to deal with a List<Parameter> rather than a single object that you can extract your value from.
I would personally recommend to use areaObject.get_Parameter(BuiltInParameter.ROOM_NAME) method to extract a Name value from Area object. The BuiltInParameter always points at the same parameter, and will reliably return just that one parameter. Here's a little more details about these methods:
http://www.revitapidocs.com/2018/4400b9f8-3787-0947-5113-2522ff5e5de2.htm
To answer my own question, I actually never thought of looking through the code of other Revit Python scripts... in this case of PyRevit, which is in my opinion far more eloquently written than RPS, raelly looking forward for their console work to be done!
Basically, I had mistakenly used GetParameter('parameter') instead of LookupParameter('parameter').
As I said, it was something stupidly simple that I just didn't understand.
If anyone has sufficient knowledge to coherently clarify this, please do answer!
Many thanks!
Maybe your issue is the same as this one ? :
https://groups.google.com/forum/#!searchin/RevitPythonShell/name|sort:relevance/revitpythonshell/uaxB1FLXG80/sdJNrTfoPuUJ
Your_Area.Name # throws error
Element.Name.GetValue(Your_Area) # works great

Is there a way to tell whether StorageArea.remove actually removed something?

Is there a way to know whether a call to StorageArea.remove actually removed something (and if it did, how many items)?
The documentation doesn't seem to say anything about it, and I'm hoping there is some way to do that that doesn't require calling get first to check whether something is there.
Since, as you can see from the docs, the callback has no parameters - no, nothing is reported, except for errors through an API variable.
The route with get first is the right one.
Semantically, remove is "make sure those elements aren't there". That's exactly what it does.

What does =++C5 mean in excel?

I am looking at a template spreadsheet which, among other things has
=++C5*EXP(-C7*C6)
as a formula. What does the ++ in ++C5 do?
If it doesn't do anything, can you think of a reason where it would do something? I would be very surprised if the template has mistakes/redundancies.
It doesn't mean anything. It's exactly the same than to write =C5*EXP(-C7*C6)

unistd.h implementation

My toolchain (Realview) does not have implementation of unistd.h, I have a code that I need to use that is using unistd.h, some function like access, open.
So I need to implement this functions by myself.
My question is, is there another alternative or some reference (except the function description, found here) that I can use in order to port/implement these functions?
What is the correct way to do that? It's my first time posting.
The "function description" you link to has the page title "The Open Group Base Specifications Issue 6", which indicates that it's perhaps a bit more of a heavy-weight than just being a mere description.
If you implement a function that fulfills all the text on that page correctly, chances are you've managed to re-implement it in a compatible way, so that programs complying to the same standard will build and work.
Not sure what else you feel you would need.

pycassa remove specific key from super column

I know how to remove an entire super column, but not an individual key within. My google kung fu has failed me.
so, to remove a super column:
cf_accounts.remove('key', ['super_column'])
Am I barking up the wrong tree?
Help appreciated.
You need to use the super_column parameter.
cf.remove('key', super_column='super_column', columns=['sub_column'])
With that said, #the paul's advice is definitely sound.

Resources