How to update ad description using pre_item_add hook in OsClass? - osclass

I am writing a function to change the external links to my redirection link. I use pre_item_add hook, but I don't know how to update the submitted description with the new one. Does anyone know how to do it?
This is my idea:
function link_process($aItem){
$desc = $_POST['description'][$language_code];
Session::newInstance()->_setForm('description' , rewriteExternal($desc));
}
osc_add_hook('pre_item_add', 'link_process');

I made a similar change described here
Look for point 8. In my solution, but read all the answers to understand. Also there is a link in the solution to where I got this idea.

Related

Fancytree Tooltip API

I have been using Fancytree quite successfully for several years. Of late a new requirement has arisen. I would like to change the tooltip for a node that is currently visible. Is there a way to do this? How? Using an API? I have tried changing the tooltip property of an existing Fancytree node. Strangely, this did not work. What will work? Thank you.
Over on Github, this was resolved by Mr. Wendt. He suggested calling node.renderTitle() after modifying node.tooltip (which was correct) and he found a typo in my code. See Github issue #1093

I'm trying to find how to use response of event_search

eb.event_search(options, function (response) {
alert(response.size);
This is the main point of mine.
Hmm actually I already know what fields are the event_search has.
But.. the problem is I can't use it at all.
Here is the link.
http://developer.eventbrite.com/doc/events/event_search/#
There are a lot of feilds but whatever I do.
I can't use it.
such as
alert(response.num_showing);
alert(response.total_items);
alert(response.events.summary.num_showing);
alert(response.events_summar_num_showing);
alert(response.evnts_summary.num_showing);
But I got nothing.
Please let me know how to use them.
Thank you for your time.
I'd console.log(response); to see what you have.
You should also be able to get a preview of the object structure by using the 'Try it Now' button on the event_search API documentation page.

Quick Help for user defined function in ios

How to show Quick Help for the methods which we wrote ...?
Like for inbuilt function when we right click on it & Click Quick Help then we get all info about that method like that I want to do for user defined methods so that any one come to know that method takes which parameter and each parameter for which purpose?
For more explanation, see these two images:
Here is a solution for that. Also check apple documentation. You might have to create document set and install it in Xcode.
Edit: Here is another similar post, How do you populate the Xcode 4 "Option+Click" popover?
There is an open source tool called appledoc which helps with this. You can provide your own documentation in the header files and then run the appledoc script which will (depending on your settings) generate the docsets, install them into Xcode, create a HTML for the documentation as well as rss feeds so that changes to the documentation can be published.

Safari Extension - How to respond to Settings changes?

I'm currently working on an Extension for Safari 5 and I want to run a listener function whenever Settings changes are made. Apple provides an example for that, but it doesn't work for me. I currently have this listener function in my global html file:
function numberChanged()
{
if(event.key == "number")
alert("Number has changed!");
}
safari.self.addEventListener("change", numberChanged, false);
I hope somebody can help me. Does somebody know what I'm doing wrong?
I believe that you need to include ‘event’ as a parameter in your function so it looks like this:
function numberChanged(event)
{
if(event.key == "number")
alert("Number has changed!");
}
however, that said, it’s not working properly for me either (with or without the param), so I might be wrong. Interestingly, every time I change a field or click a button on this stackoverflow form, my alert (similar to yours) IS firing, even though I did not change my setting. totally weird.
update: I got it working, finally. The example that apple provides is just wrong. So there are two parts to the answer. I gave the first part above — you do need to add ‘event’ as a parameter to your function. the second part is that the addeventlistener has to be done on the settings object and not, as apple shows you, using ‘self’ from the global.html page. so the working call would look like this for you:
safari.extension.settings.addEventListener("change",numberChanged,false);

Opening ArcFM Attribute Editor from ArcObjects

I am trying to get the ArcFM Attribute Editor to open, after selecting a certain feature programatically.
I figured the simplest way would be to grab a hold on a reference to its button, and call its OnClick method. Will that be the best solution? And how do I find the UID of the button? (If there's a general way of finding a button/command UID, I'd appreciate it).
It seems both ESRI and M&M (not the candy...) went to great lengths to supply really bad documentation...
I got it at the end (with the help of my co-workers here). If anyone will ever be interested in opening the Attribute Editor, here goes:
UID uid = new UID();
uid.Value = "mmDesktop.MMAttributeCmd";
ICommandItem commandItem = document.CommandBars.Find(uid, false, false);
commandItem.Command.OnClick();
Share and enjoy.