how can I print the credit card type in my code? - cs50

function to get the credit card type
in this photo a part of my code of the credit problem in cs50 course.
I think I wrote it right but the matter is it does not want to print any thing and I had tried different solutions but it didn't work either so I hope I could find some one who can help me with it especially if they tried to solve this problem before.
thanks in advance..

Related

Using VLookup to create a functional DATE() format output

Here is the deal, I am dealing with some really shoddy output, and no I can't correct this... it's not my data. I just have to work with it.
Here is what I want to do, because this needs to kill two birds with one stone.
I need to use VLookup to look up a ticket, once it looks up the ticket it needs to output a date. The date though is stuck between a universal "date" string...
2019-06-10T17:20:28+00:00
This string is in tab Ticket_Import in row O.
Now, I need to translate to a date that can be later sifted through and put into a chart. The only way I can figure out to do this is using DATE()
Now, here is my problem. I have figured out how to do it...mostly. I am just getting the wrong date back in return, I think it's skipping the data and just saying "Good luck jr." in it's own way...
Here is my formula:
=XLOOKUP(A1261,Ticket_Import!B:B,DATE(LEFT(Ticket_Import!O:O,4),MID(Ticket_Import!O:O,6,2),MID(Ticket_Import!O:O,8,2)),"Empty")
Now, I took this one specifically because I need the date to show up so it will be searchable, which I am not even sure if this will work or not.
The XLOOKUP is searching for the number in A1261, which is 2690.
2690's O row output is
2019-06-10T17:20:28+00:00
Now, when I use this script I wrote it shows as an end result 2019-12-31 instead of 2019-06-10
Which is telling me it can't output properly...
Can someone help me out with this and explain or show me how to get this actually working properly?
Like I said, I can't edit the raw data, but I can make the data output be whatever it needs to be to make this work... as long as I can understand it and reproduce it, because I have to do this over 4,000 more times...
Realistically, once this is done I am going to be copying and pasting the output anyway through a VBA script so that this will not be such a resource hog in the future. I am playing catch up to something that needed to be done ages ago...
Any help would be greatly appreciated.
Thanks!
Solved it...! (YAY ME!)
Ok, I know immature, but this was causing me no end of grief...
The proper code is:
=XLOOKUP(A1261,Ticket_Import!B:B,DATE(LEFT(Ticket_Import!O:O,4),MID(Ticket_Import!O:O,6,2),MID(Ticket_Import!O:O,9,2)),"Empty")
I had an improper mid alignment for the day.
Thanks for everyone that had a chance to look at and and scratch their heads for a minute or two... either way, This is also good for people to use later if they need to make it work for them as well!

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

Make Spheres on a Canvas3D 'clickable'

I've got a Canvas3D which holds a couple Spheres. Is there a way to detect when the user clicks on a sphere?
In Java3D this is known as "Picking" you should read the section on the Java3D API Tutorial if you haven't already. Here is the section on Interacting with objects, you're looking for page 35 by the way:
http://java.sun.com/developer/onlineTraining/java3d/j3d_tutorial_ch4.pdf
Heres the entire tutorial:
http://java.sun.com/developer/onlineTraining/java3d/
Hopefully this answer didn't come too late! I just started Java3D myself, hope this helped!

How to remove NSMenuItem gap above custom view

I was looking for something discussed in following posts.
Gap above NSMenuItem custom view.
Reverse engineering an NSMenu for a Status Bar Item
I tried the carbon code provided by Pierre Bernard
initially, i was getting same error "EXC_BAD_ACCESS on the line InstallControlEventHandler" like other had. I play with the code lots and accidently found the solution.
I have just replaced the InstallControlEventHandler function call to HIViewInstallEventHandler and everything is working fine.
Hope this will help others. Let me know if anyone need further clarification.
Special thanks to Pierre Bernard to provide great code.
Thanks
Just replace the InstallControlEventHandler function call to HIViewInstallEventHandler and code will work fine.
Thanks

Three20: example of showMenu:forCell

I am not able to find any example that uses this function.
I need to see how implement a menu selecting a row in a table.
Can someone help?
Have you seen TTTableViewController showMenu:forCell: example?
The last comment on the only answer has a link to a github that has some example code. I think the author of the only answer is also the person who wrote http://cybersam.com/programming/tttableviewcontroller-showmenuforcell-example

Resources