Mono Form.Show from another form doesn't work - forms

I am trying to port a WinForms app for use with Mono, and I've recently noted that calling Form.Show() from another form will either do nothing or cause the new form to flash and disappear. I read something about the new form needing a message pump, which is accomplished with Application.Run(), but that's already been called. Any idea why this doesn't work? I can't use ShowDialog because my program relies on events fired by completed async tasks, and I don't want to block a ton of extra threads that will be done right after the Show call.

Have you tried to hide your current form before showing/displaying your new one?
Seems to me like your form is indeed being displayed but for some strange reason it's being delegated to the background. Worth a shot.

Related

jQuery File Upload's change callback returns nothing

Everything about the uploader is working perfectly, but one callback seems to do nothing:
.bind('fileuploadchange', function (e, data) {
console.log("foo");
})
Binding to the change event never returns anything... so my question:
1) Is this a bug? I'm using the most recent version.
2) Is there another/better way to detect when files are manually removed from the upload queue (something more elegant than reading DOM elements)?
There might be a bit of misunderstanding in what the fileuploadchange event does.
The admittedly limited documentation for the change event states:
Callback for change events of the fileInput collection.
That means it's an event callback for the native change event of all the file input elements of the fileupload widget.
This event only fires if the user selects one or more files via the file picker dialog that is displayed after clicking on the file input button.
Technically, the basic fileupload library doesn't keep track of a queue.
It's up to the UI implementation to handle this, via the various callbacks provided by the basic library.
Until the user actually starts the file upload, there is technically nothing the basic library could keep track of.
And as soon as a file upload is started, the done and fail events are your basic building blocks.
By the way, the sample UI implementation handles the removal of items that have not been started yet by triggering a manual fail event.

Stopping Ember.js Controller

My question is very basic on one hand but on the other hand the general situation is more complex, plus I cannot really get any working sample.
I'm developing/maintaing a web-application which is currently in transition from GWT code base into Ember.js.
Most of the newer code already relies on Ember.js and I think it's really awesome.
The problem is we cannot use Ember Router as all the request are being handled by the GWT.
In order to enabled the application run in this unusual configuration we have special JavaScript files that create our Ember main objects (Controllers & Models) for us.
As you can imagine navigation between tabs is cumbersome and is handled by GWT who creates Ember objects when needed. We are in transit toward a brave new world Ember Router and all.
But in the meantime, this is the problem I'm facing right now.
The user clicks a link which opens a page that contains some Ember based table.
The data is retrieved form the server using some Ajax code. Upon success it spawns a forEach loop which tries to pushObject all the received date into our Ember based components.
My problem happens when the user quickly switches between tabs. In this case the first list of object has not finished rendering yet and suddenly there's a new set of objects to handle. This causes Ember to throw errors like:
"Uncaught Error: Cannot perform operations on a Metamorph that is not in the DOM. "
and
"Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist."
Is it possible to prevent the loop from trying to render?
I've tried checking if the controller in question is already inDOM and it is, is there a way to notify Ember this object is no longer valid?
Sorry for a lengthy question and lack of running sample.
I'd probably modify the switch tab code to only execute afterRender has completed, that way you aren't mucking with ember objects while they are being used.
Ember.run.scheduleOnce('afterRender', this, function(){
// call GWT switch tab routine
});
Thank you Daniel and Márcio Rodrigues Correa Júnior. eventually what I did is to add a patch that would check the current context of the application (in my case the currently selected tab). If upon receiving the AJAX response the application is in the correct context (meaning the user haven't change the tab) go on. Otherwise just ignore the response and do not try to render it.
Now it seems to be working

click event not needed in .NET 4.5?

I almost feel bad asking this stupid question, just upgraded to VS2012 from VS2008 and I started out by create a new Web Forms Application, and bang there you go a bunch of files and folders created. When I view the Register.aspx page, there's this line:
<asp:Button runat="server" CommandName="MoveNext" Text="Register" />
and when I run this application, it actually works, it creates a local DB and the user are inserted into that DB.
But HOW? I see no click events, I see no function in the code behind handling the MoveNext command, is this some kinda of new way of handling events? Where does the magic happen? Thank you guys
It seems like a bit of magic but it is part of the ASP.NET 4.5 Framework. It is the CreateUserWizard control on Register.aspx, there is an attribue called OnCreatedUser that wires up the code behind "click" event you are looking for. Should be called RegisterUser_CreatedUser.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.createuserwizard.oncreateduser.aspx
It's all part of the CreateUserWizard control. If you disassemble that class, you'll find a bunch of code that knows how to hook up to your markup. My guess is somewhere in there is something that attaches the MoveNext command to an event handler inside that user control.
When your button does a postback on the page, the lifecycle for the control is executed, so somewhere in that lifecycle is all the work.

Access 2010 Form.Repaint - Hanging

I'm hopefully missing something obvious here...
I have just kicked off developing a new Access 2010 application. Something personal and hopefully simple.
The first thing I need to do is read a bunch of files off of the hard drive. I parse the contents adding the information to a table if it doesn't already exist.
Code works fine, that's not the issue. As it can take a while I've added a simple progress dialog using a standard form but in dialog/popup mode. As the For Each loop of the FSO.Folder.Files object is progressed I send some information to a couple of text boxes and issue a Me.Repaint (have also tried DoCmd.RepaintObject acForm, "FormName").
The issue is that I can get anywhere from 5% to 35% of the process complete before the repaints stop responding. The form only repaints when it gets to 100%.
The process uses limited recursion - if there is a subfolder - it calls itself to process that subfolder, but the folder structure is fairly linear so not many of those.
There are nothing bound to the form. All table updates happen in code and via RecordSets.
Any ideas why Access stops responding?
Cheers,
Roy
Add DoEvents after Repaint. That will cause Access to yield to Windows, which will can then handle its pending tasks ... such as updating the display in this case.
Actually, if your code updates text boxes, I don't see why you need to Repaint the form in order to display the changes. Try something like this instead ...
Me.MyTextBox = "hello"
DoEvents

Periodically calling TinyMCE's triggerSave function

If anyone knows TinyMCE well, do you know if it has built-in support for periodically calling its triggerSave function?
(This function copies it's content to its "parent" textarea. I want to observe said textarea for changes so I can implement autosave.)
Thanks
Don't try autosave, trust me on this one. triggerSave is buggy and when it fails it fails silently so you think that your content got posted, but in reality it didn't. After it fails once it will no longer work for the rest of the session, as in until the page is manually reloaded and tinymce does another full init().
Just got bit by this one badly, again. Never again trust triggerSave.
You could easily do this yourself by using JavaScript's setTimeout() function.
See http://www.w3schools.com/js/js_timing.asp.