WOW Addon Development / Events - events

Not sure if this is an appropriate programming question or not; but here goes....
I've written a very simple add-on that displays text/plays a sound when certain spells become usable (Overpower / Revenge).
But I've been unable to find the appropriate event to listen for to check this. My hack-ish approach is to simply check the state of the spells I care about whenever any event is passed to me.
Is there a specific event that I can be using? I went through the docs on WoWWiki and didn't seem to find anything relevant.

There used to be an addon that kept you spelled up, I forgot its name... it was GREAT! For a while I had more rage than I knew what to do with. But Blizzard decided that that was taking too much action out of player hands, so they stopped generating events for this kinda thing. Specifically, since about 2 years ago their policy is that no player actions (moving, casting, etc.) can be initiated by game events.
Nowadays, addons hook into things like the movement keys and check the status of spellups whenever the player moves around. It's klutzy, but comes reasonably close to doing what you want.
Still, you're not looking to initiate player action, just diddle with the GUI. That should still be possible. Lemme take a look...
One of the best resources for WOW addon programming is the WoW Wiki, from which I've just quoted a link to the buff event list. It looks like the UNIT_AURA event might be the one you're looking for, but go see for yourself!

I'd recommend using COMBAT_LOG_EVENT_UNFILTERED.I use it in an addon I wrote to notify me of certain spell procs and it works great.
I usually use wowprogramming.com for API documentation but in this case wowwiki does have a better description of the event and how to use it.
With the recent 3.3 patch this event isn't firing correctly for certain spell procs so just keep that in mind if it doesn't seem to be working for you.

Related

Media players that can be programmatically controlled? (Ruby)

I already know that iTunes has an interface that I can control, but the API is a bit opaque and I can't find it documented anywhere. Does anyone know of any good open-source or at least well-working media players that can be programmatically controlled?
In particular, I would like to be able to search a media library for a song by title or artist, and play, pause, resume, stop the song.
Ruby would be nice, because I'm working in it, but C would work too. I could write a wrapper.
Edit: My solution has to work on Windows, as that is the environment I am developing in.
XMMS works on a server / client basis. This means that it is relatively easy to control the playback, and the song queue. I'm not sure how easy is to handle file metadata (song info), but maybe that part can be handled independently.
Check this guide to get an overview of functions you can use.
Back in the day, I used MPD.

Help needed with windows hooks

I am working on building a system that can monitor how users react to security alerts on their systems (software updates, warnings etc.). It also needs to monitor the web traffic and the processes running on the system and I am looking to the community to help me design this system. We intend to provide users with test laptops and monitor their behavior over a period of time to see how they react to security alerts thrown by various applications and the OS(windows in this case).
Following are my questions
Can I use windows hooks to solve the first problem i.e finding how users reacted to the alerts thrown by various applications. Specifically, can global hooks be used to solve this?
(How this information should be collected (XML?) and relayed back to a server(how frequently?) is another problem)
Can I do this in C# or it has to be done only in c++ or VB?
Do you know any alternate approach to solve the problem? Is there any software that has these capabilities.
I have many more questions but getting these answered would be a good first step. Really hoping for some good insights from the knowledgeable people on this community
Thank you in advance
Edit:
Example scenario is when adobe prompts you to update the flash player or the antivirus prompts you to update definitions or any application displays a notification(security related having keywords like update, warning, install etc.) needing the user to take some action. Windows system updates is another example. I want to know how the user reacted to these alerts/notifications/updates (which are typically a pop-up window). So i was wondering if i placed a global hook that can monitor the content of the windows displayed on screen and notify me(server) when certain words like update, alert, warning etc. appear in the content/title of the windows and what the user did with the message(dismissed it, Oked it etc). Unfortunately, i do not have any more specifications than this. I can use anything I want to achieve this and I am not clear on what my choices are.
Edit 2:
After having reviewed my requirements and having read about hooks, I feel like I could achieve this by a combination of hooks and the following textGrab SDK, http://www.renovation-software.com/en/text-grab-sdk/textgrab-sdk.html. I want some guidance to know if I am on the right track. I am thinking if I can install hooks then it gives me handles to all possible windows on the screen and I can use the textGRAB SDK to look for certain keywords in those windows. Although this may capture some interesting text, I am still not sure how I will know what action the user had taken on the window. Anybody having any experience with either hooks or textGRAB, please let me know if this looks like a reasonable thing to do. If the community has some other Ideas on how I could possibly monitor security related messages thrown by any application in the system, please suggest. I am looking forward to some useful advice for completing a challenging project.
First of all, you need to define, how you will "see" security alerts in code. "Security alert" is quite a vague term. Will it be some window with some caption and some message to the user or ... ?
Next, about web and processes: Windows hooks won't help you with your task. They are more low-level and not as advanced as you'd need. You can't hook network traffic (you need either network filter driver for pre-Vista or Microsoft Filtering Platform for Vista and later). See this question for some information about checking the process list with C# (there seems to be no easy way to catch process startup either).
It honestly sounds like you need a more solid direction. I commend you for trying to provide details, but It appears that you still need more information about your problem(s)..
I will attempt to answer some of your questions, but like I said - it sounds like you need to know more about your problems before we can provide you with optimal answer(s).
-Alerts is too vague a term, you will need to define this better. Are these 'alerts' applications that YOU have control over or are they third party applications? Not every application will show an 'Alert' in the same fashion, and even if they did - I think using a System Level Hook would probably be too problematic to implement your solution with. I'm not saying it's necessarily impossible, but you're talking about possibly implementing a different set of logic(to determine the data for a given application's Alert(s)) for each application that you want to monitor.
-It's impossible for any of us to determine the optimal storage mechanism for your particular needs, that is something that you will either need to provide more details about or decide on your own.
-How often you collect data is also something that you will have to either provide more details for or decide for on your own.
-C/C++ Would probably provide you with the most portable solution, although there is nothing preventing you from using c# to call Win32 API. (Not everyone has the .NET framework installed - believe it or not)
-The problem that you mentioned appears to be a somewhat specialized problem... I don't know of any existing software that will do everything that you want to do.
Another possible issue that you haven't touched on:
You haven't specified your target audience for this 'service', but I want you to know that if I found an application monitoring as many events as what you're talking about doing, I would promptly remove it and write a nasty letter to the company that wrote it.
In summary, Read this Article on hooks to get a better understanding of how they work.

What Confuses you about Magento Widgets API?

This is a little vague, but I hope I'm allowed.
I'd like to get a feel for what the Magento developer community thinks of the Widgets API. Are they clear or confusing, useful or useless. The more detail the better. Do you use the feature? If not, why not? What don't you understand about the feature? etc. etc.
When I say Widgets, I'm referring the programatic APIs specific to the feature.
Yeah its definitely something we have wanted to take more of a look at but we haven't set any budget aside to actually investigate. I would love to create some little widgets that we could utilize for each client instead of having to create blocks that the client then has to pass data to inside of a static block. I looked into it about a year ago and just haven't looked back.
The funny thing is now there are a lot of widgets out there in the community, yet you still don't hear anything about them. I guess we just need more articles about them, which I am sure after you write one, we will all get it :). Basically people don't have time with how busy they are probably to investigate the Widget API fully enough to utilize it. And since there isn't a lot of knowledge base information about it, you don't see a lot of people using them.
I as a developer understand the usefulness of this API and it is not harder to use than any other thing in Magento. I have used it a lot cause I can understand the feature.
But me as the person who has to explain what is a widget or why I made something to be a widget, how should a user or designer use it, why there is a block and a widget side by side and what's the difference. Then I tend to think that this is a total disaster and we should have only widgets or only blocks or one common name and just some type/attribute/value that distinguish static and dynamic version of widgets so I could say : "Hey this block/widget you can drag or include wherever you like in your site and this one you can't"
I was excited about the widget feature when it came out. There is decent documentation available, and I was quickly able to code my own simple widgets. Since then, however, I never actually used widgets in my projects. I have never really understood when to use widgets, and I almost forgot about them.
I feel like we need articles and examples to show the usefulness of widgets. I need widgets to pop up in my head when a client asks for features that can be solved using widgets. Recently, a client wanted to have some text in the footer on the home page. I created a static block and declared it in layout/local.xml. With widgets, this could all have been done from the backend.

Cocoa get Power Adapter Status

I'm currently working on a Backup Application, and I have received a lot of requests for features to be added recently, and the top one of them is adding a checkbox like "Back Up when on Battery Power" like Time Machine has.
So, is there a way I can get the status of the Power Adapter (plugged in and plugged in)? I assume that if one had a Desktop Mac, like iMac, etc, I would probably just get Plugged In all the time. Therefore, I need means of detecting if the computer is a portable or not.
I assume IOKit would be a library to look at, but I simply could not find anything in the docs, that are barely existent anyways on that Framework. Then, since it is an older Carbon Framework, is there a way to register a callback that gets called when that power state changes? That way I can properly implement this checkbox's functionality.
I'd appreciate help in clarifying this subject.
IOPowerSources.h has the functions you need. Start with IOPSNotificationCreateRunLoopSource() to create a run loop source and in your callback interrogate the power source info starting with IOPSCopyPowerSourcesInfo() and working your way down. There may be better examples, but this file appears to be a reasonable demonstration of how it's done; enough to get you started.

Does SproutCore's "Binding" feature let widgets initiate a call to the server to obtain data?

My team is tasked with quickly evaluating SproutCore and a couple of other alternatives. There's not really enough time for a deep dive, but our findings might let us convince the powers that be to allow for a deeper dive. (Right now, we're just taking a quick glance to see "what's out there").
So me and a teammate have started looking at SproutCore. I'm loving it so far, but he has already decided he doesn't like it. The reason he doesn't like it is he got the impression that the "data binding" in the Todos tutorial is the naive kind of data binding that a Visual Studio grid control might do ... where the widget itself is allowed to reach across the Internet to the server and obtain new data whenever it needs to paint itself.
I would be shocked if that were the case, because it is such a naive approach that really is only good for demo-ware, and SproutCore feels much more elegant than that to me.
Unfortunately, we're probably not going to have time for either one of us to find out for sure. So, can someone who has used SproutCore and knows it well please explain a bit about how Bindings work, and whether or not Bindings are allowed to initiate an Ajax call to the server to obtain more data?
UPDATE: I got the answers I need, partly from the google group and partly from digging deeper. The Bindings are exactly what I thought they were ... a great tool for connecting objects in memory inside the Javascript environment. They eliminate a TON of "glue code", and, like the rest of SproutCore, are REALLY well done. In no way is it anything close to "naive data binding". SproutCore is one powerful, elegant library, and I hope to get plenty of chances to use it (though my current project, alas, chose to go with something else).
I don't think I qualify as "knowing [SproutCore] well," but I don't think your question is really about bindings per se; it's about what's allowed to poll the server for data. It's my impression that bindings largely talk to each other inside the application. A binding can change data in the (local) Store, but I don't think the Store necessarily initiates an Ajax call every time it's changed.
ETA: This work in progress reiterates, "Bindings are used for inter-object communication."

Resources