observers

Magento - Newsletter subscribe new field not saving

空扰寡人 提交于 2020-01-15 10:46:08
问题 I am trying to add a new field (subscriber_type) to the newsletter subscribe form. I have setup my observer and it is working and firing correctly (newsletter_subscriber_save_before): <?php class Mynamespace_Enhancednewsletter_Model_Observer { public function saveBefore($observer){ $subscriber = $observer->getEvent()->getSubscriber(); $type = Mage::app()->getRequest()->getParam('type'); // this contains my new data correctly $subscriber->setSubscriberType($type); return $this; } } I have also

How to detect switch between macOS default & dark mode using Swift 3

眉间皱痕 提交于 2020-01-13 09:40:07
问题 I want to change my status bar app icon when the user switches from default to dark mode and vice versa (using Swift 3). Here’s what i have so far: func applicationDidFinishLaunching(_ aNotification: Notification) { DistributedNotificationCenter.default().addObserver(self, selector: #selector(darkModeChanged(sender:)), name: "AppleInterfaceThemeChangedNotification", object: nil) } ... func darkModeChanged(sender: NSNotification) { print("mode changed") } Unfortunately, it’s not working. What

Ember .observe() returns callback twice when used with query-params

让人想犯罪 __ 提交于 2020-01-11 13:05:41
问题 http://jsbin.com/vowup/2 If I click change to random, program logs in console twice. For some strange reason it works ok when setting revision variable to string, but logs twice for number or any other kind of variable 回答1: Change your code to this and the answer will become clear: toggleHistory: (function() { console.log(this.get("revision")); }).observes("revision") You will see output like: 0.7038348997011781 "0.7038348997011781" Your numbers are being coerced to strings. That is caused by

Swift NSNotificationCenter?

跟風遠走 提交于 2020-01-11 12:43:56
问题 I'm trying to get the UITextViewTextDidChangeNotification to work. I'm new to using the NSNotificationCenter, so I'm having a hard time understanding what's going on exactly. I have a UITextView in a storyboard, and I've created an IBOutlet for it in my ViewController class and called it textView. This is my viewDidLoad function: override func viewDidLoad() { super.viewDidLoad() origin = self.view.frame.origin.y if let field = textView{ field.placeholder = placeholder field.layer.cornerRadius

LoaderCallbacks.onLoadFinished not called if activity is not active

﹥>﹥吖頭↗ 提交于 2020-01-07 05:30:29
问题 I have two activities who read the same database table. In activity A I have an AsyncTaskLoader and LoaderCallbacks objects with the following onLoadFinished code (in Scala): def onLoadFinished(loader: CursorLoader, cursor: Cursor) = { android.util.Log.d(TAG, "got results") cursor.setNotificationUri(ct.getContentResolver, observePath) cursor registerContentObserver new ContentObserver(new Handler) { override def onChange(selfChange: Boolean) = { android.util.Log.d(TAG, "change registered") if

Message.body empty in ActionMailer Observer

本小妞迷上赌 提交于 2020-01-06 03:06:56
问题 I am using an Observer to log outgoing emails; it fires correctly but when I attempt to extract the body of the email I get an empty string. The emails are definitely not blank and the logging record is definitely created. Breakpointing and inspecting message.body confirms that it is an empty string. class MailObserver def self.delivered_email(message) for address in message.to user = User.find_by_email(address) if user UserMailerLogging.create!(user_id: user.id, email_type: message.subject,

add step to OPC without overriding: update section

我怕爱的太早我们不能终老 提交于 2020-01-06 03:06:37
问题 so this is a follow up question of this one. I am adding a step before the shipping-methods by observer. I have a problem for getting the html used to update the step's tab content. Despite my best efforts it still loads the html of the shipping-method step instead of the html I want. This is the code of the observer: public function gotoViesStep($observer) { $response = $observer->getEvent()->getControllerAction()->getResponse(); $body = $response->getBody(); $result = Mage::helper('core')-

How can I observe Firebase child value changes in multiple nodes in Swift?

自古美人都是妖i 提交于 2020-01-01 18:52:10
问题 I have a "users" node in my Firebase database. Each user in it has a root with a uid for it. One of the properties of each user is "coordinates". I want to observe any change in any of those coordinates for all users. I almost need something like: usersDatabaseReference.child("*").child("coordinates").observe(.value, with: { (snapshot) in My structure looks like this: users abcdefghijklmnop coordinates: "12.345,12.345" other props qrstuvwxyz coordinates: "34.567,34.567" other props So I'm

How can I observe Firebase child value changes in multiple nodes in Swift?

独自空忆成欢 提交于 2020-01-01 18:52:08
问题 I have a "users" node in my Firebase database. Each user in it has a root with a uid for it. One of the properties of each user is "coordinates". I want to observe any change in any of those coordinates for all users. I almost need something like: usersDatabaseReference.child("*").child("coordinates").observe(.value, with: { (snapshot) in My structure looks like this: users abcdefghijklmnop coordinates: "12.345,12.345" other props qrstuvwxyz coordinates: "34.567,34.567" other props So I'm

Android FileObserver example in Xamarin/C#? [closed]

核能气质少年 提交于 2019-12-30 05:04:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I need guidance in creating a file observer in Xamarin c# (Android) Some sort of workable example would be wonderful ! I've tried to convert the java ones over to C# but due to my lack on experience in the C# environment, it's throwing too many errors when being compiled .. and getting the write reference code