How to tell when AxWindowsMediaPlayer is downloading? - vb.net

I am using AxWindowsMediaPlayer on VB.NET to preview MP3 files from the web so that the user can choose to download it if he likes it. It works. I just put a link in the URL property and after a while it begins playing.
... after a while, of course. Because it has to download the file first. Perhaps I realized that because of my slow connection XD.
But that made me think: how can I tell if the player is currently downloading a file? So that I can put a label saying "Please wait, preparing file..." or something.

Look at using the Buffering Event and the BufferingProgress Property. According to the MSDN Link:
Use this event to determine when buffering or downloading starts or stops. You can use the same event block for both cases and test IWMPNetwork.bufferingProgress and IWMPNetwork.downloadProgress to determine whether Windows Media Player is currently buffering or downloading content.

Related

Uploading files to server via JSF 2.2 and h:inputFile

UPDATE:
It turns out that there was an ajax call inside the inputFile that would cause the upload to start prematurely. That ajax was supposed to handle the selected file before the actual submit button was clicked, but neither I nor the person who coded it before me knew it would behave that way. And, as we only tested it either locally or with small files, we never noticed the problem.
I'm a newbie when it comes to file upload and I need some guidance on that subject.
I have a code that gets a file through h:inputFile then, when the submit button is pressed, sends it to the server using InputStream and OutputStream in a pretty standard way. It works well, but I'm facing a problem:
When I select the file, it takes its time to upload to the page(?). Then, when I click the submit button, it takes its time again to send that file to the server.
To make myself clear, here's a real case: I clicked the inputFile button and selected a 50mb file. It took 10min to conclude that. Then, I clicked the submit button and it took another 10min to send it to the server. That's a total 20min to upload that file, when it should have been only 10min.
Saving that time is crucial for my users, since their internet is very slow (< 1mbps) and they will be uploading videos around 40-90mb, which will take hours.
So, how do I optimize that? And, as I'm already asking, how exactly does h:inputFile work - I mean, it sets the Part in the bean, which can then be handled, but does it actually upload the file right away?
I'm using JSF 2.2.7 and GlassFish 4.
(Sorry that I didn't post the code, but I don't really think it's necessary. If that's not the case, just let me know.)

VB.Net automate flash in WebBrowser

I've passed many hours searching the web for a solution to something which seems obvious, but without results.
I need to automate a task in a Flash application running on my intranet.
I can't change the Flash application nor do I have access to the source code.
it's not a Flash movie but an application.
I can't download the swf.
I'm using a WebBrowser in a form. The Flash app is displaying without issues.
So far, I have been able to automate the task (clicking on some buttons, then inputting text and finally saving the results on a server). It works but it's not clean at all because I use hard-coded timers to wait a given action is done and then I click on very specific point at given coordinates in the application.
What I would like to do:
Avoid hard-coded timers. the Flash application takes some time to display all elements on the window (from 20 to 60+ sec). I would like to be able to detect when all elements are loaded. I tried to retrieve the text of the windows handle, but while I can retrieve the Flash hwnd, I can't retrieve the content (through messages).
In brief, instead of waiting 60sec (and not being 100% sure it's enough), if the last element to load in the Flash app has "ABC" written in it, I would like to detect it's displayed so that I can continue the sequence (click on the next button).
I'm using VB.net. Any hints to achieve that would be appreciated.
Lol. I am trying to do the same thing but with no results. You can try to see if there are POST/GET codes that can help you if the application has an online nature. Other than that you can only simulate clicks, because flash can't be easily interacted with. This is why most of the things are going to swap with HTML5 now.

Sending key stroke to front application in Cocoa?

I was wondering would this be hard to do; I have a barcode reader for my isight (mac webcam) (evoBarcode). At the moment, the program reads the barcode fine and adds it to a text field at the side of the application. Event when in the background, the application continues to run and read barcodes which is fine.
I was wondering, is it easy to send the result from this (I have already located the exact variable where the barcode is caught) to the front application as a keystroke? (the front application being textEdit or something.
I've tried searching around for a bit and found CGRemoteOperation, but havn't found a great lot of resources or examples on it.
Any ideas?
Thanks.
Depending on the reader behaviour another option could be to implement a service menu item. That way you don't mess with the clipboard.

Capture text in Xcode's console window

My problem is that i wish to capture the text that is displayed in the
console of Xcode when an application is executed and display it in a
text box in my App.
If i override NSLog i can just capture the explicit NSLog commands
that are issued in the course of the program. However many statements
that are just inserted by the compiler are not captured.
Is there a way to read the Xcode Console buffer while the app is
running and display it in the app too ??
What you see in the log window of Xcode is a composite of the messages that would normally go to standard out and standard error file streams and to the system log. If you want to capture those streams, you need to close them and reopen them as pipes or files.
If you do this, the documentation says that if you redirect standard error from the default, NSLog will log to that as well as the console. Thus you don't need to override it.
Redirecting standard error and standard out is a fairly common thing to do in Unix. The basic technique to redirect to a file is to close the file descriptor using close(2) and then reopen it using open(2) or pipe(2).
The Xcode Console is just a window that reads errors and such from the Console logs. Try reading from there.

VB.Net: How to fill in a form in a website, then click at a button and download the file using webbrowser control?

I am using a WebBrowser-Control to fill in a webform and then click at a button, this currently results in a standard Download File Dialog (you get these if you download a file using internet explorer), but instead, I have to catch this file and save it automatically with a by me defined name to a specific folder.
I am trying to code a little application in vb.net which download the Export-file from my wordpress-blog, and I want to do this completely without user-interaction.
Currently everything works, except the downloading of the file.
I tried to catch it with the event System.Windows.Controls.WebBrowser.Navigating(ByVal Object, ByVal System.Windows.Navigation.NavigatingCancelEventArgs) but I don't see where to download the file from :(
I hope you guys can help me.
Use WATIN. Very, very similar to the IE browser control, BUT it has all sorts of cool handlers for dialog pop ups, including security warnings and file download/save options.
You could use Fiddler to capture the HTTP request that is used to get the file and just record the response. Then, you could save the response body to a file.
Fiddler has extensive support for automation.
implement IServiceProvider on your webbrowser site and responde service queries to IDownloadManager