How do you populate the Xcode 4 "Option+Click" popover? - xcode4

In Xcode 4, if you option + click on a keyword, then the said keyword will appear in a popover with a bunch of descriptive information, like so:
However, when I option + click on my own method or variable, all I get is a link to the file in which the object was declared:
How is this done? Can I take advantage of this for my own code?
(I've noticed in some of the framework headers, that there is some sort of special comment syntax. Could that be related?)

You must create your own "documentation set" for your API. Search Xcode's documentation for "Documentation Set Guide" and dig in. The "Documentation Sets" section of the guide specifically states that Quick Help uses this.
With a doc set in place, not only will this popup find the description but it will be available in the QuickHelp in the Utility pane as well as the documentation browser in the Organizer.

As of Xcode 5.0, Doxygen and HeaderDoc formatting for variables and methods is automatically parsed and rendered in the Quick Help popover. More information about it here, but here's some key bits:
/**
* Add a data point to the data source.
* (Removes the oldest data point if the data source contains kMaxDataPoints objects.)
*
* #param aDataPoint An instance of ABCDataPoint.
* #return The oldest data point, if any.
*/
- (ABCDataPoint *)addDataToDataSource:(ABCDataPoint *)aDataPoint;
renders in Xcode as:
As for properties, it's as easy as:
/// Base64-encoded data.
#property (nonatomic, strong) NSData *data;
When option-clicked, this lovely popover appears:

Related

Full list of methods for COM objects

I would like to know which functions I can use with RDCOMClient objects.
For example, to create an email we can use
OutApp <- COMCreate("Outlook.Application")
# create an email
outMail = OutApp$CreateItem(0)
Along with outMail[["subject"]], outMail[["HTMLbody"]] or outMail[["Attachments"]]$Add(filepath)
But how can I get a comprehensive list?
The RDCOMClient doc is out-of date and the functions listed such as getFuncs() and getElements() are not available in the package anymore. Using names() to try and find out what was under the hood gave me no result, and
install.packages("remotes")
remotes::install_github("omegahat/SWinTypeLibs")
gives an error as well. Any idea on how to check Outlook for objects?
If you have Outlook, Excel or Word installed then you can do the following ...
Press F11 to get to a Visual Basic Application (VBA) Integrated Development Environment (IDE).
On the menu bar go to Tools->References to prompt the References dialog box.
On the References dialog box, in the Available References checkbox list, page down until you find Microsoft Outlook Library (or similar), once found then check the checkbox and then press OK to confirm selection and dismiss dialog. This adds a reference to the Outlook type library to the current project.
With the Outlook type library referenced (see step (3)) one can now press F2 to show the Object Browser dialog box.
In the Object Browser dialog box, select the top left dropdown list which will probably say <All Libraries> . Change the dropdown so it says Outlook, this will scope the object browser to just the Outlook type library.
You can now browse all the objects in the Outlook type library. Select a class in the Classes pane on the left hand side and the class's methods will appear in the right hand side.
Enjoy!
I am not sure of a way to do this in R, but you should be able to do it in powershell.
I am still learning powershell, but this at the very least gets all the properties and methods of an object:
$ol = New-Object -ComObject Outlook.Application
$new_item = $ol.CreateItem(0)
$new_item | Get-Member
TypeName: System.__ComObject#{...}
Name MemberType Definition
---- ---------- --------
HTMLBody Property string HTMLBody () {get} {set}
Subject Property string Subject () {get} {set}
Attachments Property Attachments Attachments() {get}
There are a lot more than this but I'm actually transcribing from my other computer which has Outlook installed. The Get-Member works on more than just the application object so you can also see the members and properties accessible to the Outlook object itself or other COMS.
It also appears that the VBA resources may be helpful:
https://learn.microsoft.com/en-us/office/vba/api/outlook.application.createitem
Name
Value
Description
olAppointmentItem
1
An AppointmentItem object.
olContactItem
2
A ContactItem object.
olDistributionListItem
7
A DistListItem object.
olJournalItem
4
A JournalItem object.
....
...
...
And most importantly:
https://learn.microsoft.com/en-us/office/vba/api/outlook.mailitem
PROPERTIES
---------
Actions
AlternateRecipientAllowed
Application
Attachments
AutoForwarded
AutoResolvedWinner
BCC
BillingInformation
Body
BodyFormat
Categories
CC
...
This can somewhat easily be done for Outlook, because every outlook object has a class property.
If you have a given object of COMIDispatch class in R, and it is a reference to an Outlook object, you can use the function class() to retrieve its class and then check the OlObjectClass enumeration for what properties and methods that class has.
A short step by step example:
> # initialise the app
> Outlook_App <- RDCOMClient::COMCreate("Outlook.Application")
In order to find out what we can do with that object, we need to look up the reference. For that, we need its class.
> Outlook_App$class()
[1] 0
So we look up 0 in the OlObjectClass enumeration and find out it's an Application object. Its properties and methods are listed in the referenced link in the OlObjectClass enumeration: Application.
Here, we have access to the methods and properties. For the events, we would need the now defunct packages RDCOMEvents and/or RDCOMServer.
But we can try the method getNameSpace("MAPI") to access some other functionality. We know that we have to use the "MAPI" parameter from the method description linked above.
> Outlook_Namespace <- Outlook_App$getNameSpace("MAPI")
Now, the Namepace object has another class, for which we can look up the object definition and so on and so forth.
Unfortunately this does not work for Excel objects, since they do not have a class property, if anyone knows a solution please contact me.

How can I test Firebase Dynamic Links if my app is not in the App Store?

I'd like to be able to open the app and print the parameters when I click on the dynamic link (even though it's not published).
Is there a way to do this?
Yes! In fact, I go through this exact process in the getting started videoS (part 1), (part 2), which I recommend you check out if you haven't yet.
But, generally speaking, you can test the "Open my app if I have it installed" flow simply by clicking on a dynamic link. If your app is installed on the device, it should open up just fine; even if it's not a published app.
If you want to test the non-installed flow, this is pretty easy, too.
First, give your Firebase project an app store ID in your project settings. It can be any valid App store ID -- it doesn't have to be for your app.
Then generate a new dynamic link.
This time, when you click on this new link, it should take you to the app store for the ID you listed above. You don't need to actually install this app -- just making it to the app store listing is good enough.
Now, go ahead and reinstall and run your app. If everything is working properly, it should retrieve and display the dynamic link data for you.
I have faced the same issues, and after spending many hours trying to found a solution, and following the instruction to debug explained by Todd Kerpelman post, I could identify that the firebase has not sent a universal link on the first app launch and has sent the scheme URL with the following structure:
[bundle_id]://google/link/?deep_link_id=[firebase_universal_link]
After identifying that, I found the dynamicLinkFromCustomSchemeURL method inside of the Firesabe SDK and I could solve my problem on the first app launch by dynamic links.
/**
* #method dynamicLinkFromCustomSchemeURL:
* #abstract Get a Dynamic Link from a custom scheme URL. This method parses URLs with a custom
* scheme, for instance, "comgoogleapp://google/link?deep_link_id=abc123". It is suggested to
* call it inside your |UIApplicationDelegate|'s
* |application:openURL:sourceApplication:annotation| and |application:openURL:options:|
* methods.
* #param url Custom scheme URL.
* #return Dynamic Link object if the URL is valid and has link parameter, otherwise nil.
*/
- (nullable FIRDynamicLink *)dynamicLinkFromCustomSchemeURL:(NSURL *)url
NS_SWIFT_NAME(dynamicLink(fromCustomSchemeURL:));
/**
* #method dynamicLinkFromUniversalLinkURL:completion:
* #abstract Get a Dynamic Link from a universal link URL. This method parses the universal link
* URLs, for instance,
* "https://example.page.link?link=https://www.google.com&ibi=com.google.app&ius=comgoogleapp".
* It is suggested to call it inside your |UIApplicationDelegate|'s
* |application:continueUserActivity:restorationHandler:| method.
* #param URL Custom scheme URL.
* #param completion A block that handles the outcome of attempting to get a Dynamic Link from a
* universal link URL.
*/
- (void)dynamicLinkFromUniversalLinkURL:(NSURL *)url
completion:(FIRDynamicLinkUniversalLinkHandler)completion
NS_SWIFT_NAME(dynamicLink(fromUniversalLink:completion:));
/**
* #method dynamicLinkFromUniversalLinkURL:
* #abstract Get a Dynamic Link from a universal link URL. This method parses universal link
* URLs, for instance,
* "https://example.page.link?link=https://www.google.com&ibi=com.google.app&ius=comgoogleapp".
* It is suggested to call it inside your |UIApplicationDelegate|'s
* |application:continueUserActivity:restorationHandler:| method.
* #param url Custom scheme URL.
* #return Dynamic Link object if the URL is valid and has link parameter, otherwise nil.
*/

Migrating from (now obsolete) custom ATImage content type

We had a whole collection of Plone 3 sites with a custom Image type
subclassed from ATImage. This allowed us to add an extra image scaling to the
standard list ("'logo':(454, 58)", used by our theme package).
While this still works in Plone 4, it isn't really the correct approach now that
plone.app.imaging is part of the standard toolkit. That can define custom scales on
the fly.
It looks like I can enable plone.app.imaging on any type subclassed
from ATImage by simply setting "sizes = None" for the collection of custom
scales on the type. I am however then left with a redundant subclass of ATImage.
Looking long term, it would be useful to replace all of our existing "FalconImage"
content items (hundreds in total) with standard "Image" content items.
A brief experiment on a test site reveals that if I just walk through the document
tree updating the portal_type attribute from "FalconImage" to "Image" then
the content behaves as an "Image": each object suddenly acquires a
Transform tab and all of the scales defined by ##imaging-controlpanel.
I am sure that there would be fallout from such a brute force approach.
Is there a recommended approach for transforming one type into another?
(I'm happy to add source for our custom ATImage type if anyone thinks that
it is relevant. It is really just a very minimal tweak of ATImage, with a
different collection of sizes on the ImageField)
Yes, there is a recommended approach:
http://pypi.python.org/pypi/Products.contentmigration
The only thing that you have to do is to write a custom migration from FalconImage to Image.
Bye,
Giacomo
You need to use Products.contentmigration but the docs there are no place to start. Use the docs at plone.org for a step-by-step on migrating content.
Thanks to Giacomo and Ross for the pointers.
Just in case it is useful to others, my migration code ended up looking like the following:
from Products.contentmigration.walker import CustomQueryWalker
from Products.contentmigration.archetypes import InplaceATItemMigrator
class FalconImageMigrator(InplaceATItemMigrator):
walker = CustomQueryWalker
src_meta_type = "FalconImage"
src_portal_type = "FalconImage"
dst_meta_type = "ATBlob"
dst_portal_type = "Image"
# Following stolen from plone.app.blob.migrations, ATImageToBlobImageMigrator
# migrate all fields except 'image', which needs special handling...
fields_map = {
'image': None,
}
def migrate_data(self):
self.new.getField('image').getMutator(self.new)(self.old)
# ATFileToBlobMigrator reindexes certain fields. Otherwise we
# need to clear and rebuild the entire catalog.
def last_migrate_reindex(self):
self.new.reindexObject(idxs=['object_provides', 'portal_type',
'Type', 'UID'])
migrator = FalconImageMigrator
walker = migrator.walker(portal, FalconImageMigrator)
walker.go()
print walker.getOutput()
Complications:
Image is a little odd as a destination type, as data gets migrated into the blob store.
We need to update the catalog so that "resolveuid/UID" links generated by TinyMCE
continue to work. last_migrate_reindex() method on Migrator class should be faster than clearing and rebuilding the entire catalog from scratch.

comma separated views list

everyone. I've got a problem with Views 2. I have a view with row's style set to fields (Got only title field). I want to display these titles with comma separated list.
For example:
Kazakhstan, England, China, Korea
tried to do this:
foreach($fields['title']->content as $titles) {
$zagolovki[] = $titles['view'];
}
$title_list = implode(', ', $zagolovki);
print $title_list;
but it doesn't works - says error in argument. Please help me someone to display node titles in views with comma separated list. Thanks!
I quikly took a look in the views-view-fields.tpl.php that comes with the views module and it says
/*
* - $view: The view in use.
* - $fields: an array of $field objects. Each one contains:
* - $field->content: The output of the field.
* - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
* - $field->class: The safe class id to use.
* - $field->handler: The Views field handler object controlling this field. Do not use
* var_export to dump this object, as it can't handle the recursion.
* - $field->inline: Whether or not the field should be inline.
* - $field->inline_html: either div or span based on the above flag.
* - $field->separator: an optional separator that may appear before a field.
* - $row: The raw result object from the query, with all data it fetched.
*/
So I think $fields is what you should iterate over. If you want to debug the structure of your $fields install the devel-module and use dpm() or dsm() to display the content of $field. Maybe take the template you edited (that should be one of the view-module templates in the views/theme folder) and look what happens there.
Where does it say the error occurs, though? nonsenz is probably right that $fields['title']->content is not an array. For debugging only, try adding
print("array content: "+ is_array($fields['title']->content));
before the foreach. If you know that $fields is a small nested structure, you can try a
print(str_replace("\n","<br/>",print_r($fields,true));
to see what exactly is in it, so that you can make verify that what you're trying to iterate over is in fact iterable.
I've created this module:
http://drupal.org/project/views_delimited_list
I'm not too sure about fiddling with the options to create merely a comma-separated list. You should be able to, and if you can't I'll fix it.

What determines sorting of files in a QFileDialog?

Users open files in our app through a QFileDialog. The order of the filenames is bizarre. What is determining the sorting order, and how can we make it sort by filenames, or otherwise impose our own sorting, perhaps giving it a pointer to our own comparison function?
The documentation and online forums haven't been helpful. Unless it's well hidden, there doesn't seem to be any sorting method, property, etc.
This is a primarily Linux app, but also runs on Macs. (I know nothing about Mac.)
Here is the juicy part of the source code:
QtFileDialog chooser(parent, caption, directory, filter);
/// QtFileDialog is our class derived from QFileDialog
chooser.setModal(true);
chooser.setAcceptMode(acceptMode);
chooser.setFileMode(fileMode);
QStringList hist = chooser.history();
chooser.setHistory(hist);
/* point "x" */
if(chooser.exec()) {
QStringList files = chooser.selectedFiles();
...blah blah blah...
From one of the answers, I tried an evil experiment, adding this ill-informed guesswork code at "point x":
QSortFilterProxyModel *sorter = new QSortFilterProxyModel();
sorter->sort(1); // ???
chooser.setProxyModel(sorter);
But this crashed spectacularly at a point about 33 subroutine calls deep from this level of code. I admit, even after reading the Qt4 documentation and sample code, I have no idea of the proper usage of QSortFilterProxyModel.
Are you using QFileDialog by calling exec()? If you are, you should have a button to switch the view to Detail View. This will give you some column headers that you can click on to sort the files. It should remember that mode the next time the dialog opens but you can force it by calling setViewMode(QFileDialog::Detail) before calling exec().
An alternative is to call the static function QFileDialog::getOpenFileName() which will open a file dialog that is native to the OS on which you are running. Your users may like the familiarity of this option better.
Update 1:
About sort order in screen cap from OP:
This screen capture is actually showing a sorted list. I don't know if the listing behaviour is originating from the Qt dialog or the underlying file system but I know Windows XP and later do it this way.
When sorting filenames with embedded numbers, any runs of consecutive digits are treated as a single number. With the more classic plain string sorting, files would be sorted like this:
A_A_10e0
A_A_9a05
Going character by character, the first 1 sorts before the 9.
.. But with numerical interpretation (as in Windows 7 at least), they are sorted as:
A_A_9a05
A_A_10e0
The 9 sorts before the 10.
So, the sorting you are seeing is alphabetical with numerical interpretation and not just straight character by character. Some deep digging may be required to see if that is Qt behaviour or OS behaviour and whether or not it can be configured.
Update 2:
The QSortFilterProxyModel will sort the strings alphabetically by default so there is not much work to using it to get the behavior you are looking for. Use the following code where you have "point x" in your example.. (you almost had it :)
QSortFilterProxyModel *sorter = new QSortFilterProxyModel();
sorter->setDynamicSortFilter(true); // This ensures the proxy will resort when the model changes
chooser.setProxyModel(sorter);
I think what you need to do is create a QSortFilterProxyModel which you then set in your QFileDialog with QFileDialog::setProxyModel(QAbstractProxyModel * proxyModel)
Here are some relevant links to the Qt 4.6 docs about it.
http://doc.trolltech.com/4.6/qfiledialog.html#setProxyModel
http://doc.trolltech.com/4.6/qsortfilterproxymodel.html#details
I don't think it depends upon the implementation of Qt libraries... But upon the Native OS implementation..
For example in Windows,
if you use QFileDialog, it will display the Files and Directories by Name sorted.. It is the same when used in other applications. In the sense that, if you try to open a file through MS- Word, it indeed displays the Files and directories as Name sorted by default..
And am not sure about other environments since am not used to them...
But in Windows, you can change the sorted order by right-click in the area of Files and Directories display and can select the options you like.. For e.g like Name,size,type, modified... And also which is similar, when you use an MS-Word application...
So, I believe it does depend on the Native OS implementation and not on QFileDialog's...

Resources