Replacement Segue Fails to Function...why? - segue

Problem:
Attempting to re-create a functioning segue fails.
Scenario:
I'm attempting to create a drop-down menu using a UIContainerView connected to the hosting UIViewController via an 'embedded' segue; from which the member UIViewControllers are connected via a 'custom' segue.
I'm trying to get a firm grasp of how to work (create/re-create) with customized segues.
Here's what the result should look like:
Here's the list of segues:
This is the segue wiring that allows this to happen:
Each of these segues work with or w/out its identifier. The following method is fired for all functional segues:
- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
if ([self.currentSegueIdentifier isEqual:identifier]) {
//Dont perform segue, if visible ViewController is already the destination ViewController
return NO;
}
return YES;
}
However, If I were to remove any of these segues, and try to re-establish a connection (via control-drag from origin to target) with all apparent attributes re-established, the new segue FAILS to fire.
That is, the above 'shouldPerformSegueWithIdentifier()' DOES NOT FIRE.
Question: what am I missing here?

I had made a control-drag from the origin UIViewController ---> destination UIViewController. The attributes were set to be the EXACT values of the original segue. Yet it failed to function.
Eventually I took notice of the button that was supposed to trigger the numbed segue. I compared its link properties with the working others. And that was the clue.
The solution was to link between the BUTTON & target UIViewController; NOT between the two UIViewControllers:

Related

New to Azure Event Grid - trying to react to *any* object being created, deleted or modified

I'm completely new to Event Grid, but have been tasked with creating a way to track anytime any object is created, deleted, or modified within a subscription (additional noise filtering to be added later). Does this sound like I'm on the right track?
Logic App -> Workflow Designer:
When a resource event occurs:
Resource Type - Microsoft.Resources.Subscriptions
Resource Name - (subscription being watched)
Event Type Item - 1
Microsoft.Resources.ResourceDeleteSuccess
Event Type Item - 2
Microsoft.Resources.ResourceWriteSuccess
What I'm completely unclear on is how to output the object deleted/created/modified. Like write to a log or send an email "X" object was deleted by Y user. If anyone has a clue on that, I would greatly appreciate it. Or if there is an easier way to accomplish this, rather than using Event Grid, I'm open to suggestions.
WAY-1
Here is my Logic App flow
I'm using Outlook 365 Connector with Send an Email Action
The Event Data gives whole information on What, When and Who created/modified/Deleted the resource.
Here is the screenshot of the mail that I received.
you can add as many events as possible by clicking Add New Item
WAY-2
You can add logs to your storage account and check the details from there as below.
WAY-3
You can check it in the logs from Overview pane which gives complete details on particular Run Triggers.

CakePHP Behaviors call to behavior method returns error

I've been working with cakephp for personal use. Now I understood that I want to create some functions that will be repeated in many models of my project, so I found out by Cakephp docs that the best way to do it is using Behaviors.
Objective:
Each time a new entity of my project models are created, I want to notice some users(coworkers) by email. Like a new project added, new task added, etc...
What achieved until now
I created a behavior with an afeterSave event listener; I attached it in one of my models.
When I create I add a new task it runs the behaviors methods and send a simple email.
Problem
The problem is to find out witch model has called the event
I read the cake2.x docs and the afterSave event used to receive the event and the model in witch you could call alias to know the model name:
public function afterSave(Model $model,...){
$model_name = $model->alias;
if ($model_name == 'some_model'){
//code for specific model
} else (...)
}
However in cakephp 3.9 we receive Event and EntityInterface:
public function afterSave(Event $event, EntityInterface $model)
{
# I tried $mail_HTMLmessage= $model->_registryAlias;
# I tried $mail_HTMLmessage= $model->_className;
# I tried $mail_HTMLmessage= $model->get('className');
$this->sendMail($mail_HTMLmessage);// this is another method that i defined in my behavior that sends an email to me with the string mail_HTMLmessage as the mail message.
return true;
}
I've tested mail_HTMLmessage=$event->getName() and in my email I received event.afterSave as expected.
However everything I tried to get model/class name it returned an empty string.
Is it possible to get the model name? and what is the best way to do it?
Thanks in advance
I believe what you're looking for is not in the event at all, but the entity. getSource(), to be specific.

ZK window not unique in ID space

In our project we use ZK for webpages. There is a combobox which has lists. When selected, it fetches data from a java object through onSelect, i have given the logic.
when i select one there are 4 listboxes on that page to be filled with data according to the selection. when i select first time, no problem occurs.
But on second time i get an error pop-up like "Not Unique in the id space of Window" and showing the list box item id which have to be filled on select.
Can any one help out there?
Note: Though it shows this error i get the listboxes filled correctly according to the combo box selection. Still i cant stop this error occurring..
Your issue is a conflict of ids in ZK's id space.
A bit of background..
ZK generates ids for components at runtime, if you open up the DOM in the browser you'll see each component has some machine readable id.
However, you can also give components an id. This id does not go to the DOM but lets you reference the component in your application.
These two shouldn't be confused. The conflict you're experiencing is with the latter type of id; you are assigning a component an id in your Java code or in your ZUL file which, at runtime, is not unique.
The case you describe where it only happens the second time you click is a tell tale sign here. The content you are adding on the event has an id defined in it and you are not removing this content when you are done.
Consider the following example:
#Wire
private Window myWindow;
#Listen(Events.ON_CLICK + " = #myButton")
public void onMyButtonClicked() {
Label myLabel = new Label("sean is cool");
myLabel.setId("myLabel");
myLabel.setParent(myWindow);
}
This will work the first time you click myButton, but will throw your error on the second click. That is because the second event tries to add myLabel to myWindow but there is already a myLabel there.
There are lots of ways to resolve this depending on what you are trying to do.
Have a look through the ZK documentation on ID Spaces for more.
I also faced the same error.
My scenario is the same, only the widgets being used are different.
Hence putting my workaround here.
I have put the following piece of code in the doBeforeCompose() method of the composer:
Component widgetWithId = page.getFellowIfAny("widgetWithId");
if (widgetWithId != null) {
widgetWithId.detach();
}
Here widgetWithId is the component/widget, which is tried to be regenerated by the code, with the same Id and ZK is throwing error for it.

How to know if you're Dropping in the same app instance where you made the Drag in WPF?

the title pretty much explains my issue:
I am right now taking care of drag & drop in my app. I can have many instances of my app running at the same time, and I can drag from one instance to the other without trouble.
Now, I would like to know if I'm drag & dropping "internally" (i.e: the drop occurs in the same instance as the drag) or "externally" (the opposite)
I went this far: I need to add to my dragged data a unique ID (something like a PUID) that identifies the app where I'm making the drag. Then I can just compare this id to the one I have locally on the drop and see if it is the same.
I have no problem transferring such info in my drag Data, the issue is more to find this UId.
I have been thinking using the Process.GetCurrentProcess().MainWindowHandle; but I'm not sure if this is a good idea.
What option(s) do I have to make this work?
I would simply create a readonly Guid that gets set when you start your app.
You can put this wherever your main logic lives (MainWindow or ViewModel).
Here is a snippet:
public class MyViewModel
{
private readonly Guid mUID = Guid.NewGuid();
// In case you want a property for it
public string UniqueApplicationID
{
get { return mUID; }
}
public void OnDropHandler(MyViewModel objectBeingDropped)
{
if (objectBeingDropped.UniqueApplicationID == mUID)
return;
// Handle drop normally here
}
}
The D-n-D is much like an UI activity, than an internal one.
I would distinguish two contexts: dropping a file, and dropping some object (e.g. VS designer). In the first context there's no problem at all, because it doesn't matter where you pull the data. In the second case, you should know what object has been chosen. For instance, you have a listbox with many items (e.g. the alphabet chars), once the user D-n-D any of those items, the internal operation is a simple reference to the selected object. By pulling the data from another app, you won't be able to find your object, because the source is different.
In case of structs or strings, you may wrap them with a GUID, as you correctly proposed.

Refactoring Form.ShowDialog() code to MVP

I have a WinForm and few properties that are set on it.
for example : Name,Address are accepted on the Form.
(many more properties in actual example)
The current implementation is somewhat similar to
frmName frmView = new frmName (); //frmName is WINFORM
frmView.Name= "ABC"; //any valid string or read this from file
frmView.Address="SomeAddress"; //any valid address or read this from file
if (frmView.ShowDialog() == DialogResult.OK)
{
//OK CLICK PROCESS and
// get new values edited by user
string name = frmView .Name;
string address = frmView.Address;
doProcessing(name,address);
}
else{
//Ignore cancel click..
}
how do i convert this to a MVP based Winform application.
Also need to refactor the processing done on ShowDialog() to the Presenter/Model
(dunno exactly where to do it)?
Also need to avoid writing code on the form itself.(Passive view)
Thanks All.
I'm still experimenting with different MVP approaches myself, but the way I'm currently doing it is like so:
frmName frmView = new frmName();
if (frmView.ShowDialog() == DialogResult.OK) {
presenter.RequestProcessing(frmView.Name, frmView.Address);
} else {
//Ignore cancel click..
}
You say you want to avoid writing any code on the form itself, but this doesn't make sense to me. In Passive View, you pass on all application-specific requests to the controller or presenter.
In this example, the view handles view-related logic. Opening the dialog box isn't a user action that anything else (such as the presenter) needs to be informed about. Just like opening a context menu, a dialog box is part of how this particular view chooses to offer those application-specific requests to the user. Until the user actually goes through with it and submits the request, the presenter doesn't need to know anything.
In some circumstances where I've needed to be able to handle errors within the dialog box itself, I've passed the IPresenter object into the dialog box's constructor. It can then make the appropriate presenter request itself when the "OK" button is clicked, for example, and can show a message box instead of closing in case of an error.
There are a lot of variations on MVP, but I hope this helps. Good luck with setting it up.

Resources